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: Unable to test rules in v9 in both flat config and eslintrc #18292

Closed
1 task
ljharb opened this issue Apr 8, 2024 · 3 comments
Closed
1 task

Bug: Unable to test rules in v9 in both flat config and eslintrc #18292

ljharb opened this issue Apr 8, 2024 · 3 comments
Labels
bug ESLint is working incorrectly repro:needed

Comments

@ljharb
Copy link
Sponsor Contributor

ljharb commented Apr 8, 2024

Environment

Node version: n/a
npm version: n/a
Local ESLint version: v9.0.0
Global ESLint version: none
Operating System: n/a

What parser are you using?

Default (Espree)

What did you do?

A contributor ran the RuleTester with ESLINT_USE_FLAT_CONFIG=false, but it seems like there's no way my eslint plugin can maintain compatibility with eslint v9 and eslintrc (since unless it's tested, it's not compatible)

What did you expect to happen?

I expected RuleTester to function just like it did in eslint v8, so I can test rules via eslintrc.

What actually happened?

import-js/eslint-plugin-import#2996 (comment) reports it's an error

Link to Minimal Reproducible Example

import-js/eslint-plugin-import#2996 (comment)

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@nzakas
Copy link
Member

nzakas commented Apr 8, 2024

As we announced, RuleTester in v9 now tests against flat config because that is the default configuration system.

Functionally, if your rules pass RuleTester in v9, they should work with eslintrc also, as the fundamental parts of rule tester remain the same, it's really just the format of the options that have changed.

If you really need to test eslintrc specifically, then you'll need to use ESLint v8.x for that.

@nzakas nzakas closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
@ljharb
Copy link
Sponsor Contributor Author

ljharb commented Apr 8, 2024

It makes perfect sense for RuleTester to test it by default, but I don't understand why eslint 9, which still supports two config systems, has failed to provide a way to test both.

@aladdin-add
Copy link
Member

aladdin-add commented Apr 10, 2024

I'm 👍 to the change.

Remember: users can still use eslintrc with eslint v9 (ESLINT_USE_FLAT_CONFIG=false), but it's no longer testable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ESLint is working incorrectly repro:needed
Projects
Archived in project
Development

No branches or pull requests

3 participants