-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
123 lines (120 loc) · 3.04 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
114
115
116
117
118
119
120
121
122
123
module.exports = {
root: true,
env: {
browser: true,
es6: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'airbnb-typescript',
'plugin:prettier/recommended',
'plugin:jest/recommended',
'plugin:jest-formatting/recommended',
'plugin:eslint-comments/recommended',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
allowImportExportEverywhere: true,
project: './tsconfig.json',
},
plugins: [
'@typescript-eslint',
'react',
'react-hooks',
'jest',
'jest-formatting',
'jsx-a11y',
'@shopify',
],
rules: {
'max-len': [
'error',
{
code: 80,
ignorePattern: '^(import|\\} from )',
ignoreTemplateLiterals: true,
ignoreStrings: true,
ignoreComments: true,
},
],
'max-params': 'error', // no more than 3 args per function
// Please use destruction when want to add more
'import/prefer-default-export': 'off', // just cause non-default exports are awesome
'import/order': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'jest-formatting/padding-around-expect-groups': 'off',
'consistent-return': 'off',
// we allow 0 warnings, so don't think prettier rules are ignored
// this is only to show prettier issues as warnings, not errors
'prettier/prettier': 'warn',
// too buggy rule: https://github.com/jest-community/eslint-plugin-jest/issues/203
'jest/valid-describe': 'off',
'jest/consistent-test-it': 'error',
'jest/valid-title': [
'error',
{
disallowedWords: ['should'],
},
],
'react/jsx-one-expression-per-line': 'off',
'jsx-a11y/label-has-for': [
'error',
{
required: {
some: ['nesting', 'id'],
},
allowChildren: true,
},
],
'jsx-a11y/label-has-associated-control': [
'error',
{
assert: 'either',
},
],
// rule conflicts with prettier
'react/jsx-wrap-multilines': [
'error',
{ declaration: false, assignment: false },
],
'react/jsx-props-no-spreading': 'off',
'jsx-a11y/anchor-has-content': [
2,
{
components: ['Link'],
},
],
// in React 17 there's no need to import React when use JSX
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
// Since we do not use prop-types
'react/prop-types': 'off',
'react/require-default-props': 'off',
// typescript
'@typescript-eslint/ban-ts-comment': 'off',
'@shopify/typescript/prefer-pascal-case-enums': 'error',
'@shopify/typescript/prefer-singular-enums': 'error',
},
}