generated from manoldonev/react-app-template-ts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc
143 lines (143 loc) · 4.48 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
141
142
143
{
"env": {
"browser": true, // Browser global variables like `window` etc.
"commonjs": true, // CommonJS global variables and CommonJS scoping.Allows require, exports and module.
"es6": true, // Enable all ECMAScript 6 features except for modules.
"node": true // Defines things like process.env when generating through node
},
"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 // Allows for the parsing of JSX
},
"project": "./tsconfig.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/prefer-explicit-assert": "error",
"testing-library/prefer-user-event": "error"
}
}
],
"settings": {
"react": {
"version": "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
}
}
}