Skip to content

Upgrade to eslint version 9#1218

Merged
robertbrignull merged 7 commits intomainfrom
robertbrignull/eslint-9
Jun 10, 2025
Merged

Upgrade to eslint version 9#1218
robertbrignull merged 7 commits intomainfrom
robertbrignull/eslint-9

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

This PR upgrades ESLint to version 9.x.x. The conversion was quite involved, and there is a conversion tool but it found it was quite confusing and didn't work too well so I had to do it manually. It's been a bit of a struggle and an adventure but this is what I've ended up with. As far as I can tell it's all working 🤞🏼

This PR supersedes #1212 and #1185.

There are a couple of small changes I made during the migration:

  • I removed our direct dependency on eslint-plugin-import because it's already included in eslint-plugin-github (and was causing errors trying to redeclare it in the config file). As far as I can tell this hasn't changed any behaviour.
  • I removed eslint-plugin-filenames because it's quite old and even using compat it wasn't working. I just wasn't sure it was important enough to continue messing around with so I removed it, but please say if you think that was a mistake.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades ESLint from v8 to v9, migrates to a flat config format, and cleans up legacy lint files and plugins.

  • Migrated from .eslintrc.json to eslint.config.mjs using @eslint/eslintrc and @eslint/js
  • Removed legacy lint configs (tsconfig.lint.json, .eslintrc.json, .eslintignore) and dropped unused plugins
  • Updated package.json scripts and dependencies to align with ESLint v9 flat config

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.lint.json Removed legacy TypeScript lint config
src/deserialize.ts Dropped an ESLint disable comment on unsafe assignment
package.json Updated lint scripts and bumped ESLint-related deps
eslint.config.mjs Added new flat ESLint config, plugin imports, and rules
build.mjs Adjusted sourcemap condition in esbuild config
.eslintrc.json Deleted old ESLint JSON config
.eslintignore Deleted legacy ignore file
Comments suppressed due to low confidence (3)

src/deserialize.ts:5

  • The ESLint disable comment for @typescript-eslint/no-unsafe-assignment was removed, which may now cause lint failures. Either re-introduce a targeted rule override or refine the typing of value to satisfy the rule.
value[l] = value[k];

eslint.config.mjs:8

  • The import path for the TypeScript ESLint plugin is incorrect. It should import from "@typescript-eslint/eslint-plugin" to access tseslint.config and tseslint.configs.
import tseslint from "typescript-eslint";

eslint.config.mjs:16

  • You configure only the no-async-foreach plugin via FlatCompat, but you still reference import/* rules below. Add ...compat.plugins("import") (or similar) so import rules load correctly.
...compat.plugins("no-async-foreach"),

build.mjs Outdated
platform: "node",
format: "cjs",
sourcemap: !!process.env.CODEQL_VARIANT_ANALYSIS_ACTION_GENERATE_SOURCEMAPS
sourcemap: process.env.CODEQL_VARIANT_ANALYSIS_ACTION_GENERATE_SOURCEMAPS
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

Using the raw environment variable string here will always be truthy when set. Wrap it in a boolean conversion (!!process.env...) to ensure correct conditional behavior.

Suggested change
sourcemap: process.env.CODEQL_VARIANT_ANALYSIS_ACTION_GENERATE_SOURCEMAPS
sourcemap: !!process.env.CODEQL_VARIANT_ANALYSIS_ACTION_GENERATE_SOURCEMAPS

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I think eslint --fix made this change, but I'm not sure why. I'll revert it back to using !!

Copy link
Copy Markdown
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

LGTM, and the config looks like it matches.

Comment on lines +20 to +22
{
extends: [eslint.configs.recommended, tseslint.configs.recommended],
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need to use extends here, but not for any of the other configs?


export default tseslint.config(
globalIgnores(["dist/", "node_modules/", "script/", "jest.config.ts", "eslint.config.mjs", "build.mjs"]),
...compat.plugins("no-async-foreach"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we still need the no-async-foreach plugin? It seems like this is caught by at least three different rules now:

Image

Image

@robertbrignull robertbrignull merged commit dd3129b into main Jun 10, 2025
9 checks passed
@robertbrignull robertbrignull deleted the robertbrignull/eslint-9 branch June 10, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants