linter-bundle 2.8.2 → 2.9.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/CHANGELOG.md +114 -34
- package/README.md +2 -0
- package/eslint/index.js +2 -2
- package/eslint/overrides-react.js +1 -1
- package/lint.js +245 -108
- package/package.json +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -6,39 +6,89 @@ 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.9.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [2.9.0] - 2022.02.23
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.12.0 to v5.12.1
|
|
16
|
+
- [stylelint] Updated `stylelint` from v14.5.1 to v14.5.2
|
|
17
|
+
- [eslint] Re-activated `@typescript-eslint/no-unnecessary-type-arguments` since the false positives with `React.FunctionComponent` generics has been fixed.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `--timing` argument to show information how long each linting process was running.
|
|
22
|
+
- Experimental `--git` argument to only lint (ESLint, Stylelint and Markdownlint) files which have been detected as changed (compared to the upstream branch) by Git
|
|
23
|
+
|
|
24
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.4...v2.9.0)
|
|
25
|
+
|
|
26
|
+
## [2.8.4] - 2022.02.19
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- [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.
|
|
31
|
+
|
|
32
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.3...v2.8.4)
|
|
33
|
+
|
|
34
|
+
## [2.8.3] - 2022.02.19
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- [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.
|
|
39
|
+
|
|
40
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.2...v2.8.3)
|
|
10
41
|
|
|
11
42
|
## [2.8.2] - 2022.02.19
|
|
12
43
|
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
13
46
|
- [eslint] Disable `@typescript-eslint/no-unnecessary-type-arguments` rule, because of false positives with `React.FunctionComponent` generics
|
|
14
47
|
|
|
15
48
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.1...v2.8.2)
|
|
16
49
|
|
|
17
50
|
## [2.8.1] - 2022.02.19
|
|
18
51
|
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
19
54
|
- [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.
|
|
20
55
|
|
|
21
56
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.0...v2.8.1)
|
|
22
57
|
|
|
23
58
|
## [2.8.0] - 2022.02.18
|
|
24
59
|
|
|
25
|
-
|
|
26
|
-
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from v37.9.1 to v37.9.4
|
|
63
|
+
- [eslint] Updated `eslint-plugin-unicorn` from v40.1.0 to v41.0.0
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
27
67
|
- [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
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
28
71
|
- [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
|
|
29
72
|
|
|
30
73
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.7.0...v2.8.0)
|
|
31
74
|
|
|
32
75
|
## [2.7.0] - 2022.02.16
|
|
33
76
|
|
|
34
|
-
|
|
35
|
-
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- [eslint] Updated `eslint-plugin-jest` from v26.1.0 to v26.1.1
|
|
80
|
+
- [stylelint] Updated `stylelint` from v14.5.0 to v14.5.1
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
36
84
|
- [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
|
|
37
85
|
|
|
38
86
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.6.0...v2.7.0)
|
|
39
87
|
|
|
40
88
|
## [2.6.0] - 2022.02.14
|
|
41
89
|
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
42
92
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.11.0 to v5.12.0
|
|
43
93
|
- [eslint] Updated `@typescript-eslint/parser` from v5.11.0 to v5.12.0
|
|
44
94
|
- [eslint] Updated `eslint` from v8.8.0 to v8.9.0
|
|
@@ -49,6 +99,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
49
99
|
|
|
50
100
|
## [2.5.0] - 2022.02.11
|
|
51
101
|
|
|
102
|
+
### Changed
|
|
103
|
+
|
|
52
104
|
- [eslint] Updated `eslint-plugin-jsdoc` from v37.8.1 to v37.8.2
|
|
53
105
|
- [stylelint] Updated `stylelint` from v14.4.0 to v14.5.0
|
|
54
106
|
- [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.
|
|
@@ -57,6 +109,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
57
109
|
|
|
58
110
|
## [2.4.0] - 2022.02.09
|
|
59
111
|
|
|
112
|
+
### Changed
|
|
113
|
+
|
|
60
114
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.10.1 to v5.11.0
|
|
61
115
|
- [eslint] Updated `eslint` from v8.7.0 to v8.8.0
|
|
62
116
|
- [eslint] Updated `eslint-plugin-functional` from v4.1.1 to v4.2.0
|
|
@@ -64,6 +118,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
64
118
|
- [eslint] Updated `eslint-plugin-jsdoc` from v37.7.0 to v37.8.1
|
|
65
119
|
- [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`
|
|
66
120
|
- [stylelint] Updated `stylelint` from v14.3.0 to v14.4.0
|
|
121
|
+
|
|
122
|
+
### Added
|
|
123
|
+
|
|
67
124
|
- [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
|
|
68
125
|
- [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
|
|
69
126
|
- [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
|
|
@@ -81,6 +138,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
81
138
|
- [eslint/overrides-gatsby] Ignore '@reach/router' in `import/no-unresolved` rule
|
|
82
139
|
- [eslint] Disabled `react/require-default-props`, because of false-positive for React.forwardRef wrapped functional components
|
|
83
140
|
- [eslint] Disabled `unicorn/prefer-top-level-await`, because of false-positive on environments with Node.js below v14.8
|
|
141
|
+
|
|
142
|
+
### Added
|
|
143
|
+
|
|
84
144
|
- [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
|
|
85
145
|
- [stylelint] Activate `camelCaseSvgKeywords` option of the [`value-keyword-case`](https://github.com/stylelint/stylelint/tree/main/lib/rules/value-keyword-case) rule
|
|
86
146
|
|
|
@@ -91,16 +151,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
91
151
|
### Changed
|
|
92
152
|
|
|
93
153
|
- [eslint] In the `.vscode/settings.json` the "configFile" option in "eslint.options" has been renamed to "overrideConfigFile"
|
|
154
|
+
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
|
|
155
|
+
- [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
|
|
156
|
+
- [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
|
|
157
|
+
- [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
|
|
158
|
+
- [eslint] Updated `eslint` from v8.2.0 to v8.7.0
|
|
159
|
+
- [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
|
|
160
|
+
- [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
|
|
161
|
+
- [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
|
|
162
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
|
|
163
|
+
- [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
|
|
164
|
+
- [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
|
|
165
|
+
- [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
|
|
166
|
+
- [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
|
|
167
|
+
|
|
168
|
+
### Added
|
|
169
|
+
|
|
94
170
|
- [eslint] Re-added [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) v6.5.1
|
|
95
171
|
- [eslint] Re-added [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) v6.0.0
|
|
96
172
|
- [eslint] Re-added [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) v7.28.0
|
|
97
173
|
- [stylelint] Re-added [`stylelint-declaration-block-no-ignored-properties`](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) v2.5.0
|
|
98
|
-
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
|
|
99
174
|
- [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
|
|
100
175
|
- [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
|
|
101
176
|
- [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
|
|
102
|
-
- [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
|
|
103
|
-
- [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
|
|
104
177
|
- [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
|
|
105
178
|
- [eslint] Added new [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md) rule
|
|
106
179
|
- [eslint] Added new [`jest/prefer-comparison-matcher`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md) rule
|
|
@@ -111,16 +184,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
111
184
|
- [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
|
|
112
185
|
- [eslint] Added new [`unicorn/relative-url-style`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md) rule
|
|
113
186
|
- [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
|
|
114
|
-
- [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
|
|
115
|
-
- [eslint] Updated `eslint` from v8.2.0 to v8.7.0
|
|
116
|
-
- [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
|
|
117
|
-
- [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
|
|
118
|
-
- [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
|
|
119
|
-
- [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
|
|
120
|
-
- [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
|
|
121
|
-
- [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
|
|
122
|
-
- [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
|
|
123
|
-
- [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
|
|
124
187
|
- [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
|
|
125
188
|
- [stylelint] Added new [`scss/at-use-no-unnamespaced`](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/at-use-no-unnamespaced) rule
|
|
126
189
|
- [stylelint] Added but disabled [`rule-selector-property-disallowed-list`](https://github.com/stylelint/stylelint/tree/main/lib/rules/rule-selector-property-disallowed-list) rule
|
|
@@ -145,6 +208,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
145
208
|
- [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
|
|
146
209
|
- [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
|
|
147
210
|
- [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
|
|
211
|
+
- [eslint] Removed deprecated `@typescript-eslint/no-unused-vars-experimental` rule
|
|
212
|
+
- [eslint] Removed deprecated `functional/prefer-type-literal` rule
|
|
213
|
+
- [eslint] Removed deprecated `jest/prefer-to-be-null` rule
|
|
214
|
+
- [eslint] Removed deprecated `jest/prefer-to-be-undefined` rule
|
|
215
|
+
- [stylelint] Removed deprecated `function-calc-no-invalid` rule
|
|
148
216
|
|
|
149
217
|
### Changed
|
|
150
218
|
|
|
@@ -159,16 +227,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
159
227
|
- [eslint] Updated `eslint-plugin-unicorn` from v36.0.0 to v38.0.0
|
|
160
228
|
- [eslint] Updated `eslint-import-resolver-webpack` from v0.13.1 to v0.13.2
|
|
161
229
|
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.0 to v4.2.1-alpha-13455d26d-20211104
|
|
230
|
+
- [eslint] `jest/valid-describe` as been renamed to `valid-describe-callback`
|
|
231
|
+
- [eslint] `jest/lowercase-name` as been renamed to `prefer-lowercase-title`
|
|
232
|
+
- [markdownlint] Updated `markdownlint-cli` from v0.28.1 to v0.29.0
|
|
233
|
+
- [stylelint] Updated `stylelint` from v13.13.1 to v14.0.1
|
|
234
|
+
- [stylelint] Updated `stylelint-order` from v4.1.0 to v5.0.0
|
|
235
|
+
- [stylelint] Updated `stylelint-scss` from v3.21.0 to v4.0.0
|
|
236
|
+
- [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
|
|
237
|
+
|
|
238
|
+
### Added
|
|
239
|
+
|
|
162
240
|
- [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
|
|
163
|
-
- [eslint] Removed deprecated `@typescript-eslint/no-unused-vars-experimental` rule
|
|
164
|
-
- [eslint] Removed deprecated `functional/prefer-type-literal` rule
|
|
165
|
-
- [eslint] Removed deprecated `jest/prefer-to-be-null` rule
|
|
166
|
-
- [eslint] Removed deprecated `jest/prefer-to-be-undefined` rule
|
|
167
241
|
- [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)`
|
|
168
242
|
- [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
|
|
169
243
|
- [eslint] Make use of [`jest/require-hook`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md) rule
|
|
170
|
-
- [eslint] `jest/valid-describe` as been renamed to `valid-describe-callback`
|
|
171
|
-
- [eslint] `jest/lowercase-name` as been renamed to `prefer-lowercase-title`
|
|
172
244
|
- [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
|
|
173
245
|
- [eslint] Make use of [`react/no-namespace`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-namespace.md) rule
|
|
174
246
|
- [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
|
|
@@ -176,14 +248,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
176
248
|
- [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
|
|
177
249
|
- [eslint] Make use of [unicorn/no-empty-file](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md) rule
|
|
178
250
|
- [eslint] Make use of [unicorn/prefer-export-from](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md) rule
|
|
179
|
-
- [markdownlint] Updated `markdownlint-cli` from v0.28.1 to v0.29.0
|
|
180
|
-
- [stylelint] Updated `stylelint` from v13.13.1 to v14.0.1
|
|
181
|
-
- [stylelint] Updated `stylelint-order` from v4.1.0 to v5.0.0
|
|
182
|
-
- [stylelint] Updated `stylelint-scss` from v3.21.0 to v4.0.0
|
|
183
251
|
- [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
|
|
184
252
|
- [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
|
|
185
|
-
- [stylelint] Removed deprecated `function-calc-no-invalid` rule
|
|
186
|
-
- [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
|
|
187
253
|
|
|
188
254
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.28.0...v2.0.0)
|
|
189
255
|
|
|
@@ -208,6 +274,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
208
274
|
- [eslint] Updated `eslint-plugin-jsdoc` from v36.0.8 to v36.1.0
|
|
209
275
|
- [eslint] Updated `eslint-plugin-react` from v7.25.0 to v7.25.1
|
|
210
276
|
- [eslint] Updated `eslint-plugin-unicorn`from v35.0.0 to v36.0.0
|
|
277
|
+
|
|
278
|
+
### Added
|
|
279
|
+
|
|
211
280
|
- [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
|
|
212
281
|
- [eslint] Reactivated [@typescript-eslint/dot-notation](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md) rule
|
|
213
282
|
- [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
|
|
@@ -222,6 +291,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
222
291
|
- [eslint] Updated `eslint-plugin-functional` from v3.6.0 to v3.7.0
|
|
223
292
|
- [eslint] Updated `eslint-plugin-react` from v7.24.0 to v7.25.0
|
|
224
293
|
- [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)
|
|
294
|
+
|
|
295
|
+
### Added
|
|
296
|
+
|
|
225
297
|
- [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
|
|
226
298
|
|
|
227
299
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.25.2...v1.26.0)
|
|
@@ -255,6 +327,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
255
327
|
- [eslint] Updated `eslint-plugin-import` from v2.23.4 to v2.24.1
|
|
256
328
|
- [eslint] Updated `eslint-plugin-jsdoc` from v36.0.6 to v36.0.7
|
|
257
329
|
- [eslint] Updated `eslint-plugin-unicorn` from v34.0.1 to v35.0.0
|
|
330
|
+
|
|
331
|
+
### Added
|
|
332
|
+
|
|
258
333
|
- [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
|
|
259
334
|
- [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
|
|
260
335
|
- [eslint] Make use of [`functional/prefer-tacit`](https://github.com/jonaskello/eslint-plugin-functional/blob/master/docs/rules/prefer-tacit.md) rule
|
|
@@ -270,10 +345,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
270
345
|
|
|
271
346
|
### Changed
|
|
272
347
|
|
|
273
|
-
- [stylelint] Added `overscroll-behavior` CSS property to `order/properties-order` plugin configuration after `overflow[-x/y]`
|
|
274
|
-
- [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
|
|
275
|
-
- [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
|
|
276
|
-
- [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
|
|
277
348
|
- [eslint] Updated `@typescript-eslint` from v4.26.1 to v4.28.5
|
|
278
349
|
- [eslint] Updated `eslint` from v7.28.0 to v7.31.0
|
|
279
350
|
- [eslint] Updated `eslint-plugin-functional` from v3.2.1 to v3.3.0
|
|
@@ -285,6 +356,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
285
356
|
- [stylelint] Updated `stylelint-scss` from v3.19.0 to v3.20.1
|
|
286
357
|
- [stylelint] Updated `stylelint-use-logical-spec` from v3.2.0 to v3.2.2
|
|
287
358
|
|
|
359
|
+
### Added
|
|
360
|
+
|
|
361
|
+
- [stylelint] Added `overscroll-behavior` CSS property to `order/properties-order` plugin configuration after `overflow[-x/y]`
|
|
362
|
+
- [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
|
|
363
|
+
- [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
|
|
364
|
+
- [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
|
|
365
|
+
|
|
288
366
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.23.0...v1.24.0)
|
|
289
367
|
|
|
290
368
|
## [1.23.0] - 2021.06.14
|
|
@@ -298,6 +376,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
298
376
|
|
|
299
377
|
## [1.22.3] - 2021.06.08
|
|
300
378
|
|
|
379
|
+
### Added
|
|
380
|
+
|
|
301
381
|
- [eslint] Re-added [`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript) for configurations without `webpack.config.js`
|
|
302
382
|
|
|
303
383
|
[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/eslint/index.js
CHANGED
|
@@ -660,7 +660,7 @@ module.exports = {
|
|
|
660
660
|
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
661
661
|
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
662
662
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
663
|
-
'@typescript-eslint/no-unnecessary-type-arguments': '
|
|
663
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
664
664
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
665
665
|
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
666
666
|
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
@@ -791,7 +791,7 @@ module.exports = {
|
|
|
791
791
|
]
|
|
792
792
|
}],
|
|
793
793
|
'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
|
|
794
|
-
'import/no-unused-modules': ['
|
|
794
|
+
'import/no-unused-modules': ['off', { unusedExports: true }], // Disabled because of false-positive with `export type { ... }` + `import type { ... }`
|
|
795
795
|
'import/no-useless-path-segments': 'error',
|
|
796
796
|
'import/no-webpack-loader-syntax': 'off', // Indeed, you should avoid that, but if we do it, we have a reason for it
|
|
797
797
|
'import/order': ['error', {
|
|
@@ -91,7 +91,7 @@ module.exports = {
|
|
|
91
91
|
'react/no-unknown-property': 'error',
|
|
92
92
|
'react/no-unsafe': 'error',
|
|
93
93
|
'react/no-unstable-nested-components': 'error',
|
|
94
|
-
'react/no-unused-class-component-methods': '
|
|
94
|
+
'react/no-unused-class-component-methods': 'off', // @todo False-positives with public methods.
|
|
95
95
|
'react/no-unused-prop-types': 'error',
|
|
96
96
|
'react/no-unused-state': 'error',
|
|
97
97
|
'react/no-will-update-set-state': '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.9.0",
|
|
4
4
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "5.12.
|
|
43
|
-
"@typescript-eslint/parser": "5.12.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "5.12.1",
|
|
43
|
+
"@typescript-eslint/parser": "5.12.1",
|
|
44
44
|
"eslint": "8.9.0",
|
|
45
45
|
"eslint-import-resolver-typescript": "2.5.0",
|
|
46
46
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
@@ -56,8 +56,9 @@
|
|
|
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.2",
|
|
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
|
-
"
|
|
74
|
+
"@types/micromatch": "4.0.2",
|
|
75
|
+
"@types/node": "17.0.19",
|
|
76
|
+
"stylelint-find-new-rules": "3.0.4",
|
|
75
77
|
"typescript": "4.5.5"
|
|
76
78
|
}
|
|
77
79
|
}
|