@aarongoldenthal/eslint-config-standard 12.0.1 → 14.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/README.md +23 -3
- package/index.js +35 -24
- package/jest-config.js +7 -4
- package/jsdoc-config.js +7 -7
- package/package.json +17 -12
- package/unicorn-config.js +32 -7
package/README.md
CHANGED
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
# @aarongoldenthal/eslint-config-standard
|
|
2
2
|
|
|
3
|
-
Custom standard ESLint configuration for all projects.
|
|
3
|
+
Custom standard ESLint configuration for all projects. Includes configurations for `eslint`, `eslint-plugin-jest`, `eslint-plugin-jsdoc`, `eslint-plugin-node`, `eslint-plugin-sonarjs`, and `eslint-plugin-unicorn`. Defines all required configurations as `dependencies` so they are installed and do not have to be defined in each project.
|
|
4
4
|
|
|
5
5
|
To configure .eslintrc.json for all plugins:
|
|
6
6
|
|
|
7
7
|
```json
|
|
8
8
|
{
|
|
9
9
|
"extends": [
|
|
10
|
-
"@aarongoldenthal/eslint-config-standard",
|
|
11
10
|
"@aarongoldenthal/eslint-config-standard/jest-config",
|
|
12
11
|
"@aarongoldenthal/eslint-config-standard/jsdoc-config",
|
|
13
12
|
"@aarongoldenthal/eslint-config-standard/node-config",
|
|
14
13
|
"@aarongoldenthal/eslint-config-standard/sonarjs-config",
|
|
15
|
-
"@aarongoldenthal/eslint-config-standard/unicorn-config"
|
|
14
|
+
"@aarongoldenthal/eslint-config-standard/unicorn-config",
|
|
15
|
+
"@aarongoldenthal/eslint-config-standard"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Note `@aarongoldenthal/eslint-config-standard` is included last so those settings take precendence.
|
|
21
|
+
|
|
22
|
+
The configuration as-defined includes a number of formatting rules. The `eslint-config-prettier` package is included as well, and can be added to the config if `prettier` is also being used so it takes priority for formatting.
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"extends": [
|
|
27
|
+
"@aarongoldenthal/eslint-config-standard/jest-config",
|
|
28
|
+
"@aarongoldenthal/eslint-config-standard/jsdoc-config",
|
|
29
|
+
"@aarongoldenthal/eslint-config-standard/node-config",
|
|
30
|
+
"@aarongoldenthal/eslint-config-standard/sonarjs-config",
|
|
31
|
+
"@aarongoldenthal/eslint-config-standard/unicorn-config",
|
|
32
|
+
"@aarongoldenthal/eslint-config-standard",
|
|
33
|
+
"prettier"
|
|
16
34
|
]
|
|
17
35
|
}
|
|
18
36
|
```
|
|
37
|
+
|
|
38
|
+
In this case `prettier` is included last to take priority in disabling the applicable rules from all other configurations.
|
package/index.js
CHANGED
|
@@ -20,31 +20,39 @@ module.exports = {
|
|
|
20
20
|
rules: {
|
|
21
21
|
'array-bracket-spacing': 'error',
|
|
22
22
|
'array-callback-return': 'error',
|
|
23
|
+
'arrow-parens': ['error', 'always'],
|
|
23
24
|
'block-scoped-var': 1,
|
|
24
25
|
'block-spacing': 'error',
|
|
25
26
|
'brace-style': ['error', 'stroustrup'],
|
|
26
|
-
|
|
27
|
+
camelcase: 'error',
|
|
27
28
|
'comma-dangle': ['error', 'never'],
|
|
28
|
-
'comma-spacing': ['error', {
|
|
29
|
-
|
|
29
|
+
'comma-spacing': ['error', { before: false, after: true }],
|
|
30
|
+
complexity: ['error', complexityThreshold],
|
|
30
31
|
'computed-property-spacing': ['error', 'never'],
|
|
31
|
-
|
|
32
|
+
curly: 'error',
|
|
32
33
|
'default-case': 'error',
|
|
33
34
|
'default-case-last': 'error',
|
|
34
35
|
'default-param-last': 'error',
|
|
35
36
|
'eol-last': ['error', 'always'],
|
|
36
|
-
|
|
37
|
+
eqeqeq: ['error', 'always'],
|
|
37
38
|
'func-call-spacing': ['error', 'never'],
|
|
38
39
|
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
39
|
-
|
|
40
|
+
indent: ['error', tabSpaces, { SwitchCase: 1 }],
|
|
40
41
|
'key-spacing': 'error',
|
|
41
|
-
'keyword-spacing': ['error', {
|
|
42
|
+
'keyword-spacing': ['error', { before: true, after: true }],
|
|
42
43
|
'linebreak-style': ['error', 'unix'],
|
|
43
44
|
'lines-between-class-members': ['error', 'always'],
|
|
44
|
-
'max-depth': ['error', {
|
|
45
|
+
'max-depth': ['error', { max: nestedThreshold }],
|
|
45
46
|
'max-lines': ['error', maxLinesThreshold],
|
|
46
|
-
'max-lines-per-function': [
|
|
47
|
-
|
|
47
|
+
'max-lines-per-function': [
|
|
48
|
+
'error',
|
|
49
|
+
{
|
|
50
|
+
max: maxFunctionLinesThreshold,
|
|
51
|
+
skipBlankLines: true,
|
|
52
|
+
skipComments: true
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
'max-nested-callbacks': ['error', { max: nestedThreshold }],
|
|
48
56
|
'new-parens': 'error',
|
|
49
57
|
'no-alert': 'error',
|
|
50
58
|
'no-array-constructor': 'error',
|
|
@@ -63,7 +71,7 @@ module.exports = {
|
|
|
63
71
|
'no-lone-blocks': 'error',
|
|
64
72
|
'no-lonely-if': 'error',
|
|
65
73
|
'no-loop-func': 'error',
|
|
66
|
-
'no-magic-numbers': ['error', {
|
|
74
|
+
'no-magic-numbers': ['error', { ignore: [-1, 0, 1] }],
|
|
67
75
|
'no-mixed-spaces-and-tabs': 'error',
|
|
68
76
|
'no-multi-assign': 'error',
|
|
69
77
|
'no-multi-spaces': 'error',
|
|
@@ -74,13 +82,13 @@ module.exports = {
|
|
|
74
82
|
'no-new-func': 'error',
|
|
75
83
|
'no-new-object': 'error',
|
|
76
84
|
'no-new-wrappers': 'error',
|
|
77
|
-
'no-param-reassign': ['error', {
|
|
85
|
+
'no-param-reassign': ['error', { props: false }],
|
|
78
86
|
'no-promise-executor-return': 'error',
|
|
79
87
|
'no-return-assign': 'error',
|
|
80
88
|
'no-return-await': 'error',
|
|
81
89
|
'no-script-url': 'error',
|
|
82
90
|
'no-self-compare': 'error',
|
|
83
|
-
'no-sequences': ['error', {
|
|
91
|
+
'no-sequences': ['error', { allowInParentheses: false }],
|
|
84
92
|
'no-shadow': 'error',
|
|
85
93
|
'no-template-curly-in-string': 'error',
|
|
86
94
|
'no-throw-literal': 'error',
|
|
@@ -88,7 +96,7 @@ module.exports = {
|
|
|
88
96
|
'no-underscore-dangle': 'error',
|
|
89
97
|
'no-unneeded-ternary': 'error',
|
|
90
98
|
'no-unreachable-loop': 'error',
|
|
91
|
-
'no-use-before-define': ['error', {
|
|
99
|
+
'no-use-before-define': ['error', { functions: false }],
|
|
92
100
|
'no-useless-concat': 'error',
|
|
93
101
|
'no-useless-constructor': 'error',
|
|
94
102
|
'no-useless-return': 'error',
|
|
@@ -100,29 +108,32 @@ module.exports = {
|
|
|
100
108
|
'operator-assignment': 'error',
|
|
101
109
|
'padded-blocks': ['error', 'never'],
|
|
102
110
|
'prefer-const': 'error',
|
|
103
|
-
'prefer-destructuring': ['error', {
|
|
111
|
+
'prefer-destructuring': ['error', { array: true, object: true }],
|
|
104
112
|
'prefer-object-spread': ['error'],
|
|
105
113
|
'prefer-promise-reject-errors': 'error',
|
|
106
114
|
'prefer-regex-literals': 'error',
|
|
107
115
|
'prefer-rest-params': 'error',
|
|
108
116
|
'prefer-spread': 'error',
|
|
109
117
|
'prefer-template': 'error',
|
|
110
|
-
|
|
118
|
+
quotes: ['error', 'single'],
|
|
111
119
|
'require-await': 'error',
|
|
112
120
|
'rest-spread-spacing': 'error',
|
|
113
121
|
'semi-spacing': 'error',
|
|
114
|
-
|
|
122
|
+
semi: ['error', 'always'],
|
|
115
123
|
'space-before-blocks': ['error', 'always'],
|
|
116
|
-
'space-before-function-paren': [
|
|
117
|
-
'
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
'space-before-function-paren': [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
anonymous: 'always',
|
|
128
|
+
named: 'never',
|
|
129
|
+
asyncArrow: 'always'
|
|
130
|
+
}
|
|
131
|
+
],
|
|
121
132
|
'space-in-parens': ['error', 'never'],
|
|
122
133
|
'spaced-comment': ['error', 'always'],
|
|
123
|
-
|
|
134
|
+
strict: 'error',
|
|
124
135
|
'template-curly-spacing': 'error',
|
|
125
136
|
'wrap-iife': 'error',
|
|
126
|
-
|
|
137
|
+
yoda: 'error'
|
|
127
138
|
}
|
|
128
139
|
};
|
package/jest-config.js
CHANGED
|
@@ -7,7 +7,10 @@ module.exports = {
|
|
|
7
7
|
extends: ['plugin:jest/recommended'],
|
|
8
8
|
plugins: ['jest'],
|
|
9
9
|
rules: {
|
|
10
|
-
'jest/consistent-test-it': [
|
|
10
|
+
'jest/consistent-test-it': [
|
|
11
|
+
'error',
|
|
12
|
+
{ fn: 'it', withinDescribe: 'it' }
|
|
13
|
+
],
|
|
11
14
|
'jest/expect-expect': 'error',
|
|
12
15
|
'jest/max-nested-describe': 'error',
|
|
13
16
|
'jest/no-alias-methods': 'error',
|
|
@@ -18,8 +21,8 @@ module.exports = {
|
|
|
18
21
|
'jest/no-restricted-matchers': [
|
|
19
22
|
'error',
|
|
20
23
|
{
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
toBeTruthy: 'Avoid `toBeTruthy`',
|
|
25
|
+
toBeFalsy: 'Avoid `toBeFalsy`'
|
|
23
26
|
}
|
|
24
27
|
],
|
|
25
28
|
'jest/prefer-called-with': 'error',
|
|
@@ -28,7 +31,7 @@ module.exports = {
|
|
|
28
31
|
'jest/prefer-expect-assertions': 'error',
|
|
29
32
|
'jest/prefer-expect-resolves': 'error',
|
|
30
33
|
'jest/prefer-lowercase-title': 'error',
|
|
31
|
-
'jest/prefer-snapshot-hint': '
|
|
34
|
+
'jest/prefer-snapshot-hint': 'error',
|
|
32
35
|
'jest/prefer-spy-on': 'error',
|
|
33
36
|
'jest/prefer-strict-equal': 'error',
|
|
34
37
|
'jest/prefer-to-be': 'error',
|
package/jsdoc-config.js
CHANGED
|
@@ -25,13 +25,13 @@ module.exports = {
|
|
|
25
25
|
'jsdoc/require-jsdoc': [
|
|
26
26
|
'error',
|
|
27
27
|
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
publicOnly: true,
|
|
29
|
+
require: {
|
|
30
|
+
ArrowFunctionExpression: true,
|
|
31
|
+
ClassDeclaration: true,
|
|
32
|
+
ClassExpression: true,
|
|
33
|
+
FunctionDeclaration: true,
|
|
34
|
+
FunctionExpression: true
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
], // Recommended
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarongoldenthal/eslint-config-standard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Standard ESLint configuration settings",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"hooks-pre-commit": "npm run lint && npm run prettier-check",
|
|
8
|
+
"hooks-pre-push": "npm audit --audit-level=high && npm test",
|
|
9
|
+
"lint": "npm run lint-js && npm run lint-md",
|
|
8
10
|
"lint-js": "eslint \"**/*.js\"",
|
|
9
11
|
"lint-md": "markdownlint **/*.md --ignore node_modules",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
+
"prettier-check": "prettier --check --ignore-path=.gitignore .",
|
|
13
|
+
"prettier-fix": "prettier --write --ignore-path=.gitignore .",
|
|
14
|
+
"test": "jest --ci"
|
|
12
15
|
},
|
|
13
16
|
"repository": {
|
|
14
17
|
"type": "git",
|
|
@@ -29,19 +32,21 @@
|
|
|
29
32
|
"bugs": {
|
|
30
33
|
"url": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard/issues"
|
|
31
34
|
},
|
|
32
|
-
"homepage": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard
|
|
35
|
+
"homepage": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard",
|
|
33
36
|
"dependencies": {
|
|
34
|
-
"eslint-
|
|
35
|
-
"eslint-plugin-
|
|
37
|
+
"eslint-config-prettier": "^8.5.0",
|
|
38
|
+
"eslint-plugin-jest": "^26.1.4",
|
|
39
|
+
"eslint-plugin-jsdoc": "^39.0.1",
|
|
36
40
|
"eslint-plugin-node": "^11.1.0",
|
|
37
|
-
"eslint-plugin-sonarjs": "^0.
|
|
38
|
-
"eslint-plugin-unicorn": "^
|
|
41
|
+
"eslint-plugin-sonarjs": "^0.13.0",
|
|
42
|
+
"eslint-plugin-unicorn": "^42.0.0"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"eslint": "^8.
|
|
45
|
+
"eslint": "^8.13.0",
|
|
42
46
|
"jest": "^27.5.1",
|
|
43
|
-
"jest-junit": "^13.
|
|
44
|
-
"markdownlint-cli": "^0.31.1"
|
|
47
|
+
"jest-junit": "^13.1.0",
|
|
48
|
+
"markdownlint-cli": "^0.31.1",
|
|
49
|
+
"prettier": "^2.6.2"
|
|
45
50
|
},
|
|
46
51
|
"peerDependencies": {
|
|
47
52
|
"eslint": "^8.0.1"
|
package/unicorn-config.js
CHANGED
|
@@ -8,14 +8,18 @@ module.exports = {
|
|
|
8
8
|
'unicorn/consistent-destructuring': 'error',
|
|
9
9
|
'unicorn/consistent-function-scoping': 'error',
|
|
10
10
|
'unicorn/custom-error-definition': 'error',
|
|
11
|
+
'unicorn/empty-brace-spaces': 'off',
|
|
11
12
|
'unicorn/error-message': 'error',
|
|
12
13
|
'unicorn/escape-case': 'error',
|
|
14
|
+
'unicorn/expiring-todo-comments': 'off',
|
|
13
15
|
'unicorn/explicit-length-check': 'error',
|
|
14
|
-
'unicorn/filename-case': ['error', {
|
|
16
|
+
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
|
17
|
+
'unicorn/import-style': 'off',
|
|
15
18
|
'unicorn/new-for-builtins': 'error',
|
|
16
19
|
'unicorn/no-abusive-eslint-disable': 'error',
|
|
17
20
|
'unicorn/no-array-callback-reference': 'error',
|
|
18
21
|
'unicorn/no-array-for-each': 'error',
|
|
22
|
+
'unicorn/no-array-method-this-argument': 'off',
|
|
19
23
|
'unicorn/no-array-push-push': 'error',
|
|
20
24
|
'unicorn/no-array-reduce': 'error',
|
|
21
25
|
'unicorn/no-await-expression-member': 'error',
|
|
@@ -26,9 +30,11 @@ module.exports = {
|
|
|
26
30
|
'unicorn/no-hex-escape': 'error',
|
|
27
31
|
'unicorn/no-instanceof-array': 'error',
|
|
28
32
|
'unicorn/no-invalid-remove-event-listener': 'error',
|
|
33
|
+
'unicorn/no-keyword-prefix': 'off',
|
|
29
34
|
'unicorn/no-lonely-if': 'error',
|
|
30
35
|
'unicorn/no-nested-ternary': 'error',
|
|
31
36
|
'unicorn/no-new-array': 'error',
|
|
37
|
+
'unicorn/no-new-buffer': 'off',
|
|
32
38
|
'unicorn/no-null': 'error',
|
|
33
39
|
'unicorn/no-object-as-default-parameter': 'error',
|
|
34
40
|
'unicorn/no-process-exit': 'error',
|
|
@@ -36,12 +42,14 @@ module.exports = {
|
|
|
36
42
|
'unicorn/no-thenable': 'error',
|
|
37
43
|
'unicorn/no-this-assignment': 'error',
|
|
38
44
|
'unicorn/no-unreadable-array-destructuring': 'error',
|
|
45
|
+
'unicorn/no-unreadable-iife': 'error',
|
|
39
46
|
'unicorn/no-unsafe-regex': 'error',
|
|
40
47
|
'unicorn/no-unused-properties': 'error',
|
|
41
48
|
'unicorn/no-useless-fallback-in-spread': 'error',
|
|
42
49
|
'unicorn/no-useless-length-check': 'error',
|
|
43
50
|
'unicorn/no-useless-promise-resolve-reject': 'error',
|
|
44
51
|
'unicorn/no-useless-spread': 'error',
|
|
52
|
+
'unicorn/no-useless-switch-case': 'error',
|
|
45
53
|
'unicorn/no-useless-undefined': 'error',
|
|
46
54
|
'unicorn/no-zero-fractions': 'error',
|
|
47
55
|
'unicorn/number-literal-case': 'error',
|
|
@@ -52,6 +60,7 @@ module.exports = {
|
|
|
52
60
|
'unicorn/prefer-array-flat-map': 'error',
|
|
53
61
|
'unicorn/prefer-array-index-of': 'error',
|
|
54
62
|
'unicorn/prefer-array-some': 'error',
|
|
63
|
+
'unicorn/prefer-at': 'off',
|
|
55
64
|
'unicorn/prefer-code-point': 'error',
|
|
56
65
|
'unicorn/prefer-date-now': 'error',
|
|
57
66
|
'unicorn/prefer-default-parameters': 'error',
|
|
@@ -59,35 +68,51 @@ module.exports = {
|
|
|
59
68
|
'unicorn/prefer-dom-node-dataset': 'error',
|
|
60
69
|
'unicorn/prefer-dom-node-remove': 'error',
|
|
61
70
|
'unicorn/prefer-dom-node-text-content': 'error',
|
|
71
|
+
'unicorn/prefer-export-from': 'off',
|
|
62
72
|
'unicorn/prefer-includes': 'error',
|
|
73
|
+
'unicorn/prefer-json-parse-buffer': 'off',
|
|
63
74
|
'unicorn/prefer-keyboard-event-key': 'error',
|
|
75
|
+
'unicorn/prefer-math-trunc': 'off',
|
|
64
76
|
'unicorn/prefer-modern-dom-apis': 'error',
|
|
77
|
+
'unicorn/prefer-modern-math-apis': 'error',
|
|
78
|
+
'unicorn/prefer-native-coercion-functions': 'error',
|
|
65
79
|
'unicorn/prefer-negative-index': 'error',
|
|
80
|
+
'unicorn/prefer-node-protocol': 'off',
|
|
66
81
|
'unicorn/prefer-number-properties': 'error',
|
|
82
|
+
'unicorn/prefer-object-from-entries': 'off',
|
|
83
|
+
'unicorn/prefer-optional-catch-binding': 'error',
|
|
84
|
+
'unicorn/prefer-prototype-methods': 'off',
|
|
67
85
|
'unicorn/prefer-query-selector': 'error',
|
|
86
|
+
'unicorn/prefer-reflect-apply': 'off',
|
|
68
87
|
'unicorn/prefer-regexp-test': 'error',
|
|
69
88
|
'unicorn/prefer-set-has': 'error',
|
|
70
89
|
'unicorn/prefer-spread': 'error',
|
|
71
|
-
'unicorn/prefer-string-replace-all': '
|
|
90
|
+
'unicorn/prefer-string-replace-all': 'off',
|
|
72
91
|
'unicorn/prefer-string-slice': 'error',
|
|
73
92
|
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
74
93
|
'unicorn/prefer-string-trim-start-end': 'error',
|
|
75
94
|
'unicorn/prefer-switch': 'error',
|
|
76
95
|
'unicorn/prefer-ternary': 'error',
|
|
96
|
+
'unicorn/prefer-top-level-await': 'off',
|
|
77
97
|
'unicorn/prefer-type-error': 'error',
|
|
78
98
|
'unicorn/prevent-abbreviations': [
|
|
79
99
|
'error',
|
|
80
100
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
allowList: {
|
|
102
|
+
args: true,
|
|
103
|
+
env: true,
|
|
104
|
+
i: true,
|
|
105
|
+
pkg: true
|
|
86
106
|
}
|
|
87
107
|
}
|
|
88
108
|
],
|
|
109
|
+
'unicorn/relative-url-style': 'error',
|
|
89
110
|
'unicorn/require-array-join-separator': 'error',
|
|
90
111
|
'unicorn/require-number-to-fixed-digits-argument': 'error',
|
|
112
|
+
'unicorn/require-post-message-target-origin': 'off',
|
|
113
|
+
'unicorn/string-content': 'off',
|
|
114
|
+
'unicorn/template-indent': 'off',
|
|
115
|
+
'unicorn/text-encoding-identifier-case': 'error',
|
|
91
116
|
'unicorn/throw-new-error': 'error'
|
|
92
117
|
},
|
|
93
118
|
overrides: [
|