-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.eslintrc.json
More file actions
123 lines (123 loc) · 4.48 KB
/
.eslintrc.json
File metadata and controls
123 lines (123 loc) · 4.48 KB
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
{
"parser": "@typescript-eslint/parser",
"extends": ["airbnb", "prettier", "next"],
"plugins": [
"testing-library",
"jest-dom",
"jsx-a11y",
"simple-import-sort",
"prettier",
"react-hooks"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"typescript": {
"alwaysTryTypes": true
}
}
},
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"rules": {
// warn if you import something that's not used
"import/no-extraneous-dependencies": [2, { "devDependencies": true }],
// don't require prop-types for react components (not necessary for typescript)
"react/prop-types": ["off"],
// only allow JSX in .tsx and .jsx files
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],
// don't allow filename extensions when specifying import paths
"import/extensions": ["error", "never"],
// don't prefer default export
"import/prefer-default-export": 0,
// allow anonymous default export
"import/no-anonymous-default-export": 0,
// warn if there's an unresolved import module
"import/no-unresolved": 2,
// don't sort imports based on these rules
"sort-imports": "off",
// don't order imports based on these rules
"import/order": "off",
// allow blocks to contain variables with same name as surrounding scope
"no-shadow": "off",
// allow variable use before the variable is defined
"no-use-before-define": "off",
// trigger error for violation of react rules of hooks
"react-hooks/rules-of-hooks": "error",
// warn if react hooks dependencies have left out a variable
"react-hooks/exhaustive-deps": "warn",
// allow an array index as a key in an array of components
"react/no-array-index-key": "off",
// do not require import of React in order to use jsx
"react/react-in-jsx-scope": "off",
// allow multiple JSX expressions on a single line
"react/jsx-one-expression-per-line": "off",
// allow prettier to determine where JSX curly braces will go
"react/jsx-curly-newline": "off",
// allow prettier to determine quotes
"quotes": "off",
// if there's a multi-line series of items with commas,
// raise an error if the last line doesn't have a trailing comma
"comma-dangle": ["error", "always-multiline"],
// put spaces in between curly braces and its contents
"object-curly-spacing": 1,
// do not put spaces between square brackets and its contents
"array-bracket-spacing": 1,
// warn if variables are unused, except for ordered function
// arguments that come before an argument that is used
"no-unused-vars": ["warn", { "args": "after-used" }],
// warn on these prettier conditions
"prettier/prettier": [
"warn",
{
"printWidth": 80, // line longer than 80 characters
"singleQuote": false, // use double quotes, not single
"trailingComma": "all", // require trailing commas
"endOfLine": "auto" // automatically detect end-of-line character
}
],
// require exports to be sorted
"simple-import-sort/exports": "error",
// warn if imports are not sorted
"simple-import-sort/imports": [
"warn",
{
// group imports according to how they start; this will
// separate external modules from internal modules, including
// internal modules starting with `@` if specified in tsconfig
"groups": [["^\\u0000", "^.prisma"], ["^@?\\w"], ["^"], ["^\\."]]
}
]
},
"overrides": [
// Only uses Testing Library lint rules in *jest* (not cypress) test files
{
"files": ["**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)"],
"extends": [
"plugin:testing-library/react",
"plugin:jest-dom/recommended"
],
"rules": {
// Suggest using explicit assertions rather than standalone queries
"testing-library/prefer-explicit-assert": "error",
// Suggest using userEvent over fireEvent for simulating user interactions
"testing-library/prefer-user-event": "error",
//Use waitFor instead of deprecated wait methods
"jest-dom/prefer-wait-for": "error",
// allow parameter reassignment
"no-param-reassign": "off"
}
},
{
// use cypress linting rules for cypress files
"files": ["cypress/**/?(*.)+(spec|test).[jt]s?(x)", "cypress/support/*"],
"extends": ["plugin:cypress/recommended"]
}
]
}