Skip to content

FAQ

Why use ESLint for formatting?

Refer to Why.

What are Stylistic Rules?

According to typescript-eslint's definition, most lint rules fall into one of two to three categories:


  • Logical: Rules that are concerned with the logic and runtime behavior of code (such as missing awaits or invalid logical checks).
  • Stylistic: Rules that focus on style concerns which do not generally impact the runtime behavior of code. These are mostly about naming or which roughly equivalent syntax constructs to use (such as function declarations vs. arrow functions).
    • Formatting: A subset of Stylistic rules that are solely concerned with trivia (semicolons, whitespace, etc.) and do not affect the runtime behavior of the code. These rules may conflict with dedicated formatters such as Prettier.

For ESLint Stylistic, our primary focus is on the formatting and stylistic rules inherited from eslint and typescript-eslint. We will maintain some stylistic rules; however, not all will be included. Their inclusion depends on whether the upstream projects choose to retain them. We welcome new rules proposed by the community for the future when we move into the maintenance phase and develop the infrastructure to introduce experimental rules. For more details, track the Project Progress.

What's the requirements for ESLint Stylistic?

Since majority of the rules are migrated from ESLint v8 and typescript-eslint v6, we inherit the same requirements:

  • Node.js >=v16.0.0
  • ESLint >=v8.40.0

How to auto-format on save?

VS Code

Install VS Code ESLint extension

Add the following settings to your .vscode/settings.json:

jsonc
{
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
}
JetBrains IDEs
  • Open the Settings dialog (Ctrl + Alt + S)
  • Go to Languages & Frameworks -> JavaScript -> Code Quality Tools -> ESLint
  • Select the Run eslint --fix on save checkbox.

Refer to JetBrains Docs

The error messages (squiggly lines) for code style are annoying

If you are using VS Code, you can override them with the following settings in your .vscode/settings.json:

jsonc
{
  "eslint.rules.customizations": [
    {
      "rule": "@stylistic/*",
      "fixable": true,
      "severity": "off"
    }
  ]
}

This tells VS Code to not show errors in your editor, but still have the ability to auto-fix them. You can also set "severity": "info" to keep squiggly lines but not have them look like errors.

How can I migrate?

Refer to Migration Guide.

When should I migrate?

Also refer to Migration Guide.

Released under the MIT License.