Skip to content

Convert to eslint 9 #4056

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Convert to eslint 9 #4056

wants to merge 1 commit into from

Conversation

robertbrignull
Copy link
Contributor

@robertbrignull robertbrignull commented Jun 18, 2025

Upgrades eslint to version 9, as well as upgrading a few plugins.

I've tried to convert the old config as closely as I could, but I've removed a few plugins that weren't working well because they haven't received updates in a couple of years. It's also very possible I've misunderstood bits of the config!

I can now at least run npm run lint locally, though it generates a lot of errors. Currently 1346 errors! I haven't worked out yet exactly where they're coming from but I think the majority are updates to the recommended configs and are mostly in the test code. Possibly there are some extra rules we want disable on test code, particularly around use of any and other unsafe access. There are also some we probably want to fix.

I wanted to put up a PR with what I have, and either I or someone else can take a look at the set of errors and see what to do.

@robertbrignull robertbrignull requested review from a team and Copilot June 18, 2025 16:24
@robertbrignull robertbrignull requested a review from a team as a code owner June 18, 2025 16:24
Copy link

@Copilot 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 to version 9, replaces the legacy configuration with a new flat config (eslint.config.mjs), and updates the lint/format scripts and related dependencies.

  • Upgraded ESLint and related plugins to v9.
  • Simplified format/lint/lint-ci scripts in package.json.
  • Introduced eslint.config.mjs and removed .eslintrc.js and .eslintignore.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
extensions/ql-vscode/package.json Bumped ESLint/plugins versions; removed explicit --ext flags
extensions/ql-vscode/eslint.config.mjs Added new flat ESLint config leveraging @eslint/js
extensions/ql-vscode/.eslintrc.js Removed old ESLint config
extensions/ql-vscode/.eslintignore Removed old ignore file
Comments suppressed due to low confidence (1)

extensions/ql-vscode/eslint.config.mjs:84

  • The projectService parser option is not documented for @typescript-eslint/parser; it may not have any effect. Consider removing it or using only the supported project setting.
        projectService: true,

"lint": "eslint . --ext .js,.ts,.tsx --max-warnings=0",
"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint . --ext .js,.ts,.tsx --max-warnings=0 --format @microsoft/eslint-formatter-sarif --output-file=build/eslint.sarif",
"format": "prettier --write **/*.{ts,tsx} && eslint . --fix",
"lint": "eslint . --max-warnings=0",
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

The lint script no longer specifies file extensions, so TypeScript files (.ts, .tsx) may be skipped. Consider adding --ext .js,.ts,.tsx to ensure all relevant files are linted.

Suggested change
"lint": "eslint . --max-warnings=0",
"lint": "eslint . --max-warnings=0 --ext .js,.ts,.tsx",

Copilot uses AI. Check for mistakes.

import eslint from "@eslint/js";
import { globalIgnores } from "eslint/config";
import github from "eslint-plugin-github";
import tseslint from "typescript-eslint";
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

Importing from typescript-eslint seems incorrect; the official plugin package is @typescript-eslint/eslint-plugin. Update this import to ensure the TypeScript ESLint rules are applied correctly.

Suggested change
import tseslint from "typescript-eslint";
import tseslint from "@typescript-eslint/eslint-plugin";

Copilot uses AI. Check for mistakes.

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.

1 participant