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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions extensions/ql-vscode/.eslintignore

This file was deleted.

184 changes: 0 additions & 184 deletions extensions/ql-vscode/.eslintrc.js

This file was deleted.

173 changes: 173 additions & 0 deletions extensions/ql-vscode/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
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.

import eslintPrettierRecommended from 'eslint-plugin-prettier/recommended';
import * as jestDom from "eslint-plugin-jest-dom";
import * as typescriptESLintParser from "@typescript-eslint/parser";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import storybook from "eslint-plugin-storybook";

const __dirname = dirname(fileURLToPath(import.meta.url));

export default tseslint.config(
globalIgnores([
".vscode-test/",
"node_modules/",
"out/",
"build/",
"scripts/",
"jest.config.ts",
"jest-runner-vscode.config.js",
"eslint.config.mjs",
"!.storybook",
]),
github.getFlatConfigs().recommended,
...github.getFlatConfigs().typescript,
tseslint.configs.recommendedTypeChecked,
eslint.configs.recommended,
tseslint.configs.recommended,
jestDom.configs["flat/recommended"],
{
rules: {
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{
vars: "all",
args: "none",
ignoreRestSiblings: false,
},
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
"@typescript-eslint/no-invalid-this": "off",
"@typescript-eslint/no-shadow": "off",
"prefer-const": ["warn", { destructuring: "all" }],
"@typescript-eslint/only-throw-error": "error",
"@typescript-eslint/consistent-type-imports": "error",
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
curly: ["error", "all"],
"escompat/no-regexp-lookbehind": "off",
"filenames/match-regex": "off",
"i18n-text/no-en": "off",
"no-invalid-this": "off",
"no-console": "off",
"no-shadow": "off",
"github/array-foreach": "off",
"github/no-then": "off",
// "react/jsx-key": ["error", { checkFragmentShorthand: true }],
"import/no-cycle": "error",
// Never allow extensions in import paths, except for JSON files where they are required.
"import/extensions": ["error", "never", { json: "always" }],
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
typescript: true,
node: true,
},
"import/extensions": [".js", ".jsx", ".ts", ".tsx", ".json"],
// vscode and sarif don't exist on-disk, but only provide types.
"import/core-modules": ["vscode", "sarif"],
},
languageOptions: {
parser: typescriptESLintParser,
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
projectService: true,
tsconfigRootDir: import.meta.dirname,
project: resolve(__dirname, "tsconfig.lint.json"),
},
},
},
{
files: ["src/stories/**/*"],
languageOptions: {
parserOptions: {
project: resolve(__dirname, "src/stories/tsconfig.json"),
},
},
extends: [
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
reactHooks.configs['recommended-latest'],
storybook.configs['flat/recommended'],
github.getFlatConfigs().react,
],
settings: {
react: {
version: "detect",
},
},
},
{
files: ["src/view/**/*"],
languageOptions: {
parserOptions: {
project: resolve(__dirname, "src/view/tsconfig.json"),
},
},
extends: [
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
reactHooks.configs['recommended-latest'],
github.getFlatConfigs().react,
],
settings: {
react: {
version: "detect",
},
},
},
{
files: ["test/vscode-tests/**/*"],
languageOptions: {
parserOptions: {
project: resolve(__dirname, "test/tsconfig.json"),
},
globals: {
jest: true,
},
},
rules: {
// We want to allow mocking of functions in modules, so we need to allow namespace imports.
"import/no-namespace": "off",
"@typescript-eslint/no-unsafe-function-type": "off",
},
},
{
files: ["test/**/*"],
languageOptions: {
parserOptions: {
project: resolve(__dirname, "test/tsconfig.json"),
},
globals: {
jest: true,
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
{
files: [".storybook/**/*.tsx"],
languageOptions: {
parserOptions: {
project: resolve(__dirname, ".storybook/tsconfig.json"),
},
},
rules: {
// Storybook doesn't use the automatic JSX runtime in the addon yet, so we need to allow
// `React` to be imported.
"import/no-namespace": ["error", { ignore: ["react"] }],
},
},
eslintPrettierRecommended,
);
2,031 changes: 978 additions & 1,053 deletions extensions/ql-vscode/package-lock.json

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
@@ -1964,9 +1964,9 @@
"test:cli-integration": "jest --projects test/vscode-tests/cli-integration --verbose",
"clean-test-dir": "find . -type d -name .vscode-test -exec rm -r {} +",
"update-vscode": "node ./node_modules/vscode/bin/install",
"format": "prettier --write **/*.{ts,tsx} && eslint . --ext .ts,.tsx --fix",
"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.

"lint-ci": "SARIF_ESLINT_IGNORE_SUPPRESSED=true eslint . --max-warnings=0 --format @microsoft/eslint-formatter-sarif --output-file=build/eslint.sarif",
"lint:markdown": "markdownlint-cli2 \"../../**/*.{md,mdx}\" \"!**/node_modules/**\" \"!**/.vscode-test/**\" \"!**/build/cli/v*/**\"",
"find-deadcode": "vite-node scripts/find-deadcode.ts",
"format-staged": "lint-staged",
@@ -2021,6 +2021,7 @@
"@babel/preset-env": "^7.24.4",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@eslint/js": "^9.28.0",
"@faker-js/faker": "^9.0.3",
"@github/markdownlint-github": "^0.6.3",
"@jest/environment": "^30.0.0-alpha.7",
@@ -2076,18 +2077,16 @@
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.6",
"del": "^6.0.0",
"eslint": "^8.56.0",
"eslint": "^9.28.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-etc": "^2.0.2",
"eslint-plugin-github": "^5.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-github": "^6.0.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-storybook": "^9.0.12",
"glob": "^11.0.1",
"gulp": "^5.0.0",
"gulp-esbuild": "^0.14.0",