Help with eslint upgrade
#2271 is failing to bump eslint versions:
- [x] We need to change our build to use Node 20 in
.github/workflow/**and.nvmrc. It would be nice to enforce it via package.json. - [x] This error:
ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files - [ ] New error:
[eslint ] Error: Could not find config file.
Hi @yurishkuro , unit-tests workflow is failing in my commit, how can i resolve
@Baalekshan the lint step is still failing after upgrade with
[eslint ] Error: Could not find config file.
[eslint ] at locateConfigFileToUse (/home/runner/work/jaeger-ui/jaeger-ui/node_modules/eslint/lib/eslint/eslint.js:350:21)
[eslint ] at async calculateConfigArray (/home/runner/work/jaeger-ui/jaeger-ui/node_modules/eslint/lib/eslint/eslint.js:385:49)
[eslint ] at async ESLint.lintFiles (/home/runner/work/jaeger-ui/jaeger-ui/node_modules/eslint/lib/eslint/eslint.js:815:25)
[eslint ] at async Object.execute (/home/runner/work/jaeger-ui/jaeger-ui/node_modules/eslint/lib/cli.js:500:23)
[eslint ] at async main (/home/runner/work/jaeger-ui/jaeger-ui/node_modules/eslint/bin/eslint.js:153:22)
[eslint ] error Command failed with exit code 2.
@yurishkuro Is this a concern ? Since, it was safely merged without any errors in the workflow. I didn't find this error in the PR raised only faced this in my forked repo.
@Baalekshan the change we merged was good, but it did not resolve this ticket, because the upgrade is still failing, just on a different error.
Oh right, what could be done now. Should I try fixing these errors? If so what can I do.
The upgrade is trying to bump eslint from 8.x to 9.x, there could be some breaking changes causing this issue.
I will look into it
ESlint 9.x won't find .eslintrc.js in default.
There are two difference ways to resolve this.
- Env
ESLINT_USE_FLAT_CONFIGsetfalse .eslintrc.jsmigrate toeslint.config.js
- https://eslint.org/docs/latest/use/migrate-to-9.0.0
- https://eslint.org/docs/latest/use/configure/migration-guide
Unfortunately, there are still some packages that can't support flat config (eslint.config.js)
eslint-config-airbnb: https://github.com/airbnb/javascript/issues/2804
It may be necessary to re-filter the .eslintrc.js content.
So do you mean we can't migrate completely but also use .eslint.config.js partially?
@Baalekshan
If you want to migrate settings, some of the packages will not work. (e.g. eslint-config-airbnb)
Set the environment variable ESLINT_USE_FLAT_CONFIG to false if you want to keep the full settings. (But I don't know about the possibility of .eslintrc.js being deprecated at some time.)
We can follow what @yurishkuro decides to do.
@tico88612 Alright!
@yurishkuro what should we do ?
In the linked airbnb ticket there is some mentioning of compat workaround, maybe it could work. Otherwise we can wait till they support it. I don't see much point in using env var solution, if's probably temporary anyway.
Has anyone figured out the issue?
@yurishkuro above issue is solved or something is still wrong? Should I work on it.
@MiirzaBaig @ayushrakesh There is a workaround but it's temporary. So, @yurishkuro suggested to wait until they support it.
At this point I would go with a workaround, because airbnb ticket says it will take a while for them to fix due to dependencies.
ok 👍
At this point I would go with a workaround, because airbnb ticket says it will take a while for them to fix due to dependencies.
I'm working on this 🙂
There are some remedies I found for this, looking more into it. Also, there is an package eslint-config-airbnb-extended, we can migrate the eslint to it's latest version and if things not work properly then we can go with this.
It's getting popular -
cc - @yurishkuro
Proceed with the workaround since the airbnb dependency fix will take time, with @abhayporwals exploring solutions like eslint-config-airbnb-extended.
Is this issue still open? @jkowall @yurishkuro can I work on this this?
yes
@yurishkuro Just to confirm—this issue is about migrating ESLint to version 9, right?
If yes, I’ve already started looking into the changes and would be happy to take it up. Please assign the task to me so I can proceed officially.
@yurishkuro I'm currently working on migrating our ESLint setup to v9, and I wanted to confirm something before moving forward.
As you may know, eslint-config-airbnb doesn't yet support the new ESLint flat config format out of the box. While it’s technically possible to continue using Airbnb with the help of @eslint/eslintrc's FlatCompat bridge and some rule patching, it introduces added complexity and long-term maintenance concerns.
Would you prefer that we:
Continue using Airbnb, with compatibility patches and FlatCompat OR
Drop Airbnb and switch to a modern ESLint 9 setup using core plugins (@eslint/js, @typescript-eslint, react, jsx-a11y, etc.) with equivalent stylistic rules?
@gkbishnoi07 I saw that there was a workaround mentioned at the end of https://github.com/airbnb/javascript/issues/2804
If we were to go with "using core plugins", what is the delta compared to airbnb library? I don't have a strong preference.
Hi @yurishkuro, thanks for your response! To clarify: Airbnb provides a widely-used preset of ESLint rules, but it doesn’t yet support ESLint v9’s Flat Config format out of the box. While we can use compatibility workarounds (FlatCompat), they introduce complexity and extra maintenance.
Alternatively, using core plugins like @eslint/js, @typescript-eslint, eslint-plugin-react, and eslint-plugin-jsx-a11y allows us to write a clean, native eslint.config.js file that is fully compatible with ESLint v9. We can manually define and extend rule sets to closely mirror Airbnb’s style, but with more flexibility and future-proofing.
I’ve worked in several modern repositories where this approach is used and have rarely seen Airbnb config being used recently Jaeger is actually where I first encountered it.
Ok, I'm all for to use modern configs
Thanks @yurishkuro! I'm starting work on it now. You can go ahead and assign me the issue
Thanks @gkbishnoi07 for helping with the upgrade.