-
Notifications
You must be signed in to change notification settings - Fork 381
/
Copy path.eslintrc.js
155 lines (155 loc) · 3.52 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
module.exports = {
root: true,
extends: [
'plugin:@wordpress/eslint-plugin/recommended',
'plugin:import/recommended',
'plugin:eslint-comments/recommended',
],
env: {
browser: true,
},
rules: {
'block-scoped-var': 'error',
complexity: ['error', { max: 20 }],
'consistent-return': 'error',
'default-case': 'error',
'guard-for-in': 'error',
'no-await-in-loop': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-floating-decimal': 'error',
'no-implicit-coercion': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-loop-func': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-restricted-properties': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-shadow': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-unmodified-loop-condition': 'error',
'no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
'no-useless-call': 'error',
'no-useless-concat': 'error',
'prefer-object-spread': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
radix: ['error', 'as-needed'],
'require-await': 'error',
'rest-spread-spacing': ['error', 'never'],
'react/prop-types': 'error',
'react-hooks/exhaustive-deps': [
'error',
{ additionalHooks: 'useSelect' },
],
'react/jsx-closing-tag-location': 'error',
'react/jsx-fragments': 'error',
'react/jsx-first-prop-new-line': 'error',
'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
'react/jsx-no-literals': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/no-unused-prop-types': 'error',
'react/self-closing-comp': 'error',
'import/no-unresolved': [
'error',
{
ignore: [
'jquery',
'amp-block-editor-data',
'amp-settings',
'amp-themes',
'amp-plugins',
'amp-support',
'amp-block-validation',
'amp-site-scan-notice',
],
},
],
'import/order': [
'error',
{
groups: [
'builtin',
['external', 'unknown'],
'internal',
'parent',
'sibling',
'index',
],
},
],
'jsdoc/check-indentation': 'error',
'@wordpress/dependency-group': 'error',
'@wordpress/react-no-unsafe-timeout': 'error',
},
overrides: [
{
files: [
'**/__tests__/**/*.js',
'**/test/*.js',
'**/?(*.)test.js',
'tests/js/**/*.js',
],
extends: ['plugin:jest/all'],
rules: {
'jest/prefer-lowercase-title': [
'error',
{
ignore: ['describe'],
},
],
'jest/max-expects': 'off',
'jest/no-hooks': 'off',
'jest/prefer-expect-assertions': 'off',
'jest/prefer-inline-snapshots': 'off',
'jest/prefer-snapshot-hint': 'off',
'jest/no-untyped-mock-factory': 'off',
},
},
{
files: ['tests/e2e/**/*.js'],
extends: [
'plugin:@wordpress/eslint-plugin/test-e2e',
'plugin:jest/all',
],
rules: {
'jest/prefer-lowercase-title': [
'error',
{
ignore: ['describe'],
},
],
'jest/max-expects': 'off',
'jest/no-hooks': 'off',
'jest/prefer-expect-assertions': 'off',
'jest/prefer-inline-snapshots': 'off',
},
},
{
files: ['assets/src/mobile-redirection.js'],
globals: {
AMP_MOBILE_REDIRECTION: false,
location: false,
navigator: false,
sessionStorage: false,
},
},
{
files: ['assets/src/customizer/amp-customize-controls.js'],
globals: {
HTMLAnchorElement: false,
},
},
],
};