Skip to content

chore: upgrade to eslint v9#424

Merged
luca-gr4vy merged 9 commits intomainfrom
chore/upgrade-to-eslint-v9
Feb 25, 2026
Merged

chore: upgrade to eslint v9#424
luca-gr4vy merged 9 commits intomainfrom
chore/upgrade-to-eslint-v9

Conversation

@luca-gr4vy
Copy link
Contributor

@luca-gr4vy luca-gr4vy commented Feb 18, 2026

Description

Upgrades to ESLint v9.

  • Ran migration script as per https://eslint.org/docs/latest/use/configure/migration-guide and adjusted the configuration (no more specific .eslintrc.js files in sub-folders)
  • Converted to pure flat config (no compat)
  • Upgraded related packages
  • Ran prettier --write and update a few files under embed/src

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own changes
  • I have run yarn lint to make sure my changes pass all tests
  • I have run yarn test to make sure my changes pass all linters
  • I have pulled the latest changes from the upstream main branch
  • I have tested both the react and the CDN versions on local and integration environments
  • I have added the necessary labels to this PR in case a new release needs to be published after merging into main (e.g. release and patch)

Contribution guidelines

For contribution guidelines, styleguide, and other helpful information please
see the CONTRIBUTING.md file in the root of this project.

Copy link
Contributor

@GiordanoArman GiordanoArman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajv Trivy vulnerability blocking the pipeline: do you prefer fixing here or just place an ignore and fix later?

@luca-gr4vy
Copy link
Contributor Author

ajv Trivy vulnerability blocking the pipeline: do you prefer fixing here or just place an ignore and fix later?

I'll ignore for now. Eslint should resolve it soon, and Storybook should follow

@GiordanoArman
Copy link
Contributor

@luca-gr4vy ok, then I would just create a ticket for those ignored vulnerabilities and that's all by me about it 👍

Copy link
Contributor

@GiordanoArman GiordanoArman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other project, when I run the linter I get

fido@Mac gr4vy-embed % yarn lint
yarn run v1.22.22
$ lerna run lint
lerna notice cli v9.0.0

 Lerna (powered by Nx)   Running target lint for 3 projects

   ✖  @gr4vy/embed:lint
$ eslint src/ --ext ts
      Invalid option '--ext' - perhaps you meant '-c'?
      You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.



——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 Lerna (powered by Nx)   Ran target lint for 3 projects (2s)

   ✔  0/1 succeeded [0 read from cache]

   ✖  1/1 targets failed, including the following:

      - @gr4vy/embed:lint

error Command failed with exit code 130.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Copy link
Contributor

@GiordanoArman GiordanoArman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using .eslintignore and .eslintrc.js anymore right?

eslint.config.js Outdated

module.exports = defineConfig([
{
extends: fixupConfigRules(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI is telling me that fixupConfigRules should be used like this, not sure though

module.exports = defineConfig([
  // 1. Spread the migrated "extends" configs into the array
  ...fixupConfigRules(
    compat.extends(
      'eslint:recommended',
      'plugin:@typescript-eslint/eslint-recommended',
      'plugin:@typescript-eslint/recommended',
      'plugin:react/recommended',
      'plugin:prettier/recommended',
      'plugin:import/errors',
      'plugin:import/warnings',
      'plugin:import/typescript'
    )
  ),

@luca-gr4vy
Copy link
Contributor Author

Same as the other project, when I run the linter I get

fido@Mac gr4vy-embed % yarn lint
yarn run v1.22.22
$ lerna run lint
lerna notice cli v9.0.0

 Lerna (powered by Nx)   Running target lint for 3 projects

   ✖  @gr4vy/embed:lint
$ eslint src/ --ext ts
      Invalid option '--ext' - perhaps you meant '-c'?
      You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.



——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 Lerna (powered by Nx)   Ran target lint for 3 projects (2s)

   ✔  0/1 succeeded [0 read from cache]

   ✖  1/1 targets failed, including the following:

      - @gr4vy/embed:lint

error Command failed with exit code 130.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

couldn't figure out why you had that, but I changed it to something that should work across the board 6c89f6d

},

{
files: ['**/*.{spec,test}.{ts,tsx}'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate, so it is only applied to test files


{
settings: {
'import/resolver': {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to resolve aliases based on tsconfig

const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended')
const reactPlugin = require('eslint-plugin-react')
const storybook = require('eslint-plugin-storybook')
const globals = require('globals')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint 9 doesn't support env: to set the globals anymore, so we need the globals package (if we're not hardcoding all the globals we need). See https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables

@luca-gr4vy
Copy link
Contributor Author

luca-gr4vy commented Feb 24, 2026

@GiordanoArman I moved too fast and just migrated using eslint compat. Since all the plugins we use support flat configs, I just moved to using a pure flat config which is cleaner and more in line with modern ESLint tooling (even when we'll upgrade to v10).

I will upgrade the secure-fields one too

Copy link
Contributor

@GiordanoArman GiordanoArman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this error now

fido@Mac gr4vy-embed % yarn lint
yarn run v1.22.22
$ lerna run lint
lerna notice cli v9.0.0

 Lerna (powered by Nx)   Running target lint for 3 projects

   ✖  @gr4vy/embed:lint
$ eslint src/**/*.ts

      Oops! Something went wrong! :(

      ESLint: 8.57.1

      Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './config' is not defined by "exports" in /Users/fido/Documents/GitHub/gr4vy-embed/node_modules/eslint/package.json
          at exportsNotFound (node:internal/modules/esm/resolve:314:10)
          at packageExportsResolve (node:internal/modules/esm/resolve:661:9)
          at resolveExports (node:internal/modules/cjs/loader:661:36)
          at Function._findPath (node:internal/modules/cjs/loader:753:31)
          at Function._resolveFilename (node:internal/modules/cjs/loader:1391:27)
          at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
          at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
          at Function._load (node:internal/modules/cjs/loader:1215:37)
          at TracingChannel.traceSync (node:diagnostics_channel:322:14)
          at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.



——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 Lerna (powered by Nx)   Ran target lint for 3 projects (1s)

   ✔  0/1 succeeded [0 read from cache]

   ✖  1/1 targets failed, including the following:

      - @gr4vy/embed:lint

@luca-gr4vy
Copy link
Contributor Author

I get this error now

fido@Mac gr4vy-embed % yarn lint
yarn run v1.22.22
$ lerna run lint
lerna notice cli v9.0.0

 Lerna (powered by Nx)   Running target lint for 3 projects

   ✖  @gr4vy/embed:lint
$ eslint src/**/*.ts

      Oops! Something went wrong! :(

      ESLint: 8.57.1

      Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './config' is not defined by "exports" in /Users/fido/Documents/GitHub/gr4vy-embed/node_modules/eslint/package.json
          at exportsNotFound (node:internal/modules/esm/resolve:314:10)
          at packageExportsResolve (node:internal/modules/esm/resolve:661:9)
          at resolveExports (node:internal/modules/cjs/loader:661:36)
          at Function._findPath (node:internal/modules/cjs/loader:753:31)
          at Function._resolveFilename (node:internal/modules/cjs/loader:1391:27)
          at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
          at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
          at Function._load (node:internal/modules/cjs/loader:1215:37)
          at TracingChannel.traceSync (node:diagnostics_channel:322:14)
          at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.



——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 Lerna (powered by Nx)   Ran target lint for 3 projects (1s)

   ✔  0/1 succeeded [0 read from cache]

   ✖  1/1 targets failed, including the following:

      - @gr4vy/embed:lint

have you run yarn install it should be using eslint 9 there

@luca-gr4vy luca-gr4vy added internal Changes only affect the internal API dependencies Update one or more dependencies version labels Feb 25, 2026
@luca-gr4vy luca-gr4vy merged commit 4865a8e into main Feb 25, 2026
5 checks passed
@luca-gr4vy luca-gr4vy deleted the chore/upgrade-to-eslint-v9 branch February 25, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Update one or more dependencies version internal Changes only affect the internal API

Development

Successfully merging this pull request may close these issues.

2 participants