Skip to content

Commit aa0bb6e

Browse files
Upgrade eslint (#72)
* Upgrade eslint * Fix type errors * Delete phntms dependency
1 parent c497f39 commit aa0bb6e

File tree

4 files changed

+2348
-1601
lines changed

4 files changed

+2348
-1601
lines changed

eslint.config.mjs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import prettier from "eslint-plugin-prettier";
3+
import _import from "eslint-plugin-import";
4+
import { fixupPluginRules } from "@eslint/compat";
5+
import globals from "globals";
6+
import tsParser from "@typescript-eslint/parser";
7+
import path from "node:path";
8+
import { fileURLToPath } from "node:url";
9+
import js from "@eslint/js";
10+
import { FlatCompat } from "@eslint/eslintrc";
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = path.dirname(__filename);
14+
const compat = new FlatCompat({
15+
baseDirectory: __dirname,
16+
recommendedConfig: js.configs.recommended,
17+
allConfig: js.configs.all
18+
});
19+
20+
export default defineConfig([globalIgnores(["**/node_modules", "**/lib"]), {
21+
extends: compat.extends("plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"),
22+
23+
plugins: {
24+
prettier,
25+
import: fixupPluginRules(_import),
26+
},
27+
28+
languageOptions: {
29+
globals: {
30+
...globals.browser,
31+
...globals.node,
32+
...globals.jest,
33+
React: "writable",
34+
},
35+
36+
parser: tsParser,
37+
ecmaVersion: 5,
38+
sourceType: "commonjs",
39+
40+
parserOptions: {
41+
jsx: true,
42+
useJSXTextNode: true,
43+
},
44+
},
45+
46+
settings: {
47+
react: {
48+
version: "detect",
49+
},
50+
},
51+
52+
rules: {
53+
"@typescript-eslint/explicit-function-return-type": "off",
54+
"@typescript-eslint/explicit-module-boundary-types": "off",
55+
"@typescript-eslint/ban-ts-comment": "off",
56+
57+
"import/order": ["error", {
58+
groups: ["builtin", "external", "internal"],
59+
60+
pathGroups: [{
61+
pattern: "react",
62+
group: "external",
63+
position: "before",
64+
}],
65+
66+
pathGroupsExcludedImportTypes: ["react"],
67+
"newlines-between": "always",
68+
69+
alphabetize: {
70+
order: "asc",
71+
caseInsensitive: true,
72+
},
73+
}],
74+
75+
"prettier/prettier": "error",
76+
},
77+
}]);

0 commit comments

Comments
 (0)