-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
112 lines (112 loc) · 2.98 KB
/
.eslintrc.js
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
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
impliedStrict: true,
jsx: true,
},
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
paths: ["."],
},
},
},
env: {
browser: true,
node: true,
jest: true,
},
plugins: [
"@shopify",
"@typescript-eslint",
"import",
"jest-dom",
"jsx-a11y",
"react-hooks",
"react-prefer-function-component",
"react",
"sonarjs",
"testing-library",
"unicorn",
],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:jest-dom/recommended",
"plugin:testing-library/react",
"plugin:sonarjs/recommended",
"plugin:react-prefer-function-component/recommended",
],
rules: {
// Disable
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/unbound-method": "off",
"react/display-name": "off",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
// Enable
"@shopify/jest/no-snapshots": "error",
"@shopify/jsx-no-complex-expressions": "error",
"@shopify/jsx-prefer-fragment-wrappers": "error",
"@shopify/prefer-early-return": "error",
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"array-callback-return": "error",
"max-depth": ["error", 3],
"max-lines": ["error", { max: 300 }],
"max-nested-callbacks": ["error", 3],
"no-else-return": "error",
"no-nested-ternary": "error",
"no-unneeded-ternary": "error",
"prefer-template": "error",
"react-hooks/exhaustive-deps": "error",
"react/jsx-fragments": ["error", "syntax"],
"react/jsx-max-depth": ["error", { max: 5 }],
"react/jsx-no-useless-fragment": "error",
"react/jsx-pascal-case": "error",
"react/no-array-index-key": "error",
"react/no-multi-comp": "error",
"react/self-closing-comp": "error",
"sonarjs/cognitive-complexity": ["error", 14],
"sonarjs/elseif-without-else": "error",
"sonarjs/max-switch-cases": ["error", 10],
"sonarjs/no-inverted-boolean-check": "error",
"unicorn/no-abusive-eslint-disable": "error",
// Sort imports
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"type",
"object",
"unknown",
],
"newlines-between": "never",
alphabetize: {
order: "asc",
caseInsensitive: false,
},
},
],
},
};