forked from Automattic/jetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
143 lines (140 loc) · 4.14 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
module.exports = {
root: true,
parser: 'babel-eslint',
extends: [ 'wpcalypso/react', 'plugin:jsx-a11y/recommended', 'prettier', 'prettier/react' ],
env: {
browser: true,
es6: true,
mocha: true,
node: true,
jquery: true,
},
parserOptions: {
ecmaVersion: 2019,
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
},
plugins: [ 'jsx-a11y', 'lodash', 'jsdoc' ],
rules: {
// REST API objects include underscores
camelcase: 0,
'comma-spacing': 2,
curly: 2,
'computed-property-spacing': [ 2, 'always' ],
'func-call-spacing': 2,
'jsx-quotes': [ 2, 'prefer-double' ],
'key-spacing': 2,
'keyword-spacing': 2,
'lodash/import-scope': [ 2, 'member' ],
'max-len': 0, // Ignored for Jetpack
'new-cap': [ 2, { capIsNew: false, newIsCap: true } ],
'no-else-return': 2,
'no-extra-semi': 2,
'no-multiple-empty-lines': [ 2, { max: 1 } ],
'no-multi-spaces': 2,
'no-restricted-imports': [ 2, 'lib/sites-list', 'lib/mixins/data-observe' ],
'no-restricted-modules': [ 2, 'lib/sites-list', 'lib/mixins/data-observe' ],
'no-shadow': 2,
'no-spaced-func': 2,
'no-trailing-spaces': 2,
// Allows Chai `expect` expressions
'no-unused-expressions': 0,
'no-var': 2,
'object-curly-spacing': [ 2, 'always' ],
'operator-linebreak': [
2,
'after',
{
overrides: {
'?': 'before',
':': 'before',
},
},
],
'padded-blocks': [ 2, 'never' ],
'prefer-const': 2,
'react/jsx-curly-spacing': [ 2, 'always' ],
'react/jsx-no-bind': 2,
// 'react/jsx-space-before-closing': 2,
'react/jsx-tag-spacing': [ 2, { beforeSelfClosing: 'always' } ],
'react/no-danger': 2,
'react/no-did-mount-set-state': 2,
'react/no-did-update-set-state': 2,
'react/no-is-mounted': 2,
'react/prefer-es6-class': 1,
semi: 2,
'semi-spacing': 2,
'space-before-blocks': [ 2, 'always' ],
'space-in-parens': [ 2, 'always' ],
'space-infix-ops': [ 2, { int32Hint: false } ],
'space-unary-ops': [
2,
{
overrides: {
'!': true,
},
},
],
'wpcalypso/i18n-ellipsis': 2,
'wpcalypso/i18n-no-collapsible-whitespace': 2,
'wpcalypso/i18n-no-this-translate': 2,
'wpcalypso/i18n-no-variables': 2,
'wpcalypso/i18n-mismatched-placeholders': 2,
'wpcalypso/import-docblock': 2,
'wpcalypso/jsx-gridicon-size': 0, // Ignored for Jetpack
'wpcalypso/jsx-classname-namespace': 0, // Ignored for Jetpack
'jsx-a11y/label-has-for': [
2,
{
required: {
some: [ 'nesting', 'id' ],
},
},
],
// Disabled rules for now. Ideally we should resolve all the errors these rules create.
'wpcalypso/redux-no-bound-selectors': 0,
'jsx-a11y/anchor-has-content': 0,
'react/no-string-refs': 0,
'jsx-a11y/anchor-is-valid': 0,
// JSDoc plugin overrides
'jsdoc/check-alignment': 1, // Recommended
'jsdoc/check-examples': 1,
'jsdoc/check-indentation': 1,
'jsdoc/check-param-names': 1, // Recommended
'jsdoc/check-syntax': 1,
'jsdoc/check-tag-names': 1, // Recommended
'jsdoc/check-types': 1, // Recommended
'jsdoc/implements-on-classes': 1, // Recommended
'jsdoc/newline-after-description': 1, // Recommended
'jsdoc/no-undefined-types': 1, // Recommended
'jsdoc/require-description': 1,
'jsdoc/require-hyphen-before-param-description': 1,
'jsdoc/require-jsdoc': 1, // Recommended
'jsdoc/require-param': 1, // Recommended
'jsdoc/require-param-description': 1, // Recommended
'jsdoc/require-param-name': 1, // Recommended
'jsdoc/require-param-type': 1, // Recommended
'jsdoc/require-returns': 1, // Recommended
'jsdoc/require-returns-check': 1, // Recommended
'jsdoc/require-returns-description': 1, // Recommended
'jsdoc/require-returns-type': 1, // Recommended
'jsdoc/valid-types': 1, // Recommended
'jsdoc/check-values': 1,
// eslint 6.x migration
'no-unused-vars': 1,
'no-useless-escape': 1,
'no-extra-boolean-cast': 1,
'no-case-declarations': 1,
'no-class-assign': 1,
'no-redeclare': 1,
// Workaround for ESLint failing to parse files with template literals
// with this error: "TypeError: Cannot read property 'range' of null"
'template-curly-spacing': 'off',
},
};