Unfortunately, you cannot directly import ESLint code style configuration (WEB-19350) into WebStorm. However, you can manually configure the code style by following these steps:
- Open the Settings dialog (File | Settings | Editor | Code Style | JavaScript).
- Under Spaces, select ES6 import/export braces.
Temporary Solution:
- Export your ESLint config to JSCS using a package called Polyjuice.
- Use the output from your ESLint config to configure JSCS in WebStorm.
**Method for IntelliJ IDEA 2017.2 and Later:**
- Install and enable the JavaScript Support plugin.
- Go to Preferences | Language & Frameworks | JavaScript | Code Quality Tools | ESLint.
- Enable ESLint and configure your Node interpreter, ESLint package, and configuration file.
- Go to Preferences | Keymap, search for eslint, and add a keyboard shortcut for the Fix ESLint Problem action.
Using a Macro for Automation:
- Record a macro that includes the following actions:
- Save all files (File | Save All).
- Run ESLint (Strg + Shift + A).
- Assign the macro to a keyboard shortcut.
Importing ESLint Rules:
- Right-click on your
.eslintrc.js
file and select Apply ESLint Code Style Rules. - In the Settings or Preference Menu, exclude the indentation of
<script>
tags.
Checking Node Version Compatibility:
- Ensure that the Node version you are using in your terminal matches the version specified in your project's
.nvmrc
file andpackage.json
.
Using Prettier with ESLint Rules:
- Go to Preferences | Languages & Frameworks | JavaScript | Prettier.
- Under On 'Reformat Code' action, select Use ESLint rules to reformat the code.
Automatic ESLint Fix with Run ESLint -fix Option:
- Go to Preferences | Language & Frameworks | JavaScript | Code Quality Tools | ESLint.
- Select the automatic option and enable the Run eslint -fix option.