nx: VS Code cannot find @nrwl/nx/workspace custom eslint rules without Nx Console extension installed

Current Behavior

VS Code shows error Definition for rule '@nrwl/nx/workspace/my-custom-rule' was not found.eslint(@nrwl/nx/workspace/my-custom-rule) when Nx Console extension isn’t installed on the VS Code editor. This occurs when looking at a file the custom rule is applied to from the .eslintrc.json.

Expected Behavior

I would expect there to be an easy way to configure this if the Nx Console extension is the thing orchestrating the wiring of the custom workspace rules to the VS Code ESLint extension (or however it works).

Or just for this to work regardless of Nx Console being installed. Some of us in the community don’t bother with it since we only really use the terminal CLI. It also isn’t obvious that the reason the lookup of the rule fails is because of Nx Console extension not being installed.

Steps to Reproduce

I created a fresh nx15 workspace with a custom workspace linting rule generated. The README explains how to reproduce the error. https://github.com/zjkipping/nx-custom-workspace-eslint-rules

The gist of the repo is that without the Nx Console extension installed you get an error in VS Code while the eslint extension tries to lookup the custom workspace rule. If you install the Nx Console extension and restart the ESLint Server you won’t get the error anymore.

Failure Logs

Environment

Node : 18.12.0 OS : win32 x64 npm : 8.19.2

nx : 15.1.0 @nrwl/angular : 15.1.0 @nrwl/cypress : 15.1.0 @nrwl/detox : Not Found @nrwl/devkit : 15.1.0 @nrwl/esbuild : Not Found @nrwl/eslint-plugin-nx : 15.1.0 @nrwl/expo : Not Found @nrwl/express : Not Found @nrwl/jest : 15.1.0 @nrwl/js : 15.1.0 @nrwl/linter : 15.1.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/rollup : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 15.1.0 @nrwl/web : Not Found @nrwl/webpack : 15.1.0 @nrwl/workspace : 15.1.0 typescript : 4.8.4

Local workspace plugins:

Community plugins:

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 19 (8 by maintainers)

Most upvoted comments

As a side note, I tried making use of the eslint options rulePaths in the VS Code .vscode/settings.json file following this stackoverflow without much luck.