jaeger-ui icon indicating copy to clipboard operation
jaeger-ui copied to clipboard

Help with eslint upgrade

Open yurishkuro opened this issue 1 year ago • 21 comments

#2271 is failing to bump eslint versions:

  1. [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.
  2. [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
  3. [ ] New error: [eslint ] Error: Could not find config file.

yurishkuro avatar Apr 20 '24 01:04 yurishkuro

Hi @yurishkuro , unit-tests workflow is failing in my commit, how can i resolve

Baalekshan avatar Apr 20 '24 05:04 Baalekshan

@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 avatar Apr 20 '24 15:04 yurishkuro

@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 avatar Apr 20 '24 15:04 Baalekshan

@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.

yurishkuro avatar Apr 20 '24 15:04 yurishkuro

Oh right, what could be done now. Should I try fixing these errors? If so what can I do.

Baalekshan avatar Apr 20 '24 16:04 Baalekshan

The upgrade is trying to bump eslint from 8.x to 9.x, there could be some breaking changes causing this issue.

yurishkuro avatar Apr 20 '24 16:04 yurishkuro

I will look into it

Baalekshan avatar Apr 20 '24 16:04 Baalekshan

ESlint 9.x won't find .eslintrc.js in default.

There are two difference ways to resolve this.

  1. Env ESLINT_USE_FLAT_CONFIG set false
  2. .eslintrc.js migrate to eslint.config.js
  • https://eslint.org/docs/latest/use/migrate-to-9.0.0
  • https://eslint.org/docs/latest/use/configure/migration-guide

tico88612 avatar Apr 20 '24 17:04 tico88612

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.

tico88612 avatar Apr 20 '24 17:04 tico88612

So do you mean we can't migrate completely but also use .eslint.config.js partially?

Baalekshan avatar Apr 20 '24 17:04 Baalekshan

@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 avatar Apr 21 '24 02:04 tico88612

@tico88612 Alright!

Baalekshan avatar Apr 21 '24 04:04 Baalekshan

@yurishkuro what should we do ?

Baalekshan avatar May 01 '24 06:05 Baalekshan

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.

yurishkuro avatar May 01 '24 20:05 yurishkuro

Has anyone figured out the issue?

MiirzaBaig avatar Jun 05 '24 07:06 MiirzaBaig

@yurishkuro above issue is solved or something is still wrong? Should I work on it.

ayushrakesh avatar Jun 07 '24 11:06 ayushrakesh

@MiirzaBaig @ayushrakesh There is a workaround but it's temporary. So, @yurishkuro suggested to wait until they support it.

Baalekshan avatar Jun 07 '24 11:06 Baalekshan

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.

yurishkuro avatar Jun 07 '24 14:06 yurishkuro

ok 👍

ayushrakesh avatar Jun 08 '24 05:06 ayushrakesh

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 -

Image

cc - @yurishkuro

abhayporwals avatar May 19 '25 11:05 abhayporwals

Proceed with the workaround since the airbnb dependency fix will take time, with @abhayporwals exploring solutions like eslint-config-airbnb-extended.

kallal79 avatar May 27 '25 19:05 kallal79

Is this issue still open? @jkowall @yurishkuro can I work on this this?

gkbishnoi07 avatar Jul 09 '25 00:07 gkbishnoi07

yes

yurishkuro avatar Jul 09 '25 00:07 yurishkuro

@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.

gkbishnoi07 avatar Jul 10 '25 00:07 gkbishnoi07

@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 avatar Jul 10 '25 12:07 gkbishnoi07

@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.

yurishkuro avatar Jul 11 '25 02:07 yurishkuro

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.

gkbishnoi07 avatar Jul 11 '25 08:07 gkbishnoi07

Ok, I'm all for to use modern configs

yurishkuro avatar Jul 11 '25 13:07 yurishkuro

Thanks @yurishkuro! I'm starting work on it now. You can go ahead and assign me the issue

gkbishnoi07 avatar Jul 11 '25 13:07 gkbishnoi07

Thanks @gkbishnoi07 for helping with the upgrade.

yurishkuro avatar Jul 14 '25 22:07 yurishkuro