Skip to content

Migrate to ESLint flat config #1784

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

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 9 additions & 26 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
// @ts-check

import typescriptEslint from "typescript-eslint";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
import prettierRecommended from "eslint-plugin-prettier/recommended";

export default [
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
),
export default typescriptEslint.config(
js.configs.recommended,
...typescriptEslint.configs.recommended,
prettierRecommended,
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
...globals.browser,
},

parser: tsParser,
},

rules: {
Expand All @@ -41,4 +24,4 @@ export default [
"@typescript-eslint/no-var-requires": 0,
},
},
];
);
147 changes: 102 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"license": "Apache-2.0",
"type": "module",
"devDependencies": {
"@eslint/js": "^9",
"@mdn/browser-compat-data": "^5.5.21",
"@octokit/rest": "^21.0.0",
"@types/node": "^22.2.0",
Expand All @@ -53,11 +54,13 @@
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"globals": "^15.9.0",
"jsonc-parser": "^3.2.1",
"node-fetch": "^3.3.2",
"prettier": "^3.2.5",
"print-diff": "^2.0.0",
"typescript": "^5.6.0-dev.20240806",
"typescript-eslint": "^8",
"webidl2": "^24.4.1"
},
"overrides": {
Expand Down
Loading