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
ESLint v9 contains breaking API changes #3699
Comments
That expectation is flawed; the point of it being in beta is for plugins to begin to address the changes - announcements are irrelevant. Thanks for the report. A fix for this will also need to add eslint 9 into the test matrix. |
I put up a branch running tests on eslint 9; https://github.com/ljharb/eslint-plugin-react/actions/runs/8147742013/job/22269131527#step:5:21 is failing because the |
Additionally, when I comment out those 3 lines, i get 22166 failures because If the former, how can we run the same tests with both normal eslintrc stuff on eslint 8, and also with flat config on eslint 9? |
ESLint 9 makes the flat config the default. It renames the ESLintRC style classes to be There's a migration guide that might be a good place to start in terms of compiling a list of required tasks for this |
Awesome, thanks for the pointers. That will help get us unblocked for eslint 9, but we'll still have a lot of work to support eslint 10. |
Is there any update on this yet? Or is this still quite far off? The first release candidate for v9 released last week |
@james-yeoman it is almost never the case that all the plugins in the eslint ecosystem support a new major until awhile after the final release is out. It'd be great to beat that, but if there'd been any update, it'd be in this issue :-) |
Eslint officially released v9.0.0 today. Hope this plugin will support it soon! |
Getting |
I'd like to continue using this plugin, but this bug is unfortunately stopping me. I hope we get to see a fix soon! |
Nobody’s forcing you to upgrade to eslint 9 right away ¯\_(ツ)_/¯ new eslint majors always take months before everything supports them, and this one will take longer because it’s changing the default config format. |
Having worked on a couple of other plugins, I want to elaborate that I think there's two parts to this upgrade. The real breaking change for v9 is the fact that v9 has removed APIs - it looks like this is being covered in #3727. The second change is flat config compatibility. Consumers can use the plugin as-is (as long as the API issues are resolved). It is slightly more work, but it is possible. Of course, supporting the flat config natively makes it easier, and ESLint has a good migration guide should anyone wanting to upgrade to v9 feel like contributing a patch (I might eventually, but I have several other plugins that I'm focussing on). |
Also getting the error for these rules:
|
Thanks for all your hard work on this, maintainers. Until support for eslint v9 is ready, you can create a fresh v8 config with: npm install -D eslint@8
npm init @eslint/config@0 |
Hi, react/no-string-refs |
I'm not a maintainer here, but listing the details of what's failing is not going to help this move forward. The list will be obvious to anyone running the tests with v9. They effectively amount to "me too" comments that are only really serving to spam everyone with email. If you look around, you'll see there is ongoing work towards v9 by contributors - #3743 and #3727. Be patient or help out. Adding extra comments here isn't going to help. |
I found the ESLint Compatibility Utilities worked for me. CodeSandbox example:
|
Even with the use of |
@onlywei no, you should continue to hold off upgrading to eslint 9 until all of the eslint-related packages you use support it. |
@saltycrane thanks for your comment above, this was helpful! For anyone who is not using the First, install
import { fixupPluginRules } from '@eslint/compat';
import react from 'eslint-plugin-react';
import globals from 'globals';
export default [
{
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react: fixupPluginRules(react),
},
rules: {
// Error on creating components within components
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
'react/no-unstable-nested-components': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
]; |
@ljharb it looks like the code changes have been merged, and the only task left is to make the rule tests work with ESLint v9? |
@mdjermanovic those were just the deprecations, which are the easy part. next we need tested flat config support, and then figuring out how to test on eslint 9 since we need to simultaneously test on eslintrc in a bunch of older versions (unfortunately since RuleTester doesn’t obey the eslintrc env var, this work can’t be delayed until after shipping v9 support) |
Little notice, as I know, VS Code support for flat config isn't still stable. So even when all plugins will be upgraded, without stable IDE support eslint 9 isn't very usefull (for my colleagues 🙂) |
I'll submit a PR for rule tests, per #3743 (comment). |
@MirKml it'll likely be 6 months minimum before eslint 9 is made fully useful by the majority of the ecosystem supporting it; it normally takes 2-3 months for any eslint major, but eslint 9 is a much more disruptive change, so it'll probably take longer. |
@karlhorky have you found a way to make this typesafe? I'm using something like:
but getting yelled at because:
EDIT: For anyone wondering about typesafety as a result of this, please see this issue in the |
@adamspotlite here's what I did, works without issues so far (aside from npm crying about peer deps). devDeps:
npm update --force eslint.config.js:
fixupConfigRules did not work for me however, but afaik all it does is add one setting to language options (below) and loads the rules (which we are doing anyway). Not really sure how necessary this language option is, but you can add it yourself if you find yourself troubleshooting:
If anyone's wondering, I only included my other eslint dependencies for completeness. I don't think any of them would be necessary (except typescript-eslint if you're using typescript, and this should be on rc-v8). |
To be clear, peer dep warnings aren’t “crying”, they’re “it might happen to work sometimes, but if it doesn’t it’s your own fault, this is the danger zone”, and they should be taken very seriously. |
Is there an existing issue for this?
Description Overview
Upon bumping to the ESLint beta for v9, I was met with several errors in my monorepo during the linting test-run.
Namely:
context.getScope is not a function
"react/no-string-refs"
context.getFirstTokens is not a function
"react/display-name"
I get that it's still only a beta, but these API changes were announced in september 2023.
Additionally, there are some rule structure changes outlined separately that may be worth ensuring are in compliance.
Expected Behavior
Given that ESLint v9 is now in beta, I wasn't expecting to find any plugins that haven't yet addressed the API changes
eslint-plugin-react version
v7.34.0
eslint version
v9.0.0-beta.1
node version
v18.12.0
The text was updated successfully, but these errors were encountered: