-
Notifications
You must be signed in to change notification settings - Fork 62
/
.eslintrc.js
116 lines (95 loc) · 3.13 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
module.exports = {
root: true,
extends: [
'plugin:@wordpress/eslint-plugin/recommended-with-formatting',
'plugin:jest/recommended',
'plugin:compat/recommended',
'plugin:stackable/recommended',
],
env: {
browser: true,
},
rules: {
// No semi-colons because they're a hassle.
semi: [ 'error', 'never' ],
// Only use parenthesis on arrow functions that need them since it's a hassle.
'arrow-parens': [ 'error', 'as-needed' ],
// Allow our deprecated properties since they're readable.
camelcase: [ 'error', {
allow: [ '\\w+(_\\d+)+' ],
} ],
// Force destructuring assignments to be multiline if they have lots of variables.
'object-curly-newline': [ 'error', {
ObjectExpression: {
multiline: true,
minProperties: 3,
consistent: true,
},
ObjectPattern: {
multiline: true,
minProperties: 3,
consistent: true,
},
// Force strict formatting on import/export
ImportDeclaration: {
multiline: true,
minProperties: 3,
consistent: false,
},
ExportDeclaration: {
multiline: true,
minProperties: 3,
consistent: false,
},
} ],
// Allow assigning same named variables (mainly for function arguments) in inside code-blocks.
'no-shadow': 'off',
// For me it's easier to read nested ternary if you add some formatting.
'no-nested-ternary': 'off',
// Allow tabs and spaces mixed for aesthetics.
'no-mixed-spaces-and-tabs': [ 'error', 'smart-tabs' ],
// Sort to find stuff easier.
'sort-vars': [ 'error', { ignoreCase: true } ],
// 'sort-keys': ["error", "asc", {caseSensitive: false, natural: true}],
// Allow arrays to be consistently vertical or horizontal.
'array-element-newline': [ 'error', 'consistent' ],
// We know what we're doing.
'@wordpress/valid-sprintf': 'off',
// Off since returning false positives.
'@wordpress/no-unused-vars-before-return': 'off',
'jsdoc/no-undefined-types': 'off',
'@wordpress/no-unguarded-get-range-at': 'off',
// LF style line breaks.
'linebreak-style': [ 'error', 'unix' ],
// Turn this off since it's showing errors when optional chaining "?."
'no-unused-expressions': 'off',
// Fix some import errors.
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
// We will use dynamic text domain.
'@wordpress/i18n-text-domain': 'off',
// No translator comments.
'@wordpress/i18n-translator-comments': 'off',
// We use our own BaseControl.
'@wordpress/no-base-control-with-label-without-id': 'off',
// In array spread, ignore unused args if they start with _
// e.g. const [ _unused, used ] = [ 'a', 'b', 'c' ]
'no-unused-vars': [ 'error', { varsIgnorePattern: '^_' } ],
// Require tabbed indentation in jsx.
'react/jsx-indent': [ 2, 'tab', { indentLogicalExpressions: true } ],
// Disallow unnecessary JSX expressions when literals alone are sufficient.
'react/jsx-curly-brace-presence': [ 'error', { props: 'never', children: 'never' } ],
},
globals: {
localStorage: true,
fetch: true,
Waypoint: true,
shallow: true,
btoa: true,
alert: true,
Element: true,
FileReader: true,
MutationObserver: true,
IntersectionObserver: true,
},
}