-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
88 lines (86 loc) · 2.16 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
const sharedRules = {
// Next.js has a Link component that's used when navigating to an internal
// route. Using the component requires us to use an <a> element as its
// child. Instead of passing a href attribute to directly to the <a>
// element, we pass it as a prop to the Link component. This raises a very
// common accessibility issue of an anchor tag with no href.
"jsx-a11y/anchor-is-valid": [
`error`,
{
components: [`Link`],
specialLink: [`hrefLeft`, `hrefRight`],
aspects: [`invalidHref`, `preferButton`],
},
],
"react/jsx-filename-extension": `off`,
"react/jsx-sort-props": `error`,
"react/prop-types": `off`,
"react/react-in-jsx-scope": `off`,
"react/require-default-props": `off`,
"simple-import-sort/imports": `error`,
"simple-import-sort/exports": `error`,
quotes: [`error`, `backtick`],
};
const sharedPlugins = [`simple-import-sort`];
module.exports = {
root: true,
parser: `babel-eslint`,
extends: [
`airbnb`,
`airbnb/hooks`,
`plugin:mdx/recommended`,
`plugin:prettier/recommended`,
`prettier/react`,
],
env: {
browser: true,
},
plugins: sharedPlugins,
rules: {
"import/extensions": [
`error`,
`ignorePackages`,
{
js: `never`,
jsx: `never`,
ts: `never`,
tsx: `never`,
},
],
...sharedRules,
},
settings: {
"import/resolver": {
node: {
extensions: [`.js`, `.jsx`, `.ts`, `.tsx`],
},
},
},
overrides: [
{
extends: [
`airbnb-typescript`,
`airbnb/hooks`,
`plugin:@typescript-eslint/eslint-recommended`,
`plugin:@typescript-eslint/recommended`,
`plugin:@typescript-eslint/recommended-requiring-type-checking`,
`plugin:prettier/recommended`,
`prettier/@typescript-eslint`,
`prettier/react`,
],
files: [`**/*.ts`, `**/*.tsx`],
parser: `@typescript-eslint/parser`,
parserOptions: {
project: `./tsconfig.json`,
},
plugins: sharedPlugins,
rules: {
...sharedRules,
},
},
{
files: [`*.mdx`],
extends: [`plugin:mdx/overrides`],
},
],
};