-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy patheslint.config.mjs
67 lines (59 loc) · 1.79 KB
/
eslint.config.mjs
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
// @ts-check
import tseslint from "typescript-eslint"
import { FlatCompat } from "@eslint/eslintrc"
import eslintPluginJsxA11y from "eslint-plugin-jsx-a11y"
import eslintPluginReact from "eslint-plugin-react"
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
})
export default tseslint.config(
tseslint.configs.recommendedTypeChecked,
...compat.config({
extends: ["next"],
rules: {
// react
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"react/jsx-curly-brace-presence": "warn",
// jsx-ally is already included in next-js so
// we are adding only recommended rules directly here
...eslintPluginJsxA11y.flatConfigs.recommended.rules,
"jsx-a11y/no-onchange": "warn",
// import
"import/no-anonymous-default-export": "off",
// next
"@next/next/no-img-element": "off",
},
}),
// @ts-expect-error eslintPluginReact.configs.flat, but runtime is always defined
eslintPluginReact.configs.flat["jsx-runtime"],
{
linterOptions: {
reportUnusedDisableDirectives: "error",
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// typescript
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/restrict-template-expressions": [
"error",
{
allowAny: false,
allowBoolean: false,
allowNever: false,
allowNullish: false,
allowNumber: true,
allowRegExp: false,
},
],
},
}
)