forked from aifuxi/fuxiaochen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
97 lines (92 loc) · 2.4 KB
/
.eslintrc.cjs
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
89
90
91
92
93
94
95
96
97
/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
settings: {
react: { version: "detect" },
"import/resolver": {
typescript: {},
},
},
plugins: ["@typescript-eslint", "check-file"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended",
"plugin:tailwindcss/recommended",
],
rules: {
"prettier/prettier": "error",
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
// 修复: 'React' must be in scope when using JSXeslint
"react/react-in-jsx-scope": "off",
"react/jsx-uses-react": "off",
"react/prop-types": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-misused-promises": [
2,
{
checksVoidReturn: { attributes: false },
},
],
"no-console": "error",
"@next/next/no-img-element": "off",
"no-restricted-imports": [
"error",
{
patterns: [
"@/features/*/*",
"@/types/*",
"@/config/*",
"@/constants/*",
"@/providers/*",
],
},
],
"import/default": "off",
"import/no-named-as-default-member": "off",
"import/no-named-as-default": "off",
"check-file/filename-naming-convention": [
"error",
{
"**/*.{ts,tsx}": "KEBAB_CASE",
},
{
ignoreMiddleExtensions: true,
},
],
},
ignorePatterns: [
"node_modules",
"dist",
"build",
"public",
".gitignore",
"pnpm-lock.yaml",
],
};
module.exports = config;