-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
113 lines (106 loc) · 3.15 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
/**
* @type {import("eslint").Linter.Config}
*/
const config = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"airbnb",
"airbnb-typescript",
"prettier",
"react-app",
"react-app/jest",
],
globals: {
window: true,
document: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 11,
project: "./tsconfig.json",
sourceType: "module",
},
plugins: ["react", "@typescript-eslint", "jsx-a11y", "prettier"],
settings: {
react: {
pragma: "React",
fragment: "Fragment",
version: "detect",
},
},
root: true,
rules: {
/* base prettier rule */
"prettier/prettier": "error",
"max-len": "off",
"no-console": ["warn", { allow: ["error"] }],
"no-param-reassign": "off",
"object-curly-newline": "off",
"no-underscore-dangle": ["off"],
"arrow-body-style": ["warn"],
"eol-last": ["warn"],
"no-unreachable": ["warn"],
/* typescript-eslint overwritten rules */
"no-use-before-define": "off",
"no-unused-vars": "off",
"no-loss-of-precision": "off",
"no-shadow": "off",
"no-empty-function": "off",
/* react rules */
"react/prop-types": "off",
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx", ".tsx", ".ts"] }],
"react/jsx-props-no-spreading": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": "off",
"react/jsx-max-props-per-line": [1, { maximum: 1, when: "multiline" }],
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
unnamedComponents: "arrow-function",
},
],
"react/jsx-key": [
"error",
{
checkFragmentShorthand: true,
checkKeyMustBeforeSpread: true,
warnOnDuplicates: true,
},
],
"react/destructuring-assignment": ["error", "always", { destructureInSignature: "always" }],
/* typescript-eslint rules */
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-loss-of-precision": "error",
"@typescript-eslint/no-redundant-type-constituents": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
},
],
"@typescript-eslint/ban-ts-comment": "off",
/* create-react-app rules */
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off",
"import/prefer-default-export": "off",
/* jest and testing-library rules */
"testing-library/prefer-screen-queries": "off",
"testing-library/no-wait-for-multiple-assertions": "off",
"testing-library/no-node-access": "off",
"testing-library/no-container": "off",
},
};
module.exports = config;