Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Config Inspector uses recommended/deprecated rule indications from ESLint v9 rather than the installed ESLint version #53

Closed
Standard8 opened this issue May 19, 2024 · 2 comments · Fixed by #51

Comments

@Standard8
Copy link

I am working on setting up flat configuration with ESLint v8.57.0 as an initial step before switching to v9.

I wanted to check the configuration, so I was trying out config inspector. Looking at the rules applied to all files from the recommended config, I was surprised to see some that weren't flagged as being included in the recommended configuration, or that were flagged as deprecated.

STR

  1. In a new project, install ESLint 8.57.0 and config-inspector 4.8.0.
  2. Create a dummy index.js file
  3. Create a simple eslint.config.mjs file:
import js from "@eslint/js";

export default [
  js.configs.recommended,
];
  1. Look at the results in the inspector (npx @eslint/config-inspector)

Actual Results

The rules are marked according to how they are in ESLint v9.

Expected Results

The rules are marked as recommended or deprecated according to how they were for ESLint v8.57.0, or not marked at all if the information is not available.

@antfu
Copy link
Collaborator

antfu commented May 31, 2024

We read the info from your local eslint:

const eslintRules = await import(['eslint', 'use-at-your-own-risk'].join('/')).then(r => r.default.builtinRules)

Can you double check your lockfile and see if there is eslint v9 installed locally?

@Standard8
Copy link
Author

As referenced above, the project does not have ESLint v9 installed, I also do not have it installed globally.

If I install config-inspector into the repository that I created, then it seems to use v8 - the no-new-symbol rule is not marked as deprecated.

If I don't install config-inspector into the repository, but use it directly via npx @eslint/config-inspector@latest (as suggested by the readme then it is using v9 and no-new-symbol is marked as deprecated.

When I look in the .npm/_npx/ directory, I see that under the relevant node_modules/eslint/package.json ESLint is v9.

Looking around I can't see why there is a v9 installed in that .npm/_npx/ directory. If I clean it out and run only npx @eslint/config-inspector@latest then ESLint v9 gets put back into that directory.

So as far as I can tell, the inspector is picking up the ESLint installed alongside the config-inspector, rather than the ESLint installed in the local repository where the configuration is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants