-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
97 lines (92 loc) · 2.29 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
96
97
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
requireConfigFile: false,
sourceType: "module",
},
ignorePatterns: ["node_modules/**/*"],
settings: {
react: {
version: "detect",
},
},
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
],
plugins: ["@typescript-eslint", "import", "react", "react-hooks", "jsx-a11y"],
rules: {
/**
* We don't want any unused vars starting with "_" to be claimed as unused vars.
*/
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
},
],
/**
* Turn of the need for display names for react components.
* Especially when writing page components (Next.js), this is
* extremly bugging.
*/
"react/display-name": "off",
/**
* We don't want to have the react import in each file. Typescript is
* handling this for us.
*/
"react/react-in-jsx-scope": "off",
"react/prop-types": "warn",
/**
* Enforce that we do not have any `console.log`'s in the code.
*/
"no-console": "error",
/**
* This makes it easier to use the auto-import function of the typescript
* lsp.
*/
"import/no-anonymous-default-export": "warn",
/**
* Add a warning for multiple a11y things.
*/
"jsx-a11y/alt-text": [
"warn",
// This is needed for next's `Image` component.
{
elements: ["img"],
img: ["Image"],
},
],
"jsx-a11y/aria-props": "warn",
"jsx-a11y/aria-proptypes": "warn",
"jsx-a11y/aria-unsupported-elements": "warn",
"jsx-a11y/role-has-required-aria-props": "warn",
"jsx-a11y/role-supports-aria-props": "warn",
},
overrides: [
{
files: ["**/*.test.ts", "**/*.test.tsx"],
rules: {
"@typescript-eslint/ban-ts-comment": "off",
},
},
{
files: [
"**/*.stories.tsx",
"**/*.stories.jsx",
"**/*.stories.mdx",
],
rules: {
"import/no-anonymous-default-export": "off",
},
},
],
env: {
browser: true,
node: true,
},
};