-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy patheslint.config.mjs
More file actions
88 lines (83 loc) · 2.77 KB
/
eslint.config.mjs
File metadata and controls
88 lines (83 loc) · 2.77 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// ESLint flat config (ESLint 9+).
//
// Migrated from .eslintrc.json during the 3.5.0 dep sweep. Behaviour matches
// the legacy config: eslint:recommended + plugin:react/recommended for all
// files, @typescript-eslint for .ts/.tsx, with the same rule overrides and
// ignore patterns.
import js from "@eslint/js"
import tseslint from "typescript-eslint"
import reactPlugin from "eslint-plugin-react"
import globals from "globals"
export default [
{
ignores: ["src/vendor/**", "dist/**", "docs/build/**", ".parcel-cache/**", "coverage/**"]
},
js.configs.recommended,
{
files: ["**/*.{js,jsx,ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
parserOptions: {
ecmaFeatures: { jsx: true }
},
globals: {
...globals.browser,
...globals.jest,
...globals.node
}
},
plugins: {
react: reactPlugin
},
settings: {
react: { version: "detect" }
},
rules: {
...reactPlugin.configs.recommended.rules,
// Disable the classic-transform rules now that tsconfig uses
// `"jsx": "react-jsx"`. `react-in-jsx-scope` and `jsx-uses-react`
// both exist to enforce `import React from "react"` for the old
// createElement transform — neither applies to the automatic runtime.
...reactPlugin.configs["jsx-runtime"].rules,
"no-unused-vars": "off",
"react/prop-types": "off",
"react/display-name": "off",
"react/no-children-prop": "off",
"no-empty-function": "off",
"no-inner-declarations": "off"
}
},
...tseslint.configs.recommended.map(cfg => ({
...cfg,
files: ["**/*.{ts,tsx}"]
})),
{
files: ["**/*.{ts,tsx}"],
rules: {
"no-undef": "off",
// typescript-eslint 8's recommended is stricter than the legacy config's
// scope (which only wired the parser, no rule sets). Disable the rules
// that surface codebase-wide existing patterns — each is its own follow-up
// sweep. Re-enable individually by removing
// its line below.
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}],
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/ban-ts-comment": ["error", {
"ts-expect-error": "allow-with-description",
"ts-ignore": true,
"ts-nocheck": "allow-with-description",
"ts-check": false
}],
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/no-this-alias": "error"
}
}
]