generated from manoldonev/react-app-template-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
140 lines (140 loc) · 4.76 KB
/
.eslintrc
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
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended", // Updates the eslint:recommended config to better suit Typescript
"plugin:@typescript-eslint/recommended", // set of opinionated rules that adhere to TypeScript best practices
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:eslint-comments/recommended",
"airbnb",
"airbnb/hooks",
"airbnb-typescript",
"plugin:react/jsx-runtime", // Using new JSX transform from React 17 so disable relevant rules
"prettier",
// Make sure this is always the last configuration in the extends array
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors.
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"ecmaFeatures": {
"jsx": true
},
"project": "./tsconfig.lint.json"
},
"plugins": ["@typescript-eslint", "react", "jsx-a11y"],
"root": true, // For configuration cascading
"rules": {
"@typescript-eslint/array-type": [
"error",
{
"default": "array-simple"
}
],
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/method-signature-style": "error",
"@typescript-eslint/no-confusing-non-null-assertion": "error",
"@typescript-eslint/no-dynamic-delete": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/no-use-before-define": [
"error",
{
"functions": false
}
],
"@typescript-eslint/non-nullable-type-assertion-style": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-reduce-type-parameter": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/strict-boolean-expressions": "error",
"react/require-default-props": [
"error",
{
"ignoreFunctionalComponents": true
}
],
"react/jsx-no-bind": [
"error",
{
"ignoreRefs": true,
"allowArrowFunctions": true,
"allowFunctions": true,
"ignoreDOMComponents": true
}
],
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsForRegex": ["^draft", "keys"]
}
],
"react/function-component-definition": [
"error",
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
"import/prefer-default-export": "off",
"import/no-default-export": "error",
"jsx-a11y/label-has-associated-control": ["error", { "assert": "either" }],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
]
},
"overrides": [
{
"files": ["src/**/*.test.{ts,tsx}"],
"extends": ["plugin:jest-dom/recommended", "plugin:testing-library/react"],
"rules": {
"testing-library/no-manual-cleanup": "error",
"testing-library/no-render-in-setup": "error",
"testing-library/no-wait-for-snapshot": "error",
"testing-library/prefer-explicit-assert": "error",
"testing-library/prefer-presence-queries": "error",
"testing-library/prefer-wait-for": "error",
"testing-library/no-unnecessary-act": "error",
"testing-library/no-wait-for-multiple-assertions": "error",
"testing-library/no-wait-for-side-effects": "error",
"testing-library/prefer-query-by-disappearance": "error",
"testing-library/prefer-user-event": "error",
"testing-library/no-debugging-utils": "warn"
}
},
{
"files": ["cypress/**/*.ts"],
"extends": ["plugin:cypress/recommended"]
}
],
"settings": {
"react": {
"version": "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
}
}
}