-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
94 lines (93 loc) · 2.25 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
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
},
settings: { react: { version: "detect" } },
extends: [
"standard",
"eslint:recommended",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@next/next/recommended",
"plugin:react/jsx-runtime",
],
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 12,
sourceType: "module",
project: ["tsconfig.json"],
},
plugins: [
"jsx-a11y",
"react",
"react-hooks",
],
globals: {
JSX: true,
cookieStore: true,
unknown: true,
},
rules: {
/**
* Global rules
*/
quotes: ["error", "double"], // Use double quote
"jsx-a11y/anchor-is-valid": [ // Current workaround using <Link> with href-less <a> tags as child
"error",
{
components: ["Link"],
specialLink: ["hrefLeft", "hrefRight"],
aspects: ["invalidHref", "preferButton"],
},
],
"no-unused-vars": "warn", // warn when vars are not in use
"no-console": "error", // error when using console log.
"prefer-const": "error", // use const where possible
"comma-dangle": ["error", "always-multiline"], // require tailing commas
"array-element-newline": [ // array formatting rule
"error",
{
multiline: true,
minItems: 3,
},
],
"array-bracket-newline": [ // array formatting rule pt 2
"error",
{
multiline: true,
minItems: 3,
},
],
"object-curly-newline": [ // object formatting rule
"error",
{
ObjectExpression: {
multiline: true,
minProperties: 3,
},
ObjectPattern: {
multiline: true,
minProperties: 5,
},
ImportDeclaration: "never",
ExportDeclaration: "always",
},
],
"object-property-newline": "error", // object formatting rule 2
},
overrides: [
{
/**
* Typescript rules
*/
files: ["*.ts", "*.tsx"],
plugins: ["@typescript-eslint"],
parser: "@typescript-eslint/parser",
extends: ["plugin:@typescript-eslint/recommended"],
rules: { "@typescript-eslint/no-unused-vars": "error" },
},
],
}