@automattic/eslint-plugin-wpvip 0.13.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/cli.js +14 -11
- package/configs/formatting.js +69 -66
- package/configs/index.js +4 -1
- package/configs/javascript.js +235 -217
- package/configs/jsdoc.js +66 -62
- package/configs/prettier.js +10 -6
- package/configs/react.js +47 -45
- package/configs/recommended.js +7 -13
- package/configs/testing.js +19 -18
- package/configs/typescript.js +84 -65
- package/configs/weak-javascript.js +41 -59
- package/configs/weak-testing.js +14 -13
- package/configs/weak-typescript.js +25 -27
- package/eslint.config.js +13 -0
- package/index.js +6 -4
- package/package.json +28 -29
- package/plugin.js +12 -0
- package/rules/nestjs-route-prefix.js +15 -2
- package/rules/no-async-foreach.js +12 -1
- package/rules/no-unguarded-get-range-at.js +1 -0
- package/init.js +0 -1
package/configs/cli.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/** @type import('eslint').Linter.Config[] */
|
|
2
|
+
module.exports = [
|
|
3
|
+
{
|
|
4
|
+
/**
|
|
5
|
+
* Please include a short description of the rule. For rules that downgrade or
|
|
6
|
+
* disable errors, include a brief justification or reasoning.
|
|
7
|
+
*/
|
|
8
|
+
rules: {
|
|
9
|
+
// Allow child_process and non-literal `exec` arguments.
|
|
10
|
+
'security/detect-child-process': 'off',
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
// Process.exit is used in CLI context to stop execution.
|
|
13
|
+
'no-process-exit': 'off',
|
|
14
|
+
},
|
|
12
15
|
},
|
|
13
|
-
|
|
16
|
+
];
|
package/configs/formatting.js
CHANGED
|
@@ -1,104 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/** @type import('eslint').Linter.Config[] */
|
|
2
|
+
module.exports = [
|
|
3
|
+
{
|
|
4
|
+
/**
|
|
5
|
+
* Please include a short description of the rule. For rules that downgrade or
|
|
6
|
+
* disable errors, include a brief justification or reasoning.
|
|
7
|
+
*/
|
|
8
|
+
rules: {
|
|
9
|
+
'array-bracket-spacing': [ 'error', 'always' ],
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
'arrow-parens': [ 'error', 'always' ],
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
'arrow-spacing': 'error',
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
'brace-style': [ 'error', '1tbs' ],
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
// Identifiers should be in camelCase. Object properties are excluded
|
|
18
|
+
// (including when destructuring) since they often come from external
|
|
19
|
+
// sources (like APIs).
|
|
20
|
+
camelcase: [
|
|
21
|
+
'error',
|
|
22
|
+
{
|
|
23
|
+
properties: 'never',
|
|
24
|
+
ignoreDestructuring: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
'comma-dangle': [ 'error', 'always-multiline' ],
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
'comma-spacing': 'error',
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
'comma-style': [ 'error', 'last' ],
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
'computed-property-spacing': [ 'error', 'always' ],
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
curly: [ 'error', 'all' ],
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
'dot-notation': 'error',
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
// Files must end in a newline.
|
|
41
|
+
'eol-last': [ 'error', 'always' ],
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
'func-call-spacing': 'error',
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
indent: [ 'error', 'tab', { SwitchCase: 1 } ],
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
'key-spacing': 'error',
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
'keyword-spacing': 'error',
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
// Lines containing code should be a maximum of 200 characters in length.
|
|
52
|
+
'max-len': [
|
|
53
|
+
'warn',
|
|
54
|
+
{
|
|
55
|
+
code: 200,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
'no-multi-spaces': 'error',
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
'no-multi-str': 'error',
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
'no-multiple-empty-lines': [ 'error', { max: 1 } ],
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
'no-trailing-spaces': 'error',
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
'no-whitespace-before-property': 'error',
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
'object-curly-spacing': [ 'error', 'always' ],
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
'object-shorthand': 'error',
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
'operator-linebreak': 'error',
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
'padded-blocks': [ 'error', 'never' ],
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
// Arrow functions should be used for function arguments and callbacks.
|
|
78
|
+
'prefer-arrow-callback': 'warn',
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
quotes: [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ],
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
'quote-props': [ 'error', 'as-needed' ],
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
semi: 'error',
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
'semi-spacing': 'error',
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
'space-before-blocks': [ 'error', 'always' ],
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
'space-before-function-paren': [
|
|
91
|
+
'error',
|
|
92
|
+
{ anonymous: 'never', named: 'never', asyncArrow: 'always' },
|
|
93
|
+
],
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
'space-in-parens': [ 'error', 'always' ],
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
'space-infix-ops': 'error',
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
'space-unary-ops': [ 'error', { overrides: { '!': true, yield: true } } ],
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
// Comments should always include consistent spacing for readability.
|
|
102
|
+
'spaced-comment': 'warn',
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
'template-curly-spacing': [ 'error', 'always' ],
|
|
105
|
+
},
|
|
103
106
|
},
|
|
104
|
-
|
|
107
|
+
];
|
package/configs/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @type {Record<string, import('eslint').Linter.Config[]>} */
|
|
2
|
+
const configs = {
|
|
2
3
|
base: require( './base' ), // synonym for javascript
|
|
3
4
|
cli: require( './cli' ),
|
|
4
5
|
formatting: require( './formatting' ),
|
|
@@ -13,3 +14,5 @@ module.exports = {
|
|
|
13
14
|
'weak-testing': require( './weak-testing' ),
|
|
14
15
|
'weak-typescript': require( './weak-typescript' ),
|
|
15
16
|
};
|
|
17
|
+
|
|
18
|
+
module.exports = configs;
|