linter-bundle 2.8.4 → 2.10.1
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/CHANGELOG.md +133 -35
- package/README.md +2 -0
- package/TODO.md +5 -0
- package/eslint/index.js +2 -1
- package/eslint/overrides-react.js +3 -2
- package/lint.js +245 -108
- package/package.json +14 -12
- package/stylelint/index.js +1 -1
- package/types.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,51 +6,119 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.
|
|
9
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.10.1...HEAD)
|
|
10
|
+
|
|
11
|
+
## [2.10.1] - 2020.03.11
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- [eslint/override-react] Fix naming `warnOnDuplicates` option of [`react/jsx-key`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md) rule
|
|
16
|
+
|
|
17
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.10.0...v2.10.1)
|
|
18
|
+
|
|
19
|
+
## [2.10.0] - 2022.03.10
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- [stylelint] Remove `"before-comment"` exception in `scss/dollar-variable-empty-line-after` rule
|
|
24
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from `5.12.1` to `5.14.0`
|
|
25
|
+
- [eslint] Updated `@typescript-eslint/parser` from `5.12.1` to `5.14.0`
|
|
26
|
+
- [eslint] Updated `eslint` from `8.9.0` to `8.10.0`jsx-key:
|
|
27
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from `37.9.4` to `37.9.7`
|
|
28
|
+
- [eslint] Updated `eslint-plugin-react` from `7.28.0` to `7.29.3`
|
|
29
|
+
- [stylelint] Updated `stylelint` from `14.5.2` to `14.5.3`
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- [eslint] Make use of new [`@typescript-eslint/no-redundant-type-constituents`](https://typescript-eslint.io/rules/no-redundant-type-constituents/) rule
|
|
34
|
+
- [eslint/override-react] Make use of new [`react/hook-use-state`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md) rule
|
|
35
|
+
- [eslint/override-react] Set new `propElementValues` option to "always" for [`react/jsx-curly-brace-presence`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md) rule
|
|
36
|
+
- [eslint/override-react] Make use of new [`react/iframe-missing-sandbox`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md) rule
|
|
37
|
+
- [eslint/override-react] Make use of new `warnDuplicates` option of [`react/jsx-key`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md) rule
|
|
38
|
+
|
|
39
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.9.0...v2.10.0)
|
|
40
|
+
|
|
41
|
+
## [2.9.0] - 2022.02.23
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.12.0 to v5.12.1
|
|
46
|
+
- [stylelint] Updated `stylelint` from v14.5.1 to v14.5.2
|
|
47
|
+
- [eslint] Re-activated `@typescript-eslint/no-unnecessary-type-arguments` since the false positives with `React.FunctionComponent` generics has been fixed.
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
|
|
51
|
+
- `--timing` argument to show information how long each linting process was running.
|
|
52
|
+
- Experimental `--git` argument to only lint (ESLint, Stylelint and Markdownlint) files which have been detected as changed (compared to the upstream branch) by Git
|
|
53
|
+
|
|
54
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.4...v2.9.0)
|
|
10
55
|
|
|
11
56
|
## [2.8.4] - 2022.02.19
|
|
12
57
|
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
13
60
|
- [eslint] Disabled [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md) rule, because of false positives with type exports.
|
|
14
61
|
|
|
15
62
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.3...v2.8.4)
|
|
16
63
|
|
|
17
64
|
## [2.8.3] - 2022.02.19
|
|
18
65
|
|
|
19
|
-
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- [eslint/overrides-react] Disabled [`react/no-unused-class-component-methods`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md) rule, because of false positives with public methods.
|
|
20
69
|
|
|
21
70
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.2...v2.8.3)
|
|
22
71
|
|
|
23
72
|
## [2.8.2] - 2022.02.19
|
|
24
73
|
|
|
74
|
+
### Changed
|
|
75
|
+
|
|
25
76
|
- [eslint] Disable `@typescript-eslint/no-unnecessary-type-arguments` rule, because of false positives with `React.FunctionComponent` generics
|
|
26
77
|
|
|
27
78
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.1...v2.8.2)
|
|
28
79
|
|
|
29
80
|
## [2.8.1] - 2022.02.19
|
|
30
81
|
|
|
82
|
+
### Changed
|
|
83
|
+
|
|
31
84
|
- [eslint/overrides-javascript] Use [`unicorn/text-encoding-identifier-case`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md) rule, only in JavaScript files.
|
|
32
85
|
|
|
33
86
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.0...v2.8.1)
|
|
34
87
|
|
|
35
88
|
## [2.8.0] - 2022.02.18
|
|
36
89
|
|
|
37
|
-
|
|
38
|
-
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
92
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from v37.9.1 to v37.9.4
|
|
93
|
+
- [eslint] Updated `eslint-plugin-unicorn` from v40.1.0 to v41.0.0
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
39
97
|
- [eslint] Make use of new [`unicorn/text-encoding-identifier-case`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md) rule
|
|
98
|
+
|
|
99
|
+
### Fixed
|
|
100
|
+
|
|
40
101
|
- [stylelint] Fixed disabling of [`function-no-unknown`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-no-unknown/README.md) rule, because of false positives
|
|
41
102
|
|
|
42
103
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.7.0...v2.8.0)
|
|
43
104
|
|
|
44
105
|
## [2.7.0] - 2022.02.16
|
|
45
106
|
|
|
46
|
-
|
|
47
|
-
|
|
107
|
+
### Changed
|
|
108
|
+
|
|
109
|
+
- [eslint] Updated `eslint-plugin-jest` from v26.1.0 to v26.1.1
|
|
110
|
+
- [stylelint] Updated `stylelint` from v14.5.0 to v14.5.1
|
|
111
|
+
|
|
112
|
+
### Added
|
|
113
|
+
|
|
48
114
|
- [eslint] Activate `ignoreUsedVariables` option of [`unicorn/prefer-export-from`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md) rule
|
|
49
115
|
|
|
50
116
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.6.0...v2.7.0)
|
|
51
117
|
|
|
52
118
|
## [2.6.0] - 2022.02.14
|
|
53
119
|
|
|
120
|
+
### Changed
|
|
121
|
+
|
|
54
122
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.11.0 to v5.12.0
|
|
55
123
|
- [eslint] Updated `@typescript-eslint/parser` from v5.11.0 to v5.12.0
|
|
56
124
|
- [eslint] Updated `eslint` from v8.8.0 to v8.9.0
|
|
@@ -61,6 +129,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
61
129
|
|
|
62
130
|
## [2.5.0] - 2022.02.11
|
|
63
131
|
|
|
132
|
+
### Changed
|
|
133
|
+
|
|
64
134
|
- [eslint] Updated `eslint-plugin-jsdoc` from v37.8.1 to v37.8.2
|
|
65
135
|
- [stylelint] Updated `stylelint` from v14.4.0 to v14.5.0
|
|
66
136
|
- [eslint/overrides-gatsby] Disabled `unusedExports` and enabled `missingExports` for the [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md) rule, for `src/pages/*.tsx` files.
|
|
@@ -69,6 +139,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
69
139
|
|
|
70
140
|
## [2.4.0] - 2022.02.09
|
|
71
141
|
|
|
142
|
+
### Changed
|
|
143
|
+
|
|
72
144
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.10.1 to v5.11.0
|
|
73
145
|
- [eslint] Updated `eslint` from v8.7.0 to v8.8.0
|
|
74
146
|
- [eslint] Updated `eslint-plugin-functional` from v4.1.1 to v4.2.0
|
|
@@ -76,6 +148,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
76
148
|
- [eslint] Updated `eslint-plugin-jsdoc` from v37.7.0 to v37.8.1
|
|
77
149
|
- [markdownlint] Updated `markdownlint-cli` from v0.30.0 to v0.31.1, which adds the new rules `MD049` and `MD050` for consistent emphasis/strong style, and improves the rules `MD007`/`MD010`/`MD032`/`MD033`/`MD035`/`MD037`/`MD039`
|
|
78
150
|
- [stylelint] Updated `stylelint` from v14.3.0 to v14.4.0
|
|
151
|
+
|
|
152
|
+
### Added
|
|
153
|
+
|
|
79
154
|
- [eslint] Activated `unusedExports` option of the [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md) rule
|
|
80
155
|
- [eslint] Activate [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
|
|
81
156
|
- [eslint/react] Add React class methods (`componentDidMount`, `render` etc.) to the allowed names in the [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
|
|
@@ -93,6 +168,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
93
168
|
- [eslint/overrides-gatsby] Ignore '@reach/router' in `import/no-unresolved` rule
|
|
94
169
|
- [eslint] Disabled `react/require-default-props`, because of false-positive for React.forwardRef wrapped functional components
|
|
95
170
|
- [eslint] Disabled `unicorn/prefer-top-level-await`, because of false-positive on environments with Node.js below v14.8
|
|
171
|
+
|
|
172
|
+
### Added
|
|
173
|
+
|
|
96
174
|
- [eslint] Activated `allowThrowingUnknown` option of the [`@typescript-eslint/no-throw-literal`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md) rule
|
|
97
175
|
- [stylelint] Activate `camelCaseSvgKeywords` option of the [`value-keyword-case`](https://github.com/stylelint/stylelint/tree/main/lib/rules/value-keyword-case) rule
|
|
98
176
|
|
|
@@ -103,16 +181,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
103
181
|
### Changed
|
|
104
182
|
|
|
105
183
|
- [eslint] In the `.vscode/settings.json` the "configFile" option in "eslint.options" has been renamed to "overrideConfigFile"
|
|
184
|
+
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
|
|
185
|
+
- [eslint] Disabled [`unicorn/prefer-object-has-own`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-has-own.md) for now, because of limited engine support
|
|
186
|
+
- [eslint] Disabled `allowThrowingAny` and `allowThrowingUnknown` of the [`@typescript-eslint/no-throw-literal`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md) rule
|
|
187
|
+
- [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
|
|
188
|
+
- [eslint] Updated `eslint` from v8.2.0 to v8.7.0
|
|
189
|
+
- [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
|
|
190
|
+
- [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
|
|
191
|
+
- [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
|
|
192
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
|
|
193
|
+
- [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
|
|
194
|
+
- [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
|
|
195
|
+
- [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
|
|
196
|
+
- [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
|
|
197
|
+
|
|
198
|
+
### Added
|
|
199
|
+
|
|
106
200
|
- [eslint] Re-added [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) v6.5.1
|
|
107
201
|
- [eslint] Re-added [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) v6.0.0
|
|
108
202
|
- [eslint] Re-added [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) v7.28.0
|
|
109
203
|
- [stylelint] Re-added [`stylelint-declaration-block-no-ignored-properties`](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) v2.5.0
|
|
110
|
-
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
|
|
111
204
|
- [eslint] Re-added [`react/no-invalid-html-attribute`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md) rule
|
|
112
205
|
- [eslint] Re-added [`react/no-arrow-function-lifecycle`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md) rule
|
|
113
206
|
- [eslint] Re-added [`react/no-unused-class-component-methods`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md) rule
|
|
114
|
-
- [eslint] Disabled [`unicorn/prefer-object-has-own`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-has-own.md) for now, because of limited engine support
|
|
115
|
-
- [eslint] Disabled `allowThrowingAny` and `allowThrowingUnknown` of the [`@typescript-eslint/no-throw-literal`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md) rule
|
|
116
207
|
- [eslint] Reactivated [`import/no-import-module-exports`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-import-module-exports.md) rule
|
|
117
208
|
- [eslint] Added new [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md) rule
|
|
118
209
|
- [eslint] Added new [`jest/prefer-comparison-matcher`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md) rule
|
|
@@ -123,16 +214,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
123
214
|
- [eslint] Added new [`unicorn/no-useless-promise-resolve-reject`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-promise-resolve-reject.md) rule
|
|
124
215
|
- [eslint] Added new [`unicorn/relative-url-style`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md) rule
|
|
125
216
|
- [eslint] Added new [`unicorn/prefer-json-parse-buffer`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-json-parse-buffer.md) rule
|
|
126
|
-
- [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
|
|
127
|
-
- [eslint] Updated `eslint` from v8.2.0 to v8.7.0
|
|
128
|
-
- [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
|
|
129
|
-
- [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
|
|
130
|
-
- [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
|
|
131
|
-
- [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
|
|
132
|
-
- [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
|
|
133
|
-
- [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
|
|
134
|
-
- [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
|
|
135
|
-
- [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
|
|
136
217
|
- [stylelint] Added new [`scss/dollar-variable-no-namespaced-assignment`](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/dollar-variable-no-namespaced-assignment) rule
|
|
137
218
|
- [stylelint] Added new [`scss/at-use-no-unnamespaced`](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/at-use-no-unnamespaced) rule
|
|
138
219
|
- [stylelint] Added but disabled [`rule-selector-property-disallowed-list`](https://github.com/stylelint/stylelint/tree/main/lib/rules/rule-selector-property-disallowed-list) rule
|
|
@@ -157,6 +238,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
157
238
|
- [eslint] [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) has been removed, because it's relying on unmaintained dependencies, which blocks us from updating to ESLint v8
|
|
158
239
|
- [stylelint] [`stylelint-declaration-block-no-ignored-properties`](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) has been removed, because it seems not to be regularly maintained anymore, which blocks us from updating to Stylelint v14
|
|
159
240
|
- [stylelint] [`stylelint-use-nesting`](https://www.npmjs.com/package/stylelint-use-nesting) has been removed, because it seems not to be regularly maintained anymore, which blocks us from updating to Stylelint v14
|
|
241
|
+
- [eslint] Removed deprecated `@typescript-eslint/no-unused-vars-experimental` rule
|
|
242
|
+
- [eslint] Removed deprecated `functional/prefer-type-literal` rule
|
|
243
|
+
- [eslint] Removed deprecated `jest/prefer-to-be-null` rule
|
|
244
|
+
- [eslint] Removed deprecated `jest/prefer-to-be-undefined` rule
|
|
245
|
+
- [stylelint] Removed deprecated `function-calc-no-invalid` rule
|
|
160
246
|
|
|
161
247
|
### Changed
|
|
162
248
|
|
|
@@ -171,16 +257,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
171
257
|
- [eslint] Updated `eslint-plugin-unicorn` from v36.0.0 to v38.0.0
|
|
172
258
|
- [eslint] Updated `eslint-import-resolver-webpack` from v0.13.1 to v0.13.2
|
|
173
259
|
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.0 to v4.2.1-alpha-13455d26d-20211104
|
|
260
|
+
- [eslint] `jest/valid-describe` as been renamed to `valid-describe-callback`
|
|
261
|
+
- [eslint] `jest/lowercase-name` as been renamed to `prefer-lowercase-title`
|
|
262
|
+
- [markdownlint] Updated `markdownlint-cli` from v0.28.1 to v0.29.0
|
|
263
|
+
- [stylelint] Updated `stylelint` from v13.13.1 to v14.0.1
|
|
264
|
+
- [stylelint] Updated `stylelint-order` from v4.1.0 to v5.0.0
|
|
265
|
+
- [stylelint] Updated `stylelint-scss` from v3.21.0 to v4.0.0
|
|
266
|
+
- [stylelint] Forked [`stylelint-selector-tag-no-without-class`](https://www.npmjs.com/package/stylelint-selector-tag-no-without-class), because it seems not to be regularly maintained anymore
|
|
267
|
+
|
|
268
|
+
### Added
|
|
269
|
+
|
|
174
270
|
- [eslint] Make use of `caseSensitiveStrict` option of [`import/no-unresolved`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md) rule
|
|
175
|
-
- [eslint] Removed deprecated `@typescript-eslint/no-unused-vars-experimental` rule
|
|
176
|
-
- [eslint] Removed deprecated `functional/prefer-type-literal` rule
|
|
177
|
-
- [eslint] Removed deprecated `jest/prefer-to-be-null` rule
|
|
178
|
-
- [eslint] Removed deprecated `jest/prefer-to-be-undefined` rule
|
|
179
271
|
- [eslint] Added but disabled [`jest/prefer-expect-resolves`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-resolves.md) rule, because we prefer `expect(await promise)`
|
|
180
272
|
- [eslint] Make use of [`jest/prefer-to-be`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-be.md) rule
|
|
181
273
|
- [eslint] Make use of [`jest/require-hook`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md) rule
|
|
182
|
-
- [eslint] `jest/valid-describe` as been renamed to `valid-describe-callback`
|
|
183
|
-
- [eslint] `jest/lowercase-name` as been renamed to `prefer-lowercase-title`
|
|
184
274
|
- [eslint] Make use of [`no-unused-private-class-members`](https://github.com/eslint/eslint/blob/main/docs/rules/no-unused-private-class-members.md) rule
|
|
185
275
|
- [eslint] Make use of [`react/no-namespace`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-namespace.md) rule
|
|
186
276
|
- [eslint] Make use of [`react/jsx-max-props-per-line`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md) rule
|
|
@@ -188,14 +278,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
188
278
|
- [eslint] Make use of [`@typescript-eslint/consistent-type-exports`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-exports.md) rule
|
|
189
279
|
- [eslint] Make use of [unicorn/no-empty-file](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md) rule
|
|
190
280
|
- [eslint] Make use of [unicorn/prefer-export-from](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md) rule
|
|
191
|
-
- [markdownlint] Updated `markdownlint-cli` from v0.28.1 to v0.29.0
|
|
192
|
-
- [stylelint] Updated `stylelint` from v13.13.1 to v14.0.1
|
|
193
|
-
- [stylelint] Updated `stylelint-order` from v4.1.0 to v5.0.0
|
|
194
|
-
- [stylelint] Updated `stylelint-scss` from v3.21.0 to v4.0.0
|
|
195
281
|
- [stylelint] Added but disabled [`color-hex-alpha`](https://github.com/stylelint/stylelint/blob/main/lib/rules/color-hex-alpha/README.md) rule, because of limited browser support
|
|
196
282
|
- [stylelint] Make use of [`custom-property-no-missing-var-function`](https://github.com/stylelint/stylelint/blob/main/lib/rules/custom-property-no-missing-var-function/README.md) rule
|
|
197
|
-
- [stylelint] Removed deprecated `function-calc-no-invalid` rule
|
|
198
|
-
- [stylelint] Forked [`stylelint-selector-tag-no-without-class`](https://www.npmjs.com/package/stylelint-selector-tag-no-without-class), because it seems not to be regularly maintained anymore
|
|
199
283
|
|
|
200
284
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.28.0...v2.0.0)
|
|
201
285
|
|
|
@@ -220,6 +304,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
220
304
|
- [eslint] Updated `eslint-plugin-jsdoc` from v36.0.8 to v36.1.0
|
|
221
305
|
- [eslint] Updated `eslint-plugin-react` from v7.25.0 to v7.25.1
|
|
222
306
|
- [eslint] Updated `eslint-plugin-unicorn`from v35.0.0 to v36.0.0
|
|
307
|
+
|
|
308
|
+
### Added
|
|
309
|
+
|
|
223
310
|
- [eslint] Make use of [@typescript-eslint/no-meaningless-void-operator](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-meaningless-void-operator.md) rule
|
|
224
311
|
- [eslint] Reactivated [@typescript-eslint/dot-notation](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md) rule
|
|
225
312
|
- [eslint] Make use of [unicorn/no-useless-fallback-in-spread](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-fallback-in-spread.md) rule
|
|
@@ -234,6 +321,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
234
321
|
- [eslint] Updated `eslint-plugin-functional` from v3.6.0 to v3.7.0
|
|
235
322
|
- [eslint] Updated `eslint-plugin-react` from v7.24.0 to v7.25.0
|
|
236
323
|
- [eslint] Disabled [`functional/prefer-tacit`](https://github.com/jonaskello/eslint-plugin-functional/blob/master/docs/rules/prefer-tacit.md) because changes are recommended that could [lead to potential bugs](https://github.com/jonaskello/eslint-plugin-functional/issues/263)
|
|
324
|
+
|
|
325
|
+
### Added
|
|
326
|
+
|
|
237
327
|
- [eslint] Activated the `forms` option of the [`react/jsx-no-target-blank`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md) rule
|
|
238
328
|
|
|
239
329
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.25.2...v1.26.0)
|
|
@@ -267,6 +357,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
267
357
|
- [eslint] Updated `eslint-plugin-import` from v2.23.4 to v2.24.1
|
|
268
358
|
- [eslint] Updated `eslint-plugin-jsdoc` from v36.0.6 to v36.0.7
|
|
269
359
|
- [eslint] Updated `eslint-plugin-unicorn` from v34.0.1 to v35.0.0
|
|
360
|
+
|
|
361
|
+
### Added
|
|
362
|
+
|
|
270
363
|
- [eslint] Activated `ignoreDeclarationMerge` of [`@typescript-eslint/no-redeclare`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md) rule
|
|
271
364
|
- [eslint] Make use of [`@typescript-eslint/prefer-return-this-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-return-this-type.md) rule
|
|
272
365
|
- [eslint] Make use of [`functional/prefer-tacit`](https://github.com/jonaskello/eslint-plugin-functional/blob/master/docs/rules/prefer-tacit.md) rule
|
|
@@ -282,10 +375,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
282
375
|
|
|
283
376
|
### Changed
|
|
284
377
|
|
|
285
|
-
- [stylelint] Added `overscroll-behavior` CSS property to `order/properties-order` plugin configuration after `overflow[-x/y]`
|
|
286
|
-
- [eslint] Make use of [`unicorn/no-array-method-this-argument`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md) rule
|
|
287
|
-
- [eslint] Make use of [`unicorn/prefer-top-level-await`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md) rule
|
|
288
|
-
- [eslint] Make use of [`jest/max-nested-describe`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-nested-describe.md) rule
|
|
289
378
|
- [eslint] Updated `@typescript-eslint` from v4.26.1 to v4.28.5
|
|
290
379
|
- [eslint] Updated `eslint` from v7.28.0 to v7.31.0
|
|
291
380
|
- [eslint] Updated `eslint-plugin-functional` from v3.2.1 to v3.3.0
|
|
@@ -297,6 +386,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
297
386
|
- [stylelint] Updated `stylelint-scss` from v3.19.0 to v3.20.1
|
|
298
387
|
- [stylelint] Updated `stylelint-use-logical-spec` from v3.2.0 to v3.2.2
|
|
299
388
|
|
|
389
|
+
### Added
|
|
390
|
+
|
|
391
|
+
- [stylelint] Added `overscroll-behavior` CSS property to `order/properties-order` plugin configuration after `overflow[-x/y]`
|
|
392
|
+
- [eslint] Make use of [`unicorn/no-array-method-this-argument`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md) rule
|
|
393
|
+
- [eslint] Make use of [`unicorn/prefer-top-level-await`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md) rule
|
|
394
|
+
- [eslint] Make use of [`jest/max-nested-describe`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-nested-describe.md) rule
|
|
395
|
+
|
|
300
396
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.23.0...v1.24.0)
|
|
301
397
|
|
|
302
398
|
## [1.23.0] - 2021.06.14
|
|
@@ -310,6 +406,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
310
406
|
|
|
311
407
|
## [1.22.3] - 2021.06.08
|
|
312
408
|
|
|
409
|
+
### Added
|
|
410
|
+
|
|
313
411
|
- [eslint] Re-added [`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript) for configurations without `webpack.config.js`
|
|
314
412
|
|
|
315
413
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.22.2...v1.22.3)
|
package/README.md
CHANGED
|
@@ -234,6 +234,8 @@ Below, you can find the available command line arguments and what they are doing
|
|
|
234
234
|
Argument | Description | Example
|
|
235
235
|
-|-|-
|
|
236
236
|
`--verbose` | By default, the terminal output of linters is only shown if an error occurs. Use this option to show their terminal output even on success. | `--verbose`
|
|
237
|
+
`--timing` | Show information how long each linting process was running. | `--timing`
|
|
238
|
+
`--git` | **Experimental** Only lint (ESLint, Stylelint and Markdownlint) files which have been detected as changed (compared to the upstream branch) by Git. This can result into massive performance improvements on large code bases, but also lead to undetected issues with cross-file rules. | `--git`
|
|
237
239
|
|
|
238
240
|
### `lint tsc`
|
|
239
241
|
|
package/TODO.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @todo
|
|
2
2
|
|
|
3
|
+
- Make git diff-branch configurable
|
|
4
|
+
on GitHub Actions this could be used:
|
|
5
|
+
- run: git diff --name-only -z origin/${GITHUB_BASE_REF}
|
|
6
|
+
Is there a variable with includes origin/ already?
|
|
7
|
+
|
|
3
8
|
Some tools like Gatsby ship deprecated dependencies of eslint and @typescript-eslint.
|
|
4
9
|
Since npm installs packages alphabetically, the outdated `gatsby` dependencies are installed in the `node_modules` root, instead of the newer `linter-bundle` dependencies. Since the old versions often do not support new rules or new options, this may cause linting to fail with errors like this:
|
|
5
10
|
|
package/eslint/index.js
CHANGED
|
@@ -641,6 +641,7 @@ module.exports = {
|
|
|
641
641
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
642
642
|
'@typescript-eslint/no-parameter-properties': 'error',
|
|
643
643
|
'@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
|
|
644
|
+
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
644
645
|
'@typescript-eslint/no-require-imports': 'error',
|
|
645
646
|
'@typescript-eslint/no-shadow': 'error',
|
|
646
647
|
'@typescript-eslint/no-this-alias': 'error',
|
|
@@ -660,7 +661,7 @@ module.exports = {
|
|
|
660
661
|
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
661
662
|
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
662
663
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
663
|
-
'@typescript-eslint/no-unnecessary-type-arguments': '
|
|
664
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
664
665
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
665
666
|
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
666
667
|
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
@@ -66,6 +66,7 @@ module.exports = {
|
|
|
66
66
|
namedComponents: 'arrow-function',
|
|
67
67
|
unnamedComponents: 'arrow-function'
|
|
68
68
|
}],
|
|
69
|
+
'react/hook-use-state': 'error',
|
|
69
70
|
'react/no-access-state-in-setstate': 'error',
|
|
70
71
|
'react/no-array-index-key': 'error',
|
|
71
72
|
'react/no-arrow-function-lifecycle': 'error',
|
|
@@ -140,7 +141,7 @@ module.exports = {
|
|
|
140
141
|
'react/jsx-handler-names': 'off', // @todo There should be an option which checks if the function is used multiple times in a class (like this.closeTooltip()) - in that case, the 'handle' prefix should not be mandatory
|
|
141
142
|
'react/jsx-indent': ['error', 'tab', { checkAttributes: true, indentLogicalExpressions: true }],
|
|
142
143
|
'react/jsx-indent-props': ['error', 'tab'],
|
|
143
|
-
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true }],
|
|
144
|
+
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
|
|
144
145
|
'react/jsx-max-depth': ['error', { max: 8 }],
|
|
145
146
|
'react/jsx-max-props-per-line': ['error', { maximum: { single: 5, multi: 1 } }],
|
|
146
147
|
'react/no-adjacent-inline-elements': 'off', // @todo There is an issue if inline and block elements are mixed. Simple example: `<span>Text</span><br />` here, the space between the SPAN and BR should not be forced, because a space at the end of a line does not make sense.
|
|
@@ -155,7 +156,7 @@ module.exports = {
|
|
|
155
156
|
'react/jsx-no-undef': 'error',
|
|
156
157
|
'react/jsx-no-useless-fragment': 'error',
|
|
157
158
|
'react/jsx-one-expression-per-line': ['off', { allow: 'single-child' }], // @todo Doesn't work with something like "Text <a href="...">Link</a> More Text", which should be valid
|
|
158
|
-
'react/jsx-curly-brace-presence': 'error',
|
|
159
|
+
'react/jsx-curly-brace-presence': ['error', { propElementValues: 'always' }],
|
|
159
160
|
'react/jsx-fragments': ['error', 'element'],
|
|
160
161
|
'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
|
|
161
162
|
'react/jsx-props-no-multi-spaces': 'error',
|
package/lint.js
CHANGED
|
@@ -9,124 +9,182 @@ const fs = require('fs');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const tty = require('tty');
|
|
11
11
|
|
|
12
|
+
const micromatch = require('micromatch');
|
|
13
|
+
|
|
12
14
|
/** @typedef {{ taskName: string; config: Partial<Record<string, (string | true)[]>>; }} TaskNameAndConfig */
|
|
13
|
-
/** @typedef {TaskNameAndConfig & { command: string; options?:
|
|
14
|
-
/** @typedef {{
|
|
15
|
+
/** @typedef {TaskNameAndConfig & { command: string; options?: childProcess.ExecOptions; }} TaskSetup */
|
|
16
|
+
/** @typedef {{ code: number; stdout: string; stderr: string; runtime: number; }} ProcessResult */
|
|
17
|
+
/** @typedef {{ jobTitle: string; taskSetup: TaskSetup; job: Promise<ProcessResult>; }} Job */
|
|
15
18
|
|
|
16
19
|
const isTerminal = tty.isatty(1);
|
|
17
20
|
|
|
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
|
-
|
|
21
|
+
void (async () => {
|
|
22
|
+
/** @type {{ diff: Promise<ProcessResult>; modified: Promise<ProcessResult>; deleted: Promise<ProcessResult>; } | undefined} */
|
|
23
|
+
let gitFilesProcessPromise;
|
|
24
|
+
/** @type {string[] | undefined} */
|
|
25
|
+
let gitFiles;
|
|
26
|
+
|
|
27
|
+
/** @type {Job[]} */
|
|
28
|
+
const jobs = await Promise.all(getTasksToRun(process.argv.splice(2)).map(async ({ taskName, config }) => {
|
|
29
|
+
if (config['git']) {
|
|
30
|
+
if (!gitFilesProcessPromise) {
|
|
31
|
+
gitFilesProcessPromise = {
|
|
32
|
+
// Returns changed files, also stashed and commited
|
|
33
|
+
diff: runProcess('git diff --name-only -z @{upstream}'),
|
|
34
|
+
// Returns unstashed files (including deleted)
|
|
35
|
+
modified: runProcess('git ls-files -o -m --exclude-standard --full-name --deduplicate -z'),
|
|
36
|
+
// Returns unstashed, deleted files - @todo Is there a way to also get a list of deleted stashed/commited files?
|
|
37
|
+
deleted: runProcess('git ls-files -d --exclude-standard --full-name --deduplicate -z')
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const gitProcessResult = {
|
|
42
|
+
diff: await gitFilesProcessPromise.diff,
|
|
43
|
+
modified: await gitFilesProcessPromise.modified,
|
|
44
|
+
deleted: await gitFilesProcessPromise.deleted
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (!gitFiles) {
|
|
48
|
+
const deletedFiles = gitProcessResult.deleted.stdout.trim().split('\0');
|
|
49
|
+
|
|
50
|
+
gitFiles = [
|
|
51
|
+
...gitProcessResult.diff.stdout.trim().split('\0'),
|
|
52
|
+
...gitProcessResult.modified.stdout.trim().split('\0')
|
|
53
|
+
].filter((file, index, self) => !deletedFiles.includes(file) && self.indexOf(file) === index);
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
config
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
case 'md':
|
|
60
|
-
return runTask({
|
|
61
|
-
taskName,
|
|
62
|
-
config,
|
|
63
|
-
command: `node "${require.resolve('markdownlint-cli/markdownlint.js')}" **/*.md --ignore node_modules`
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
case 'audit':
|
|
67
|
-
if (fs.existsSync('package-lock.json')) {
|
|
57
|
+
switch (taskName) {
|
|
58
|
+
case 'tsc':
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- This is not a valid `tsc` property, so we need to remove it.
|
|
60
|
+
delete config['git'];
|
|
61
|
+
|
|
68
62
|
return runTask({
|
|
69
63
|
taskName,
|
|
70
64
|
config,
|
|
71
|
-
command: [
|
|
72
|
-
'npx',
|
|
73
|
-
'--yes',
|
|
74
|
-
'--',
|
|
75
|
-
'better-npm-audit@1.9.1',
|
|
76
|
-
'audit',
|
|
77
|
-
`-l ${config['min-severity'] ?? 'moderate'}`,
|
|
78
|
-
'-p',
|
|
79
|
-
config['exclude']?.map((exclude) => `-i ${exclude}`).join(' ')
|
|
80
|
-
].filter((argument) => Boolean(argument)).join(' ')
|
|
65
|
+
command: [`node "${require.resolve('typescript/bin/tsc')}" --skipLibCheck --noEmit`, ...(config['tsconfig']?.[0] ? [`--project ${config['tsconfig'][0]}`] : [])].join(' ')
|
|
81
66
|
});
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
|
|
68
|
+
case 'ts': {
|
|
69
|
+
const tsconfig = config['tsconfig']?.[0];
|
|
70
|
+
|
|
71
|
+
const includes = getIncludes(gitFiles, './**/*.{js,jsx,ts,tsx}', config);
|
|
72
|
+
|
|
73
|
+
if (!includes) {
|
|
74
|
+
return generateDummyJobOutput(taskName, config, {
|
|
75
|
+
stderr: 'No relevant files for ESLint changed.'
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
84
79
|
return runTask({
|
|
85
80
|
taskName,
|
|
86
|
-
config,
|
|
87
81
|
command: [
|
|
88
|
-
'
|
|
89
|
-
'
|
|
90
|
-
|
|
91
|
-
'
|
|
92
|
-
`--
|
|
93
|
-
'--
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
'node',
|
|
83
|
+
`"${path.join(path.dirname(require.resolve('eslint')), '../bin/eslint.js')}"`,
|
|
84
|
+
includes,
|
|
85
|
+
config['exclude']?.map((exclude) => `--ignore-pattern ${exclude}`).join(' '),
|
|
86
|
+
`--rulesdir "${path.resolve(__dirname, './eslint/rules/')}"`,
|
|
87
|
+
'--format unix',
|
|
88
|
+
`--resolve-plugins-relative-to "${__dirname}"`
|
|
89
|
+
].filter((argument) => Boolean(argument)).join(' '),
|
|
90
|
+
config,
|
|
91
|
+
options: {
|
|
92
|
+
env: {
|
|
93
|
+
TIMING: '10',
|
|
94
|
+
TSCONFIG: (typeof tsconfig === 'string' ? tsconfig : undefined)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
case 'sass': {
|
|
101
|
+
const includes = getIncludes(gitFiles, 'src/**/*.scss', config);
|
|
102
|
+
|
|
103
|
+
if (!includes) {
|
|
104
|
+
return generateDummyJobOutput(taskName, config, {
|
|
105
|
+
stderr: 'No relevant files for Stylelint changed.'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return runTask({
|
|
102
110
|
taskName,
|
|
103
111
|
config,
|
|
104
|
-
command: ''
|
|
105
|
-
})
|
|
106
|
-
|
|
112
|
+
command: `node "${require.resolve('stylelint/bin/stylelint.js')}" ${includes} --formatter unix`
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
case 'md': {
|
|
117
|
+
const includes = getIncludes(gitFiles, '**/*.md', config);
|
|
118
|
+
|
|
119
|
+
if (!includes) {
|
|
120
|
+
return generateDummyJobOutput(taskName, config, {
|
|
121
|
+
stderr: 'No relevant files for Markdownlint changed.'
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return runTask({
|
|
107
126
|
taskName,
|
|
108
127
|
config,
|
|
109
|
-
command: ''
|
|
110
|
-
}
|
|
111
|
-
|
|
128
|
+
command: `node "${require.resolve('markdownlint-cli/markdownlint.js')}" ${includes} --ignore node_modules`
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
case 'audit':
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- This is not a valid `audit` property, so we need to remove it.
|
|
134
|
+
delete config['git'];
|
|
135
|
+
|
|
136
|
+
if (fs.existsSync('package-lock.json')) {
|
|
137
|
+
return runTask({
|
|
138
|
+
taskName,
|
|
139
|
+
config,
|
|
140
|
+
command: [
|
|
141
|
+
'npx',
|
|
142
|
+
'--yes',
|
|
143
|
+
'--',
|
|
144
|
+
'better-npm-audit@1.9.1',
|
|
145
|
+
'audit',
|
|
146
|
+
`-l ${config['min-severity'] ?? 'moderate'}`,
|
|
147
|
+
'-p',
|
|
148
|
+
config['exclude']?.map((exclude) => `-i ${exclude}`).join(' ')
|
|
149
|
+
].filter((argument) => Boolean(argument)).join(' ')
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else if (fs.existsSync('yarn.lock')) {
|
|
153
|
+
return runTask({
|
|
154
|
+
taskName,
|
|
155
|
+
config,
|
|
156
|
+
command: [
|
|
157
|
+
'npx',
|
|
158
|
+
'--yes',
|
|
159
|
+
'--',
|
|
160
|
+
'improved-yarn-audit@2.3.3',
|
|
161
|
+
`--min-severity ${config['min-severity'] ?? 'moderate'}`,
|
|
162
|
+
'--fail-on-missing-exclusions',
|
|
163
|
+
'--ignore-dev-deps',
|
|
164
|
+
config['exclude']?.map((exclude) => `--exclude ${exclude}`).join(' ')
|
|
165
|
+
].filter((argument) => Boolean(argument)).join(' ')
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return generateDummyJobOutput(taskName, config, {
|
|
112
170
|
code: 1,
|
|
113
|
-
stdout: '',
|
|
114
171
|
stderr: 'Neither a "package-lock.json" nor a "yarn.lock" have need found.'
|
|
115
|
-
})
|
|
116
|
-
};
|
|
172
|
+
});
|
|
117
173
|
|
|
118
|
-
|
|
119
|
-
|
|
174
|
+
default:
|
|
175
|
+
}
|
|
120
176
|
|
|
121
|
-
|
|
122
|
-
});
|
|
177
|
+
throw new Error(`"${taskName}" is not a valid task.`);
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
const totalStartTimestamp = performance.now();
|
|
181
|
+
let showTimingForAllJobs = true;
|
|
123
182
|
|
|
124
|
-
void (async () => {
|
|
125
183
|
for (const { jobTitle, taskSetup, job } of jobs) {
|
|
126
184
|
process.stdout.write(jobTitle);
|
|
127
185
|
|
|
128
186
|
// eslint-disable-next-line no-await-in-loop -- Replace by `for await (const { ... } of jobs) {` as soon as Node.js supports it
|
|
129
|
-
const { code, stdout, stderr } = await job;
|
|
187
|
+
const { code, stdout, stderr, runtime } = await job;
|
|
130
188
|
|
|
131
189
|
const trimmedError = stderr.trim();
|
|
132
190
|
|
|
@@ -151,11 +209,22 @@ void (async () => {
|
|
|
151
209
|
}
|
|
152
210
|
}
|
|
153
211
|
|
|
212
|
+
if (taskSetup.config['timing']) {
|
|
213
|
+
process.stdout.write(`\nJob finished after ${((runtime) / 1000).toFixed(1)}s\n`);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
showTimingForAllJobs = false;
|
|
217
|
+
}
|
|
218
|
+
|
|
154
219
|
if (process.exitCode === undefined || code > process.exitCode) {
|
|
155
220
|
process.exitCode = code;
|
|
156
221
|
}
|
|
157
222
|
}
|
|
158
223
|
|
|
224
|
+
if (showTimingForAllJobs) {
|
|
225
|
+
process.stdout.write(`\nTask finished after ${((performance.now() - totalStartTimestamp) / 1000).toFixed(1)}s\n`);
|
|
226
|
+
}
|
|
227
|
+
|
|
159
228
|
process.stdout.write('\n');
|
|
160
229
|
})();
|
|
161
230
|
|
|
@@ -223,6 +292,30 @@ function getTasksToRun (argv) {
|
|
|
223
292
|
return tasksToRun;
|
|
224
293
|
}
|
|
225
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Returns a list of changed files, based on the Git-diff result and the glob pattern to be used in the command-line.
|
|
297
|
+
*
|
|
298
|
+
* @param {string[] | undefined} list - File list
|
|
299
|
+
* @param {string} pattern - Glob pattern
|
|
300
|
+
* @param {Partial<Record<string, (string | true)[]>>} config - Linter configuration
|
|
301
|
+
* @returns {string} Space-separated file names in double-quotes to be used in the command-line, or an empty string if no file matches.
|
|
302
|
+
*/
|
|
303
|
+
function getIncludes (list, pattern, config) {
|
|
304
|
+
const include = config['include']?.[0];
|
|
305
|
+
|
|
306
|
+
let includedFiles = [typeof include === 'string' ? include : pattern];
|
|
307
|
+
|
|
308
|
+
if (config['git'] && list) {
|
|
309
|
+
includedFiles = micromatch(list, includedFiles);
|
|
310
|
+
|
|
311
|
+
if (includedFiles.length === 0) {
|
|
312
|
+
return '';
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return `"${includedFiles.join('" "')}"`;
|
|
317
|
+
}
|
|
318
|
+
|
|
226
319
|
/**
|
|
227
320
|
* Exectues a task asynchronously.
|
|
228
321
|
*
|
|
@@ -233,30 +326,74 @@ function runTask (setup) {
|
|
|
233
326
|
return {
|
|
234
327
|
jobTitle: getJobTitle(setup),
|
|
235
328
|
taskSetup: setup,
|
|
236
|
-
job:
|
|
237
|
-
|
|
238
|
-
|
|
329
|
+
job: runProcess(setup.command, setup.options)
|
|
330
|
+
};
|
|
331
|
+
}
|
|
239
332
|
|
|
240
|
-
|
|
241
|
-
|
|
333
|
+
/**
|
|
334
|
+
* Returns a job configuration which does not run any task, but just returns the given `output`.
|
|
335
|
+
*
|
|
336
|
+
* @param {string} taskName - The name of the task.
|
|
337
|
+
* @param {Partial<Record<string, (string | true)[]>>} config - The configuratino of the task.
|
|
338
|
+
* @param {{ code?: number; stdout?: string; stderr?: string; }} output - The output which should be returned as result of the job.
|
|
339
|
+
* @returns {Job} Job
|
|
340
|
+
*/
|
|
341
|
+
function generateDummyJobOutput (taskName, config, output) {
|
|
342
|
+
return {
|
|
343
|
+
jobTitle: getJobTitle({
|
|
344
|
+
taskName,
|
|
345
|
+
config,
|
|
346
|
+
command: ''
|
|
347
|
+
}),
|
|
348
|
+
taskSetup: {
|
|
349
|
+
taskName,
|
|
350
|
+
config,
|
|
351
|
+
command: ''
|
|
352
|
+
},
|
|
353
|
+
job: Promise.resolve({
|
|
354
|
+
code: 0,
|
|
355
|
+
stdout: '',
|
|
356
|
+
stderr: '',
|
|
357
|
+
runtime: 0,
|
|
358
|
+
...output
|
|
359
|
+
})
|
|
360
|
+
};
|
|
361
|
+
}
|
|
242
362
|
|
|
243
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Exectues a process asynchronously.
|
|
365
|
+
*
|
|
366
|
+
* @param {string} command - The process to execute.
|
|
367
|
+
* @param {childProcess.ExecOptions | undefined} [options] - The options of the `childProcess.exec()` method.
|
|
368
|
+
* @returns {Promise<ProcessResult>} An object containing the result of the process execution
|
|
369
|
+
*/
|
|
370
|
+
async function runProcess (command, options) {
|
|
371
|
+
return new Promise((resolve) => {
|
|
372
|
+
const startTimestamp = performance.now();
|
|
244
373
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
374
|
+
/** @type {string[]} */
|
|
375
|
+
const stdout = [];
|
|
248
376
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
377
|
+
/** @type {string[]} */
|
|
378
|
+
const stderr = [];
|
|
252
379
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
380
|
+
const lintingProcess = childProcess.exec(command, options);
|
|
381
|
+
|
|
382
|
+
lintingProcess.stdout?.on('data', (/** @type {string} */data) => {
|
|
383
|
+
stdout.push(data);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
lintingProcess.stderr?.on('data', (/** @type {string} */data) => {
|
|
387
|
+
stderr.push(data);
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
lintingProcess.on('exit', (code) => resolve({
|
|
391
|
+
code: code ?? 0,
|
|
392
|
+
stdout: stdout.join(''),
|
|
393
|
+
stderr: stderr.join(''),
|
|
394
|
+
runtime: performance.now() - startTimestamp
|
|
395
|
+
}));
|
|
396
|
+
});
|
|
260
397
|
}
|
|
261
398
|
|
|
262
399
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -39,25 +39,26 @@
|
|
|
39
39
|
"check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
43
|
-
"@typescript-eslint/parser": "5.
|
|
44
|
-
"eslint": "8.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "5.14.0",
|
|
43
|
+
"@typescript-eslint/parser": "5.14.0",
|
|
44
|
+
"eslint": "8.10.0",
|
|
45
45
|
"eslint-import-resolver-typescript": "2.5.0",
|
|
46
46
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
47
47
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
48
48
|
"eslint-plugin-functional": "4.2.0",
|
|
49
49
|
"eslint-plugin-import": "2.25.4",
|
|
50
50
|
"eslint-plugin-jest": "26.1.1",
|
|
51
|
-
"eslint-plugin-jsdoc": "37.9.
|
|
51
|
+
"eslint-plugin-jsdoc": "37.9.7",
|
|
52
52
|
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
53
53
|
"eslint-plugin-node": "11.1.0",
|
|
54
54
|
"eslint-plugin-promise": "6.0.0",
|
|
55
|
-
"eslint-plugin-react": "7.
|
|
55
|
+
"eslint-plugin-react": "7.29.3",
|
|
56
56
|
"eslint-plugin-react-hooks": "4.3.0",
|
|
57
57
|
"eslint-plugin-unicorn": "41.0.0",
|
|
58
58
|
"markdownlint-cli": "0.31.1",
|
|
59
|
+
"micromatch": "4.0.4",
|
|
59
60
|
"postcss-scss": "4.0.3",
|
|
60
|
-
"stylelint": "14.5.
|
|
61
|
+
"stylelint": "14.5.3",
|
|
61
62
|
"stylelint-declaration-block-no-ignored-properties": "2.5.0",
|
|
62
63
|
"stylelint-order": "5.0.0",
|
|
63
64
|
"stylelint-scss": "4.1.0",
|
|
@@ -65,13 +66,14 @@
|
|
|
65
66
|
"stylelint-use-logical-spec": "3.2.2"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"
|
|
69
|
-
"
|
|
69
|
+
"postcss-value-parser": "*",
|
|
70
|
+
"typescript": "^4.0.0"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@types/eslint": "8.4.1",
|
|
73
|
-
"@types/
|
|
74
|
-
"
|
|
75
|
-
"
|
|
74
|
+
"@types/micromatch": "4.0.2",
|
|
75
|
+
"@types/node": "17.0.21",
|
|
76
|
+
"stylelint-find-new-rules": "3.0.4",
|
|
77
|
+
"typescript": "4.6.2"
|
|
76
78
|
}
|
|
77
79
|
}
|
package/stylelint/index.js
CHANGED
|
@@ -873,7 +873,7 @@ module.exports = {
|
|
|
873
873
|
'scss/dollar-variable-empty-line-after': [
|
|
874
874
|
'always',
|
|
875
875
|
{
|
|
876
|
-
except: ['last-nested', 'before-
|
|
876
|
+
except: ['last-nested', 'before-dollar-variable']
|
|
877
877
|
}
|
|
878
878
|
],
|
|
879
879
|
'scss/dollar-variable-first-in-block': [true, { ignore: ['comments', 'imports'] }],
|
package/types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @see https://stackoverflow.com/a/68452689/4449804
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/* eslint-disable @typescript-eslint/naming-convention -- We have to follow the naming conventions of the Linter rules here. */
|
|
14
|
+
|
|
13
15
|
// @ts-expect-error -- False-positive
|
|
14
16
|
declare namespace globalThis {
|
|
15
17
|
// eslint-disable-next-line no-inner-declarations, vars-on-top, no-var -- False-positives
|