-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
114 lines (114 loc) · 3.7 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
module.exports = {
extends: [
'plugin:@shopify/typescript',
'plugin:@shopify/typescript-type-checking',
'plugin:@shopify/react',
'plugin:@shopify/jest',
'plugin:@shopify/prettier',
],
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
rules: {
'jest/valid-expect-in-promise': 'off',
'import/extensions': 'off',
'jsx-a11y/control-has-associated-label': 'off',
'node/no-extraneous-require': 'off',
'import/no-cycle': 'off',
'jest/require-tothrow-message': 'off',
'jest/no-standalone-expect': [
'error',
{additionalTestBlockFunctions: ['itIf']},
],
'callback-return': 'off',
'func-style': 'off',
'react/display-name': 'off',
'@shopify/restrict-full-import': ['error', 'lodash'],
'@shopify/jsx-no-hardcoded-content': 'off',
// reports false positives with React's useRef hook
'require-atomic-updates': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/prefer-readonly': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/await-thenable': 'off',
'import/no-extraneous-dependencies': 'error',
'import/consistent-type-specifier-style': 'error',
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@faker-js/faker',
message: "Please use '@faker-js/faker/locale/en' instead",
},
],
},
],
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
// Enforce camelCase naming convention and PascalCase class and interface names
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'default',
filter: {
match: true,
// Allow double underscores and React UNSAFE_ (for lifecycle hooks that are to be deprecated)
regex: '^(__|UNSAFE_).+$',
},
format: null,
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
},
},
{
files: [
'**/tests/**/*.ts',
'**/tests/**/*.tsx',
'**/*.test-d.ts',
'**/*.test-d.tsx',
],
rules: {
// We disable `import/no-extraneous-dependencies` for test files because it
// would force releases of `@shopify/react-testing` (and similar devDependencies)
// to cause unnecessary package bumps in every package that consumes them.
// Test files with extraneous dependencies won't cause runtime errors in production.
'import/no-extraneous-dependencies': 'off',
'react/jsx-no-constructed-context-values': 'off',
'react/jsx-key': 'off',
'@shopify/react-require-autocomplete': 'off',
},
},
{
files: ['**/tests/fixtures/**/*'],
rules: {
'@shopify/typescript/prefer-pascal-case-enums': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unnecessary-qualifier': 'off',
'babel/object-curly-spacing': 'off',
'prettier/prettier': 'off',
'import/newline-after-import': 'off',
'import/order': 'off',
},
},
],
};