-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
82 lines (81 loc) · 2.03 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
module.exports = {
extends: ['airbnb', 'prettier'],
plugins: ['prettier', 'react-hooks'],
rules: {
'prettier/prettier': 'error',
'jsx-a11y/anchor-is-valid': 0, // https://github.com/zeit/next.js/issues/5533
'react/no-unescaped-entities': 0,
'react/jsx-filename-extension': 0,
'react/jsx-one-expression-per-line': 0,
// The jsx-wrap-multilines rule conflicts with Prettier.
// https://github.com/prettier/prettier/issues/1009#issuecomment-286993938
'react/jsx-wrap-multilines': [
'error',
{
declaration: false,
assignment: false,
},
],
'react-hooks/rules-of-hooks': 'error',
'lines-around-comment': [
'error',
{
beforeLineComment: true,
allowBlockStart: true,
allowBlockEnd: true,
allowObjectStart: true,
allowObjectEnd: true,
allowArrayStart: true,
allowArrayEnd: true,
allowClassStart: true,
allowClassEnd: true,
applyDefaultIgnorePatterns: true,
},
],
'react-hooks/exhaustive-deps': 'error',
'no-console': 'error',
},
overrides: [
// Set Jest rules only for test files.
// https://stackoverflow.com/a/49211283
{
files: ['**/*.test.js', '**/__mocks__/**/*.js'],
extends: ['plugin:jest/recommended'],
env: {
jest: true,
},
plugins: ['jest'],
rules: {
'global-require': 0,
'react/jsx-props-no-spreading': 0,
},
},
{
files: ['**/*.stories.{js,jsx}'],
extends: ['airbnb', 'prettier'],
plugins: ['prettier', 'react-hooks'],
rules: {
'global-require': 0,
'react/jsx-props-no-spreading': 0,
},
},
],
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
allowImportExportEverywhere: true,
},
env: {
es6: true,
},
globals: {
// Polyfilled in Next.js 9.4.
fetch: 'writable',
},
settings: {
// Handle linting for absolute imports.
'import/resolver': {
alias: [['src', './src']],
},
},
}