Skip to content

Commit

Permalink
Migrate ESLint configuration
Browse files Browse the repository at this point in the history
ESLint 9.x introduced a new format for the configuration file. The old
configuration file has been migrated to the new format using the guide
and provided CLI[^1].

[^1]: https://eslint.org/docs/latest/use/configure/migration-guide#migrate-your-config-file
  • Loading branch information
jdno committed Oct 21, 2024
1 parent ad66258 commit 433f101
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

40 changes: 40 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
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,
});

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

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

parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},

rules: {},
},
];

0 comments on commit 433f101

Please sign in to comment.