question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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:

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:3
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
zjkippingcommented, Nov 15, 2022

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.

0reactions
zjkippingcommented, Dec 12, 2022

Having disabled and then re-enabled all my extensions it looks like I can’t reproduce this anymore… I guess something went haywire with the eslint extension in tangent with another extension (or possibly not). Either way I’ll close this issue. thanks for the help @meeroslav!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I add ESLInt custom rules directory to VSCode
I am running VSCode with the ESLint plugin. My project contains some custom rules, which live in a particular directory.
Read more >
ESLint: Your Nx Workspace Rules - James Henry - YouTube
In this talk we will cover what it takes to create and run lint rules directly in your Nx workspace specific to your...
Read more >
enable ESLint in vscode - YouTube
enable ESLint in vscodepreRequiste:Have typescript installed. npm install typescriptInstall tslint globally and as dev dependencynpm install ...
Read more >
nrwl/eslint-plugin-nx
The ESLint Plugin for Nx contains a collection of recommended ESLint rule configurations wrapped as ESLint plugins and an Nx specific ...
Read more >
VSCode Setup - Console Logs
Visual Studio Code (aka VS Code) is a code editor for all platforms that is free and ... of eslint-config-airbnb@latest Local ESLint installation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found