Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure WebStorm to work with nx lint instead of ESLint?

When working on nx projects with WebStorm (and probably with other JetBrains IDEs) I keep getting this error:

Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

I do have the parserOptions.project defined in the libs/mylibrary/.eslintrs.json:

{
  "extends": ["../../.eslintrc"],
  "parserOptions": {
    "project": "./tsconfig.*?.json",
    "tsconfigRootDir": "./libs/mylibrary"
  },
  ...

The error does not reproduce when I run ESLint manually, via npx eslint ./libs/mylibrary or via nx (nx lint mylibrary).

Any idea how to configure WebStorm to work well with nx lint?

like image 626
Nitzan Tomer Avatar asked Oct 24 '25 17:10

Nitzan Tomer


1 Answers

Can be a problem with wrong working folder the linter is run in. With Automatic configuration, the ESlint working folder is set to a folder where the nearest .eslintrc or eslintignore resides (as described in https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration) If the auto-detected working directory doesn't match your project configuration, you need to specify the working directory (directories) manually: in Settings | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint, change configuration to Manual and specify the directory in which you run eslint --fix in terminal (project root folder?) as a working dir - this should solve the issue

like image 176
lena Avatar answered Oct 28 '25 01:10

lena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!