Notification texts go here Contact Us Buy Now!

How to make WebStorm format code according to eslint?

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 and package.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.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.