@aarongoldenthal/eslint-config-standard 13.0.0 → 16.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 +19 -1
- package/index.js +35 -24
- package/jest-config.js +33 -7
- package/jsdoc-config.js +7 -7
- package/package.json +19 -14
- package/unicorn-config.js +8 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
|
@@ -18,3 +18,21 @@ To configure .eslintrc.json for all plugins:
|
|
|
18
18
|
```
|
|
19
19
|
|
|
20
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"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
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
|
@@ -24,32 +24,40 @@ module.exports = {
|
|
|
24
24
|
'block-scoped-var': 1,
|
|
25
25
|
'block-spacing': 'error',
|
|
26
26
|
'brace-style': ['error', 'stroustrup'],
|
|
27
|
-
|
|
27
|
+
camelcase: 'error',
|
|
28
28
|
'comma-dangle': ['error', 'never'],
|
|
29
|
-
'comma-spacing': ['error', {
|
|
30
|
-
|
|
29
|
+
'comma-spacing': ['error', { before: false, after: true }],
|
|
30
|
+
complexity: ['error', complexityThreshold],
|
|
31
31
|
'computed-property-spacing': ['error', 'never'],
|
|
32
|
-
|
|
32
|
+
curly: 'error',
|
|
33
33
|
'default-case': 'error',
|
|
34
34
|
'default-case-last': 'error',
|
|
35
35
|
'default-param-last': 'error',
|
|
36
36
|
'eol-last': ['error', 'always'],
|
|
37
|
-
|
|
37
|
+
eqeqeq: ['error', 'always'],
|
|
38
38
|
'func-call-spacing': ['error', 'never'],
|
|
39
39
|
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
40
|
-
|
|
40
|
+
indent: ['error', tabSpaces, { SwitchCase: 1 }],
|
|
41
41
|
'key-spacing': 'error',
|
|
42
|
-
'keyword-spacing': ['error', {
|
|
42
|
+
'keyword-spacing': ['error', { before: true, after: true }],
|
|
43
43
|
'linebreak-style': ['error', 'unix'],
|
|
44
44
|
'lines-between-class-members': ['error', 'always'],
|
|
45
|
-
'max-depth': ['error', {
|
|
45
|
+
'max-depth': ['error', { max: nestedThreshold }],
|
|
46
46
|
'max-lines': ['error', maxLinesThreshold],
|
|
47
|
-
'max-lines-per-function': [
|
|
48
|
-
|
|
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 }],
|
|
49
56
|
'new-parens': 'error',
|
|
50
57
|
'no-alert': 'error',
|
|
51
58
|
'no-array-constructor': 'error',
|
|
52
59
|
'no-console': 'off',
|
|
60
|
+
'no-constant-binary-expression': 'error',
|
|
53
61
|
'no-constructor-return': 'error',
|
|
54
62
|
'no-div-regex': 'error',
|
|
55
63
|
'no-duplicate-imports': 'error',
|
|
@@ -64,7 +72,7 @@ module.exports = {
|
|
|
64
72
|
'no-lone-blocks': 'error',
|
|
65
73
|
'no-lonely-if': 'error',
|
|
66
74
|
'no-loop-func': 'error',
|
|
67
|
-
'no-magic-numbers': ['error', {
|
|
75
|
+
'no-magic-numbers': ['error', { ignore: [-1, 0, 1] }],
|
|
68
76
|
'no-mixed-spaces-and-tabs': 'error',
|
|
69
77
|
'no-multi-assign': 'error',
|
|
70
78
|
'no-multi-spaces': 'error',
|
|
@@ -75,13 +83,13 @@ module.exports = {
|
|
|
75
83
|
'no-new-func': 'error',
|
|
76
84
|
'no-new-object': 'error',
|
|
77
85
|
'no-new-wrappers': 'error',
|
|
78
|
-
'no-param-reassign': ['error', {
|
|
86
|
+
'no-param-reassign': ['error', { props: false }],
|
|
79
87
|
'no-promise-executor-return': 'error',
|
|
80
88
|
'no-return-assign': 'error',
|
|
81
89
|
'no-return-await': 'error',
|
|
82
90
|
'no-script-url': 'error',
|
|
83
91
|
'no-self-compare': 'error',
|
|
84
|
-
'no-sequences': ['error', {
|
|
92
|
+
'no-sequences': ['error', { allowInParentheses: false }],
|
|
85
93
|
'no-shadow': 'error',
|
|
86
94
|
'no-template-curly-in-string': 'error',
|
|
87
95
|
'no-throw-literal': 'error',
|
|
@@ -89,7 +97,7 @@ module.exports = {
|
|
|
89
97
|
'no-underscore-dangle': 'error',
|
|
90
98
|
'no-unneeded-ternary': 'error',
|
|
91
99
|
'no-unreachable-loop': 'error',
|
|
92
|
-
'no-use-before-define': ['error', {
|
|
100
|
+
'no-use-before-define': ['error', { functions: false }],
|
|
93
101
|
'no-useless-concat': 'error',
|
|
94
102
|
'no-useless-constructor': 'error',
|
|
95
103
|
'no-useless-return': 'error',
|
|
@@ -101,29 +109,32 @@ module.exports = {
|
|
|
101
109
|
'operator-assignment': 'error',
|
|
102
110
|
'padded-blocks': ['error', 'never'],
|
|
103
111
|
'prefer-const': 'error',
|
|
104
|
-
'prefer-destructuring': ['error', {
|
|
112
|
+
'prefer-destructuring': ['error', { array: true, object: true }],
|
|
105
113
|
'prefer-object-spread': ['error'],
|
|
106
114
|
'prefer-promise-reject-errors': 'error',
|
|
107
115
|
'prefer-regex-literals': 'error',
|
|
108
116
|
'prefer-rest-params': 'error',
|
|
109
117
|
'prefer-spread': 'error',
|
|
110
118
|
'prefer-template': 'error',
|
|
111
|
-
|
|
119
|
+
quotes: ['error', 'single'],
|
|
112
120
|
'require-await': 'error',
|
|
113
121
|
'rest-spread-spacing': 'error',
|
|
114
122
|
'semi-spacing': 'error',
|
|
115
|
-
|
|
123
|
+
semi: ['error', 'always'],
|
|
116
124
|
'space-before-blocks': ['error', 'always'],
|
|
117
|
-
'space-before-function-paren': [
|
|
118
|
-
'
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
'space-before-function-paren': [
|
|
126
|
+
'error',
|
|
127
|
+
{
|
|
128
|
+
anonymous: 'always',
|
|
129
|
+
named: 'never',
|
|
130
|
+
asyncArrow: 'always'
|
|
131
|
+
}
|
|
132
|
+
],
|
|
122
133
|
'space-in-parens': ['error', 'never'],
|
|
123
134
|
'spaced-comment': ['error', 'always'],
|
|
124
|
-
|
|
135
|
+
strict: 'error',
|
|
125
136
|
'template-curly-spacing': 'error',
|
|
126
137
|
'wrap-iife': 'error',
|
|
127
|
-
|
|
138
|
+
yoda: 'error'
|
|
128
139
|
}
|
|
129
140
|
};
|
package/jest-config.js
CHANGED
|
@@ -4,38 +4,64 @@ module.exports = {
|
|
|
4
4
|
env: {
|
|
5
5
|
jest: true
|
|
6
6
|
},
|
|
7
|
-
extends: ['plugin:jest/recommended'],
|
|
8
7
|
plugins: ['jest'],
|
|
9
8
|
rules: {
|
|
10
|
-
'jest/consistent-test-it': [
|
|
9
|
+
'jest/consistent-test-it': [
|
|
10
|
+
'error',
|
|
11
|
+
{ fn: 'it', withinDescribe: 'it' }
|
|
12
|
+
],
|
|
11
13
|
'jest/expect-expect': 'error',
|
|
14
|
+
'jest/max-expects': ['error', { max: 5 }],
|
|
12
15
|
'jest/max-nested-describe': 'error',
|
|
13
16
|
'jest/no-alias-methods': 'error',
|
|
14
17
|
'jest/no-commented-out-tests': 'error',
|
|
18
|
+
'jest/no-conditional-expect': 'error',
|
|
19
|
+
'jest/no-conditional-in-test': 'error',
|
|
20
|
+
'jest/no-deprecated-functions': 'error',
|
|
15
21
|
'jest/no-disabled-tests': 'error',
|
|
22
|
+
'jest/no-done-callback': 'error',
|
|
16
23
|
'jest/no-duplicate-hooks': 'error',
|
|
17
|
-
'jest/no-
|
|
24
|
+
'jest/no-export': 'error',
|
|
25
|
+
'jest/no-focused-tests': 'error',
|
|
26
|
+
'jest/no-hooks': 'off',
|
|
27
|
+
'jest/no-identical-title': 'error',
|
|
28
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
29
|
+
'jest/no-jasmine-globals': 'error',
|
|
30
|
+
'jest/no-jest-import': 'error',
|
|
31
|
+
'jest/no-large-snapshots': 'off',
|
|
32
|
+
'jest/no-mocks-import': 'error',
|
|
18
33
|
'jest/no-restricted-matchers': [
|
|
19
34
|
'error',
|
|
20
35
|
{
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
toBeTruthy: 'Avoid `toBeTruthy`',
|
|
37
|
+
toBeFalsy: 'Avoid `toBeFalsy`'
|
|
23
38
|
}
|
|
24
39
|
],
|
|
40
|
+
'jest/no-standalone-expect': 'error',
|
|
41
|
+
'jest/no-test-prefixes': 'error',
|
|
42
|
+
'jest/no-test-return-statement': 'error',
|
|
25
43
|
'jest/prefer-called-with': 'error',
|
|
26
44
|
'jest/prefer-comparison-matcher': 'error',
|
|
27
45
|
'jest/prefer-equality-matcher': 'error',
|
|
28
46
|
'jest/prefer-expect-assertions': 'error',
|
|
29
47
|
'jest/prefer-expect-resolves': 'error',
|
|
48
|
+
'jest/prefer-hooks-in-order': 'error',
|
|
49
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
30
50
|
'jest/prefer-lowercase-title': 'error',
|
|
31
|
-
'jest/prefer-
|
|
51
|
+
'jest/prefer-mock-promise-shorthand': 'error',
|
|
52
|
+
'jest/prefer-snapshot-hint': 'error',
|
|
32
53
|
'jest/prefer-spy-on': 'error',
|
|
33
54
|
'jest/prefer-strict-equal': 'error',
|
|
34
55
|
'jest/prefer-to-be': 'error',
|
|
35
56
|
'jest/prefer-to-contain': 'error',
|
|
36
57
|
'jest/prefer-to-have-length': 'error',
|
|
37
58
|
'jest/prefer-todo': 'error',
|
|
59
|
+
'jest/require-hook': 'error',
|
|
60
|
+
'jest/require-to-throw-message': 'error',
|
|
38
61
|
'jest/require-top-level-describe': 'error',
|
|
39
|
-
'jest/
|
|
62
|
+
'jest/valid-describe-callback': 'error',
|
|
63
|
+
'jest/valid-expect': 'error',
|
|
64
|
+
'jest/valid-expect-in-promise': 'error',
|
|
65
|
+
'jest/valid-title': 'error'
|
|
40
66
|
}
|
|
41
67
|
};
|
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": "16.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",
|
|
@@ -20,7 +23,7 @@
|
|
|
20
23
|
"author": "Aaron Goldenthal <npm@aarongoldenthal.com>",
|
|
21
24
|
"license": "MIT",
|
|
22
25
|
"engines": {
|
|
23
|
-
"node": "^
|
|
26
|
+
"node": "^14.15.0 || ^16.13.0 || >=18.0.0"
|
|
24
27
|
},
|
|
25
28
|
"files": [
|
|
26
29
|
"index.js",
|
|
@@ -31,19 +34,21 @@
|
|
|
31
34
|
},
|
|
32
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.8.7",
|
|
39
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
36
40
|
"eslint-plugin-node": "^11.1.0",
|
|
37
|
-
"eslint-plugin-sonarjs": "^0.
|
|
38
|
-
"eslint-plugin-unicorn": "^
|
|
41
|
+
"eslint-plugin-sonarjs": "^0.15.0",
|
|
42
|
+
"eslint-plugin-unicorn": "^43.0.2"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"eslint": "^8.
|
|
42
|
-
"jest": "^
|
|
43
|
-
"jest-junit": "^
|
|
44
|
-
"markdownlint-cli": "^0.
|
|
45
|
+
"eslint": "^8.22.0",
|
|
46
|
+
"jest": "^28.1.3",
|
|
47
|
+
"jest-junit": "^14.0.0",
|
|
48
|
+
"markdownlint-cli": "^0.32.2",
|
|
49
|
+
"prettier": "^2.7.1"
|
|
45
50
|
},
|
|
46
51
|
"peerDependencies": {
|
|
47
|
-
"eslint": "^8.0
|
|
52
|
+
"eslint": "^8.14.0"
|
|
48
53
|
}
|
|
49
54
|
}
|
package/unicorn-config.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = {
|
|
|
13
13
|
'unicorn/escape-case': 'error',
|
|
14
14
|
'unicorn/expiring-todo-comments': 'off',
|
|
15
15
|
'unicorn/explicit-length-check': 'error',
|
|
16
|
-
'unicorn/filename-case': ['error', {
|
|
16
|
+
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
|
17
17
|
'unicorn/import-style': 'off',
|
|
18
18
|
'unicorn/new-for-builtins': 'error',
|
|
19
19
|
'unicorn/no-abusive-eslint-disable': 'error',
|
|
@@ -68,10 +68,12 @@ module.exports = {
|
|
|
68
68
|
'unicorn/prefer-dom-node-dataset': 'error',
|
|
69
69
|
'unicorn/prefer-dom-node-remove': 'error',
|
|
70
70
|
'unicorn/prefer-dom-node-text-content': 'error',
|
|
71
|
+
'unicorn/prefer-event-target': 'off',
|
|
71
72
|
'unicorn/prefer-export-from': 'off',
|
|
72
73
|
'unicorn/prefer-includes': 'error',
|
|
73
74
|
'unicorn/prefer-json-parse-buffer': 'off',
|
|
74
75
|
'unicorn/prefer-keyboard-event-key': 'error',
|
|
76
|
+
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
|
75
77
|
'unicorn/prefer-math-trunc': 'off',
|
|
76
78
|
'unicorn/prefer-modern-dom-apis': 'error',
|
|
77
79
|
'unicorn/prefer-modern-math-apis': 'error',
|
|
@@ -98,11 +100,11 @@ module.exports = {
|
|
|
98
100
|
'unicorn/prevent-abbreviations': [
|
|
99
101
|
'error',
|
|
100
102
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
allowList: {
|
|
104
|
+
args: true,
|
|
105
|
+
env: true,
|
|
106
|
+
i: true,
|
|
107
|
+
pkg: true
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
],
|