-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
113 lines (113 loc) · 3.2 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
// TODO run `npm install --save-dev @next/eslint-plugin-next`
// 'plugin:@next/next/recommended',
'prettier',
],
overrides: [
{
files: ['**/*.ts'],
plugins: ['jsx-a11y'],
rules: {
'jsx-a11y/no-onchange': 'off', // https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/398
'jsx-a11y/no-redundant-roles': [
'error',
{
dialog: ['dialog'],
img: ['img'], // SVGs as img src can go into the SVG unexpectedly
li: ['listitem'], // VoiceOver loses list semantics with list-style: none
ol: ['list'], // VoiceOver loses list semantics with list-style: none
ul: ['list'], // VoiceOver loses list semantics with list-style: none
},
],
},
},
{
// Pages (html and api) have to export default for next.
files: ['./pages/**/*.{ts,tsx}', './app/**/*.{ts,tsx}', 'jest.config.ts'],
rules: {
'import/no-default-export': 0,
},
},
{
files: ['jest.config.js', 'next.config.js'],
rules: {
'@typescript-eslint/no-var-requires': 0,
},
},
],
settings: {
react: { version: 'detect' },
'import/resolver': {
typescript: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
// TODO add jsx-a11y here.
plugins: ['@typescript-eslint', 'import', 'react', 'react-hooks', 'unicorn'],
ignorePatterns: ['features/content/list-view/**'],
rules: {
camelcase: 'error',
curly: ['error', 'all'],
'global-require': 'error',
'no-console': ['warn', { allow: ['error'] }],
'no-duplicate-imports': 'error',
'no-restricted-globals': ['error', 'event'],
'no-template-curly-in-string': 'error',
'no-useless-constructor': 'error',
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'react/button-has-type': 'error',
'react/display-name': 'off',
'react/no-deprecated': 'off',
'react/no-find-dom-node': 'off',
'react/no-is-mounted': 'off',
'react/no-string-refs': 'off',
'react/no-unknown-property': 'off',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
['sibling', 'index'],
],
alphabetize: { order: 'asc', caseInsensitive: true },
'newlines-between': 'ignore',
},
],
'react/prop-types': 'off', // For now until clean up propTypes
// TODO 'import/no-cycle': 'warn',
'import/no-self-import': 'warn',
'import/no-default-export': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['../*'],
message: 'Usage of relative parent imports is not allowed.',
},
],
},
],
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
},
}