@aarongoldenthal/eslint-config-standard 13.0.0 → 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 +19 -1
- package/index.js +34 -24
- package/jest-config.js +7 -4
- package/jsdoc-config.js +7 -7
- package/package.json +14 -9
- package/unicorn-config.js +6 -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,28 +24,35 @@ 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',
|
|
@@ -64,7 +71,7 @@ module.exports = {
|
|
|
64
71
|
'no-lone-blocks': 'error',
|
|
65
72
|
'no-lonely-if': 'error',
|
|
66
73
|
'no-loop-func': 'error',
|
|
67
|
-
'no-magic-numbers': ['error', {
|
|
74
|
+
'no-magic-numbers': ['error', { ignore: [-1, 0, 1] }],
|
|
68
75
|
'no-mixed-spaces-and-tabs': 'error',
|
|
69
76
|
'no-multi-assign': 'error',
|
|
70
77
|
'no-multi-spaces': 'error',
|
|
@@ -75,13 +82,13 @@ module.exports = {
|
|
|
75
82
|
'no-new-func': 'error',
|
|
76
83
|
'no-new-object': 'error',
|
|
77
84
|
'no-new-wrappers': 'error',
|
|
78
|
-
'no-param-reassign': ['error', {
|
|
85
|
+
'no-param-reassign': ['error', { props: false }],
|
|
79
86
|
'no-promise-executor-return': 'error',
|
|
80
87
|
'no-return-assign': 'error',
|
|
81
88
|
'no-return-await': 'error',
|
|
82
89
|
'no-script-url': 'error',
|
|
83
90
|
'no-self-compare': 'error',
|
|
84
|
-
'no-sequences': ['error', {
|
|
91
|
+
'no-sequences': ['error', { allowInParentheses: false }],
|
|
85
92
|
'no-shadow': 'error',
|
|
86
93
|
'no-template-curly-in-string': 'error',
|
|
87
94
|
'no-throw-literal': 'error',
|
|
@@ -89,7 +96,7 @@ module.exports = {
|
|
|
89
96
|
'no-underscore-dangle': 'error',
|
|
90
97
|
'no-unneeded-ternary': 'error',
|
|
91
98
|
'no-unreachable-loop': 'error',
|
|
92
|
-
'no-use-before-define': ['error', {
|
|
99
|
+
'no-use-before-define': ['error', { functions: false }],
|
|
93
100
|
'no-useless-concat': 'error',
|
|
94
101
|
'no-useless-constructor': 'error',
|
|
95
102
|
'no-useless-return': 'error',
|
|
@@ -101,29 +108,32 @@ module.exports = {
|
|
|
101
108
|
'operator-assignment': 'error',
|
|
102
109
|
'padded-blocks': ['error', 'never'],
|
|
103
110
|
'prefer-const': 'error',
|
|
104
|
-
'prefer-destructuring': ['error', {
|
|
111
|
+
'prefer-destructuring': ['error', { array: true, object: true }],
|
|
105
112
|
'prefer-object-spread': ['error'],
|
|
106
113
|
'prefer-promise-reject-errors': 'error',
|
|
107
114
|
'prefer-regex-literals': 'error',
|
|
108
115
|
'prefer-rest-params': 'error',
|
|
109
116
|
'prefer-spread': 'error',
|
|
110
117
|
'prefer-template': 'error',
|
|
111
|
-
|
|
118
|
+
quotes: ['error', 'single'],
|
|
112
119
|
'require-await': 'error',
|
|
113
120
|
'rest-spread-spacing': 'error',
|
|
114
121
|
'semi-spacing': 'error',
|
|
115
|
-
|
|
122
|
+
semi: ['error', 'always'],
|
|
116
123
|
'space-before-blocks': ['error', 'always'],
|
|
117
|
-
'space-before-function-paren': [
|
|
118
|
-
'
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
'space-before-function-paren': [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
anonymous: 'always',
|
|
128
|
+
named: 'never',
|
|
129
|
+
asyncArrow: 'always'
|
|
130
|
+
}
|
|
131
|
+
],
|
|
122
132
|
'space-in-parens': ['error', 'never'],
|
|
123
133
|
'spaced-comment': ['error', 'always'],
|
|
124
|
-
|
|
134
|
+
strict: 'error',
|
|
125
135
|
'template-curly-spacing': 'error',
|
|
126
136
|
'wrap-iife': 'error',
|
|
127
|
-
|
|
137
|
+
yoda: 'error'
|
|
128
138
|
}
|
|
129
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",
|
|
@@ -31,17 +34,19 @@
|
|
|
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.1.4",
|
|
39
|
+
"eslint-plugin-jsdoc": "^39.0.1",
|
|
36
40
|
"eslint-plugin-node": "^11.1.0",
|
|
37
41
|
"eslint-plugin-sonarjs": "^0.13.0",
|
|
38
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
|
@@ -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',
|
|
@@ -98,11 +98,11 @@ module.exports = {
|
|
|
98
98
|
'unicorn/prevent-abbreviations': [
|
|
99
99
|
'error',
|
|
100
100
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
allowList: {
|
|
102
|
+
args: true,
|
|
103
|
+
env: true,
|
|
104
|
+
i: true,
|
|
105
|
+
pkg: true
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
],
|