-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.cjs
145 lines (133 loc) · 4.99 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
const path = require("path");
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: path.resolve(__dirname, "tsconfig.json"),
},
env: {
browser: true,
jest: true,
},
plugins: ["@typescript-eslint", "import", "require-extensions", "perfectionist"],
extends: [
"airbnb",
"react-app",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
"plugin:require-extensions/recommended",
"plugin:perfectionist/recommended-natural",
],
rules: {
"no-console": ["error", { allow: ["info", "warn", "error"] }],
"no-underscore-dangle": ["error", { allow: ["__typename"] }],
"class-methods-use-this": 0,
"react/jsx-filename-extension": 0,
"react/jsx-one-expression-per-line": 0,
"react/jsx-props-no-spreading": 0,
"react/jsx-wrap-multilines": 0,
"react/prefer-stateless-function": 0,
"import/order": 0,
"sort-imports": 0,
// perfectionist
"perfectionist/sort-objects": [
"error",
{
order: "asc",
"partition-by-comment": true,
type: "natural",
},
],
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"import/extensions": 0,
"jsx-a11y/label-has-for": 0,
"jsx-a11y/label-has-associated-control": [
"error",
{
assert: "either",
},
],
// override eslint rules with typescript-eslint rules
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-duplicate-imports.md
"no-duplicate-imports": "off",
"@typescript-eslint/no-duplicate-imports": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
"no-implied-eval": "off",
"@typescript-eslint/no-implied-eval": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
"return-await": "off",
"@typescript-eslint/return-await": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-this.md
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": ["error"],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/init-declarations.md
"init-declarations": "off",
"@typescript-eslint/init-declarations": "off",
camelcase: 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/indent": 0,
"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": false,
"ts-ignore": true,
"ts-nocheck": true,
"ts-check": false,
},
],
},
overrides: [
{
files: ["*.ts", "*.tsx"],
rules: {
"react/prop-types": 0,
"react/require-default-props": 0,
},
parserOptions: {
project: ["./tsconfig.json"],
},
},
{
files: ["*.test.ts", "*.test.tsx"],
rules: {
"@typescript-eslint/no-explicit-any": 0,
},
},
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
project: [path.resolve(__dirname, "tsconfig.json")],
},
},
},
};