forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
176 lines (171 loc) · 4.98 KB
/
.eslintrc
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
extends: yoast
parserOptions:
ecmaVersion: 2018
sourceType: module
settings:
react:
version: "16.8"
rules:
no-prototype-builtins: 0
comma-dangle:
- error
- arrays: always-multiline
objects: always-multiline
imports: always-multiline
exports: always-multiline
functions: never
overrides:
- files:
- "packages/*/tests/**/*.js"
- "packages/*/spec/**/*.js"
# Temporary exclusion:
- "packages/components/a11y/tests/**/*.js"
env:
jest: true
rules:
no-restricted-imports: "off"
- files:
- "packages/js/**/*.js"
rules:
# Custom rules: only for temporary exceptions that should be removed over time
camelcase: 1
complexity: [ 1, 6 ]
brace-style: 1
max-statements: 1
no-shadow: 1
require-jsdoc: 1
react/jsx-no-bind: 1
react/jsx-no-target-blank: 1
react/no-access-state-in-setstate: 1
react/no-deprecated: 1
react/no-unused-prop-types: 1
react/prop-types: 1
react/require-default-props: 1
no-restricted-imports:
- error
- name: react
message: Please use @wordpress/element instead. No need to import just for JSX.
- name: react-dom
message: Please use @wordpress/element instead.
# Disabled rules
# In the editor, we're using the pragma `wp.element.createElement`
react/react-in-jsx-scope: 0
- files:
- "packages/js/tests/**/*.js"
rules:
no-restricted-imports: 0
- files:
- "packages/schema-blocks/src/**"
env:
jest: true
rules:
new-cap: 0
complexity:
- 2
- 10
"@typescript-eslint/no-parameter-properties":
- 2
- allows:
- protected readonly
- private readonly
"@typescript-eslint/explicit-function-return-type": 0
"@typescript-eslint/no-use-before-define":
- error
- functions: false
no-constant-condition:
- error
- checkLoops: false
max-statements:
- 2
- 33
no-unused-vars: 'off'
"@typescript-eslint/no-unused-vars":
- error
- varsIgnorePattern: "^createElement$"
no-dupe-class-members: 'off'
indent: 'off'
"@typescript-eslint/indent":
- 2
- tab
- SwitchCase: 1
space-before-function-paren:
- error
- anonymous: never
named: never
asyncArrow: always
valid-jsdoc:
- error
- requireReturn: false
requireReturnType: false
requireParamType: false
react/react-in-jsx-scope: 0
- files:
- "packages/components/**/*.js"
rules:
react/jsx-no-bind: 1
react/require-default-props: 1
react/default-props-match-prop-types: 1
react/no-unused-prop-types: 1
require-jsdoc: 1
- files:
- "packages/configuration-wizard/**/*.js"
rules:
react/no-unused-prop-types: 1
react/jsx-no-bind: 1
react/no-access-state-in-setstate: 1
require-jsdoc: 1
- files:
- "packages/replacement-variable-editor/**/*.js"
rules:
react/jsx-no-bind: 1
react/require-default-props: 1
- files:
- "packages/search-metadata-previews/**/*.js"
rules:
react/jsx-no-bind: 1
react/no-unused-state: 1
react/no-access-state-in-setstate: 1
react/require-default-props: 1
react/default-props-match-prop-types: 1
- files:
- "packages/yoastseo/**/*.js"
rules:
complexity: 1
# Longer grace period for Yoast config.
no-shadow: [ 1, { "builtinGlobals": false, "hoist": "all", "allow": [ ] } ]
require-jsdoc: [ 1, { "require": { "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true, "FunctionExpression": true } } ]
no-useless-escape: 1
- files:
- "packages/analysis-report/**/*.js"
rules:
complexity: [ 1, 6 ]
// A wrapping label is not necessary when there already is an htmlFor attribute.
jsx-a11y/label-has-for: [ "error", { required: "id" } ]
require-jsdoc: 1
react/button-has-type: 1
react/default-props-match-prop-types: 1
react/no-unused-prop-types: 1
react/no-access-state-in-setstate: 1
react/no-unused-state: 1
react/jsx-no-bind: 1
react/jsx-no-target-blank: 1
react/require-default-props: 1
react/forbid-foreign-prop-types: 1
- files:
- "packages/yoast-components/**/*.js"
rules:
complexity: [ 1, 6 ]
// A wrapping label is not necessary when there already is an htmlFor attribute.
jsx-a11y/label-has-for: [ "error", { required: "id" } ]
require-jsdoc: 1
react/button-has-type: 1
react/default-props-match-prop-types: 1
react/no-unused-prop-types: 1
react/no-access-state-in-setstate: 1
react/no-unused-state: 1
react/jsx-no-bind: 1
react/jsx-no-target-blank: 1
react/require-default-props: 1
react/forbid-foreign-prop-types: 1
env:
jest: true