-
-
Notifications
You must be signed in to change notification settings - Fork 220
/
.eslintrc.js
95 lines (95 loc) · 2.77 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
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"airbnb",
"prettier",
"prettier/@typescript-eslint",
"prettier/react",
],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["react", "@typescript-eslint", "prettier", "testing-library"],
rules: {
"react/prop-types": "off",
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/no-did-update-set-state": "off",
"import/extensions": "off",
"no-unused-vars": "off",
camelcase: "off",
"prettier/prettier": "warn",
"lines-between-class-members": [
"error",
"always",
{ exceptAfterSingleLine: true },
],
"jsx-a11y/label-has-associated-control": [
"error",
{
assert: "either",
},
],
"react/static-property-placement": "off",
"class-methods-use-this": "off",
"react/no-unused-class-component-methods": "off",
"default-param-last": "off",
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
overrides: [
{
// Configuration specific to Typescript files.
// These are defined mostly when the ESLint rules don't support typescript
// Usually there is an equivalent typescript rule from typescript-eslint
files: ["**/*.ts", "**/*.tsx"],
rules: {
// Disabling no-undef rule for typescript files
// "The checks it provides are already provided by TypeScript without the need for configuration"
// see https://typescript-eslint.io/docs/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
"no-undef": "off",
// see https://typescript-eslint.io/rules/no-use-before-define/
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "warn",
"react/require-default-props": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
},
},
{
files: ["**/*.test.js", "**/*.test.ts", "**/*.test.tsx"],
env: {
jest: true,
},
plugins: ["jest"],
extends: ["plugin:testing-library/react"],
rules: {
"import/no-extraneous-dependencies": "off",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
},
},
],
};