Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md: WebStorm/PhpStorm support #345

Merged
merged 2 commits into from Dec 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -170,6 +170,13 @@ For automatic formatting, install **[vscode-standard-format][vscode-2]**.
[vscode-1]: https://marketplace.visualstudio.com/items/chenxsan.vscode-standardjs
[vscode-2]: https://marketplace.visualstudio.com/items/chenxsan.vscode-standard-format

#### [WebStorm/PhpStorm][webstorm-1]

Both WebStorm and PhpStorm can be [configured for Standard Style][webstorm-2].

[webstorm-1]: https://www.jetbrains.com/webstorm/
[webstorm-2]: docs/webstorm.md

### What you might do if you're clever

1. Add it to `package.json`
Expand Down
44 changes: 44 additions & 0 deletions docs/webstorm.md
@@ -0,0 +1,44 @@
# [WebStorm/PhpStorm][webstorm-1] configuration for Standard Style

1. Turn off your IDE
2. [Figure out where your configuration lives][webstorm-2] (_IDE Settings_ section)
3. Navigate to `your-config-dir/codestyles`
4. Create a `Standard.xml` file:

```xml
<code_scheme name="Standard">
<JSCodeStyleSettings>
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
</JSCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JavaScript">
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="SPACE_WITHIN_BRACKETS" value="true" />
<option name="SPACE_BEFORE_METHOD_PARENTHESES" value="true" />
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
```

5. If you don't want to clutter your project with extra dependencies and config files, then go global:

- `npm install -g eslint eslint-config-standard eslint-plugin-standard` (`sudo` might be required)
- `echo '{"extends": ["standard"]}' > ~/.eslintrc` (be warned: it overrides an existing file)

6. If you're OK with local dependencies and config, do (5) without `-g` and `~/`
7. Fire up the IDE and open a _Settings_/_Preferences_ screen (choose between project and default settings accordingly to your preference)
8. Under `Editor > Code Style > JavaScript` change `Scheme` to `Standard`
9. Under `Editor > Inspections > JavaScript > Code style issues` untick `Unterminated statement`
10. Under `Languages & Frameworks > JavaScript > Code Quality Tools > ESLint` just select `Enable`, only in rare cases you'll have to configure `ESLint package` path

[webstorm-1]: https://www.jetbrains.com/webstorm/
[webstorm-2]: https://www.jetbrains.com/webstorm/help/project-and-ide-settings.html