-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
67 lines (65 loc) · 1.93 KB
/
eslint.config.mjs
File metadata and controls
67 lines (65 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import tseslint from "typescript-eslint";
import onlyWarn from "eslint-plugin-only-warn";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
import importPlugin from "eslint-plugin-import";
import prettierPlugin from "eslint-plugin-prettier";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
// Resolve project root correctly for parserOptions
const __dirname = dirname(fileURLToPath(import.meta.url));
const project = "./tsconfig.eslint.json";
export default [
{
ignores: [
".*.js",
".*.cjs",
"node_modules/",
"dist/",
"coverage/",
"eslint.config.mjs",
"scripts/",
],
},
// Type-aware linting setup
...tseslint.configs.recommendedTypeChecked.map((config) => ({
...config,
languageOptions: {
...(config.languageOptions ?? {}),
parserOptions: {
...(config.languageOptions?.parserOptions ?? {}),
project,
tsconfigRootDir: __dirname,
},
},
})),
{
files: ["**/*.ts", "**/*.tsx"],
plugins: {
"only-warn": onlyWarn,
import: importPlugin,
"simple-import-sort": simpleImportSort,
"unused-imports": unusedImports,
prettier: prettierPlugin,
},
rules: {
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "warn",
"simple-import-sort/imports": "error",
"prettier/prettier": [
"error",
{
endOfLine: "auto",
trailingComma: "all",
},
],
"import/no-default-export": "error",
"no-duplicate-imports": "error",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
// "@typescript-eslint/switch-exhaustiveness-check": "error"
},
},
];