-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
78 lines (76 loc) · 1.84 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
const importRules = {
"import/first": "error",
"import/no-unresolved": "error",
"import/no-named-as-default": "off",
"import/order": [
"error",
{
"newlines-between": "always",
warnOnUnassignedImports: true,
},
],
"@typescript-eslint/no-unused-vars": ["error", { ignoreRestSiblings: true }],
};
module.exports = {
root: true,
env: {
node: true,
},
parserOptions: {
ecmaVersion: 2020,
},
plugins: ["@next/next", "react", "react-hooks"],
extends: [
"eslint:recommended",
"plugin:@next/next/core-web-vitals",
"plugin:import/recommended",
"prettier",
],
rules: {
...importRules,
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "error", // Checks effect dependencies
"react/self-closing-comp": ["error", { component: true, html: true }],
},
// Put the Typescript config in an override, so we can still lint js files.
overrides: [
{
files: ["**/*.{ts,tsx}"],
plugins: ["@next/next", "@typescript-eslint"],
extends: [
"plugin:@next/next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
rules: {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error",
...importRules,
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},
},
{
files: ["**/*.test.{js,ts,tsx}"],
env: {
jest: true,
},
},
{
files: ["scripts/build/**/*.{js,ts,tsx}"],
env: {
es2020: true,
},
},
],
};