linter-bundle 2.8.3 → 2.10.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 +131 -35
- package/README.md +2 -0
- package/TODO.md +5 -0
- package/eslint/index.js +3 -2
- 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,45 +6,111 @@ 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.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [2.10.0] - 2022.03.10
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [stylelint] Remove `"before-comment"` exception in `scss/dollar-variable-empty-line-after` rule
|
|
16
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from `5.12.1` to `5.14.0`
|
|
17
|
+
- [eslint] Updated `@typescript-eslint/parser` from `5.12.1` to `5.14.0`
|
|
18
|
+
- [eslint] Updated `eslint` from `8.9.0` to `8.10.0`jsx-key:
|
|
19
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from `37.9.4` to `37.9.7`
|
|
20
|
+
- [eslint] Updated `eslint-plugin-react` from `7.28.0` to `7.29.3`
|
|
21
|
+
- [stylelint] Updated `stylelint` from `14.5.2` to `14.5.3`
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- [eslint] Make use of new [`@typescript-eslint/no-redundant-type-constituents`](https://typescript-eslint.io/rules/no-redundant-type-constituents/) rule
|
|
26
|
+
- [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
|
|
27
|
+
- [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
|
|
28
|
+
- [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
|
|
29
|
+
- [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
|
|
30
|
+
|
|
31
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.9.0...v2.10.0)
|
|
32
|
+
|
|
33
|
+
## [2.9.0] - 2022.02.23
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.12.0 to v5.12.1
|
|
38
|
+
- [stylelint] Updated `stylelint` from v14.5.1 to v14.5.2
|
|
39
|
+
- [eslint] Re-activated `@typescript-eslint/no-unnecessary-type-arguments` since the false positives with `React.FunctionComponent` generics has been fixed.
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- `--timing` argument to show information how long each linting process was running.
|
|
44
|
+
- Experimental `--git` argument to only lint (ESLint, Stylelint and Markdownlint) files which have been detected as changed (compared to the upstream branch) by Git
|
|
45
|
+
|
|
46
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.4...v2.9.0)
|
|
47
|
+
|
|
48
|
+
## [2.8.4] - 2022.02.19
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- [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.
|
|
53
|
+
|
|
54
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.3...v2.8.4)
|
|
10
55
|
|
|
11
56
|
## [2.8.3] - 2022.02.19
|
|
12
57
|
|
|
13
|
-
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- [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.
|
|
14
61
|
|
|
15
62
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.2...v2.8.3)
|
|
16
63
|
|
|
17
64
|
## [2.8.2] - 2022.02.19
|
|
18
65
|
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
19
68
|
- [eslint] Disable `@typescript-eslint/no-unnecessary-type-arguments` rule, because of false positives with `React.FunctionComponent` generics
|
|
20
69
|
|
|
21
70
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.1...v2.8.2)
|
|
22
71
|
|
|
23
72
|
## [2.8.1] - 2022.02.19
|
|
24
73
|
|
|
74
|
+
### Changed
|
|
75
|
+
|
|
25
76
|
- [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.
|
|
26
77
|
|
|
27
78
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.0...v2.8.1)
|
|
28
79
|
|
|
29
80
|
## [2.8.0] - 2022.02.18
|
|
30
81
|
|
|
31
|
-
|
|
32
|
-
|
|
82
|
+
### Changed
|
|
83
|
+
|
|
84
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from v37.9.1 to v37.9.4
|
|
85
|
+
- [eslint] Updated `eslint-plugin-unicorn` from v40.1.0 to v41.0.0
|
|
86
|
+
|
|
87
|
+
### Added
|
|
88
|
+
|
|
33
89
|
- [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
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
34
93
|
- [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
|
|
35
94
|
|
|
36
95
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.7.0...v2.8.0)
|
|
37
96
|
|
|
38
97
|
## [2.7.0] - 2022.02.16
|
|
39
98
|
|
|
40
|
-
|
|
41
|
-
|
|
99
|
+
### Changed
|
|
100
|
+
|
|
101
|
+
- [eslint] Updated `eslint-plugin-jest` from v26.1.0 to v26.1.1
|
|
102
|
+
- [stylelint] Updated `stylelint` from v14.5.0 to v14.5.1
|
|
103
|
+
|
|
104
|
+
### Added
|
|
105
|
+
|
|
42
106
|
- [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
|
|
43
107
|
|
|
44
108
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.6.0...v2.7.0)
|
|
45
109
|
|
|
46
110
|
## [2.6.0] - 2022.02.14
|
|
47
111
|
|
|
112
|
+
### Changed
|
|
113
|
+
|
|
48
114
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.11.0 to v5.12.0
|
|
49
115
|
- [eslint] Updated `@typescript-eslint/parser` from v5.11.0 to v5.12.0
|
|
50
116
|
- [eslint] Updated `eslint` from v8.8.0 to v8.9.0
|
|
@@ -55,6 +121,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
55
121
|
|
|
56
122
|
## [2.5.0] - 2022.02.11
|
|
57
123
|
|
|
124
|
+
### Changed
|
|
125
|
+
|
|
58
126
|
- [eslint] Updated `eslint-plugin-jsdoc` from v37.8.1 to v37.8.2
|
|
59
127
|
- [stylelint] Updated `stylelint` from v14.4.0 to v14.5.0
|
|
60
128
|
- [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.
|
|
@@ -63,6 +131,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
63
131
|
|
|
64
132
|
## [2.4.0] - 2022.02.09
|
|
65
133
|
|
|
134
|
+
### Changed
|
|
135
|
+
|
|
66
136
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.10.1 to v5.11.0
|
|
67
137
|
- [eslint] Updated `eslint` from v8.7.0 to v8.8.0
|
|
68
138
|
- [eslint] Updated `eslint-plugin-functional` from v4.1.1 to v4.2.0
|
|
@@ -70,6 +140,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
70
140
|
- [eslint] Updated `eslint-plugin-jsdoc` from v37.7.0 to v37.8.1
|
|
71
141
|
- [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`
|
|
72
142
|
- [stylelint] Updated `stylelint` from v14.3.0 to v14.4.0
|
|
143
|
+
|
|
144
|
+
### Added
|
|
145
|
+
|
|
73
146
|
- [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
|
|
74
147
|
- [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
|
|
75
148
|
- [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
|
|
@@ -87,6 +160,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
87
160
|
- [eslint/overrides-gatsby] Ignore '@reach/router' in `import/no-unresolved` rule
|
|
88
161
|
- [eslint] Disabled `react/require-default-props`, because of false-positive for React.forwardRef wrapped functional components
|
|
89
162
|
- [eslint] Disabled `unicorn/prefer-top-level-await`, because of false-positive on environments with Node.js below v14.8
|
|
163
|
+
|
|
164
|
+
### Added
|
|
165
|
+
|
|
90
166
|
- [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
|
|
91
167
|
- [stylelint] Activate `camelCaseSvgKeywords` option of the [`value-keyword-case`](https://github.com/stylelint/stylelint/tree/main/lib/rules/value-keyword-case) rule
|
|
92
168
|
|
|
@@ -97,16 +173,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
97
173
|
### Changed
|
|
98
174
|
|
|
99
175
|
- [eslint] In the `.vscode/settings.json` the "configFile" option in "eslint.options" has been renamed to "overrideConfigFile"
|
|
176
|
+
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
|
|
177
|
+
- [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
|
|
178
|
+
- [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
|
|
179
|
+
- [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
|
|
180
|
+
- [eslint] Updated `eslint` from v8.2.0 to v8.7.0
|
|
181
|
+
- [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
|
|
182
|
+
- [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
|
|
183
|
+
- [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
|
|
184
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
|
|
185
|
+
- [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
|
|
186
|
+
- [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
|
|
187
|
+
- [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
|
|
188
|
+
- [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
|
|
189
|
+
|
|
190
|
+
### Added
|
|
191
|
+
|
|
100
192
|
- [eslint] Re-added [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) v6.5.1
|
|
101
193
|
- [eslint] Re-added [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) v6.0.0
|
|
102
194
|
- [eslint] Re-added [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) v7.28.0
|
|
103
195
|
- [stylelint] Re-added [`stylelint-declaration-block-no-ignored-properties`](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) v2.5.0
|
|
104
|
-
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
|
|
105
196
|
- [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
|
|
106
197
|
- [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
|
|
107
198
|
- [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
|
|
108
|
-
- [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
|
|
109
|
-
- [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
|
|
110
199
|
- [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
|
|
111
200
|
- [eslint] Added new [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md) rule
|
|
112
201
|
- [eslint] Added new [`jest/prefer-comparison-matcher`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md) rule
|
|
@@ -117,16 +206,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
117
206
|
- [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
|
|
118
207
|
- [eslint] Added new [`unicorn/relative-url-style`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md) rule
|
|
119
208
|
- [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
|
|
120
|
-
- [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
|
|
121
|
-
- [eslint] Updated `eslint` from v8.2.0 to v8.7.0
|
|
122
|
-
- [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
|
|
123
|
-
- [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
|
|
124
|
-
- [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
|
|
125
|
-
- [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
|
|
126
|
-
- [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
|
|
127
|
-
- [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
|
|
128
|
-
- [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
|
|
129
|
-
- [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
|
|
130
209
|
- [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
|
|
131
210
|
- [stylelint] Added new [`scss/at-use-no-unnamespaced`](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/at-use-no-unnamespaced) rule
|
|
132
211
|
- [stylelint] Added but disabled [`rule-selector-property-disallowed-list`](https://github.com/stylelint/stylelint/tree/main/lib/rules/rule-selector-property-disallowed-list) rule
|
|
@@ -151,6 +230,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
151
230
|
- [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
|
|
152
231
|
- [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
|
|
153
232
|
- [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
|
|
233
|
+
- [eslint] Removed deprecated `@typescript-eslint/no-unused-vars-experimental` rule
|
|
234
|
+
- [eslint] Removed deprecated `functional/prefer-type-literal` rule
|
|
235
|
+
- [eslint] Removed deprecated `jest/prefer-to-be-null` rule
|
|
236
|
+
- [eslint] Removed deprecated `jest/prefer-to-be-undefined` rule
|
|
237
|
+
- [stylelint] Removed deprecated `function-calc-no-invalid` rule
|
|
154
238
|
|
|
155
239
|
### Changed
|
|
156
240
|
|
|
@@ -165,16 +249,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
165
249
|
- [eslint] Updated `eslint-plugin-unicorn` from v36.0.0 to v38.0.0
|
|
166
250
|
- [eslint] Updated `eslint-import-resolver-webpack` from v0.13.1 to v0.13.2
|
|
167
251
|
- [eslint] Updated `eslint-plugin-react-hooks` from v4.2.0 to v4.2.1-alpha-13455d26d-20211104
|
|
252
|
+
- [eslint] `jest/valid-describe` as been renamed to `valid-describe-callback`
|
|
253
|
+
- [eslint] `jest/lowercase-name` as been renamed to `prefer-lowercase-title`
|
|
254
|
+
- [markdownlint] Updated `markdownlint-cli` from v0.28.1 to v0.29.0
|
|
255
|
+
- [stylelint] Updated `stylelint` from v13.13.1 to v14.0.1
|
|
256
|
+
- [stylelint] Updated `stylelint-order` from v4.1.0 to v5.0.0
|
|
257
|
+
- [stylelint] Updated `stylelint-scss` from v3.21.0 to v4.0.0
|
|
258
|
+
- [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
|
|
259
|
+
|
|
260
|
+
### Added
|
|
261
|
+
|
|
168
262
|
- [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
|
|
169
|
-
- [eslint] Removed deprecated `@typescript-eslint/no-unused-vars-experimental` rule
|
|
170
|
-
- [eslint] Removed deprecated `functional/prefer-type-literal` rule
|
|
171
|
-
- [eslint] Removed deprecated `jest/prefer-to-be-null` rule
|
|
172
|
-
- [eslint] Removed deprecated `jest/prefer-to-be-undefined` rule
|
|
173
263
|
- [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)`
|
|
174
264
|
- [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
|
|
175
265
|
- [eslint] Make use of [`jest/require-hook`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md) rule
|
|
176
|
-
- [eslint] `jest/valid-describe` as been renamed to `valid-describe-callback`
|
|
177
|
-
- [eslint] `jest/lowercase-name` as been renamed to `prefer-lowercase-title`
|
|
178
266
|
- [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
|
|
179
267
|
- [eslint] Make use of [`react/no-namespace`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-namespace.md) rule
|
|
180
268
|
- [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
|
|
@@ -182,14 +270,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
182
270
|
- [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
|
|
183
271
|
- [eslint] Make use of [unicorn/no-empty-file](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md) rule
|
|
184
272
|
- [eslint] Make use of [unicorn/prefer-export-from](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md) rule
|
|
185
|
-
- [markdownlint] Updated `markdownlint-cli` from v0.28.1 to v0.29.0
|
|
186
|
-
- [stylelint] Updated `stylelint` from v13.13.1 to v14.0.1
|
|
187
|
-
- [stylelint] Updated `stylelint-order` from v4.1.0 to v5.0.0
|
|
188
|
-
- [stylelint] Updated `stylelint-scss` from v3.21.0 to v4.0.0
|
|
189
273
|
- [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
|
|
190
274
|
- [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
|
|
191
|
-
- [stylelint] Removed deprecated `function-calc-no-invalid` rule
|
|
192
|
-
- [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
|
|
193
275
|
|
|
194
276
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.28.0...v2.0.0)
|
|
195
277
|
|
|
@@ -214,6 +296,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
214
296
|
- [eslint] Updated `eslint-plugin-jsdoc` from v36.0.8 to v36.1.0
|
|
215
297
|
- [eslint] Updated `eslint-plugin-react` from v7.25.0 to v7.25.1
|
|
216
298
|
- [eslint] Updated `eslint-plugin-unicorn`from v35.0.0 to v36.0.0
|
|
299
|
+
|
|
300
|
+
### Added
|
|
301
|
+
|
|
217
302
|
- [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
|
|
218
303
|
- [eslint] Reactivated [@typescript-eslint/dot-notation](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md) rule
|
|
219
304
|
- [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
|
|
@@ -228,6 +313,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
228
313
|
- [eslint] Updated `eslint-plugin-functional` from v3.6.0 to v3.7.0
|
|
229
314
|
- [eslint] Updated `eslint-plugin-react` from v7.24.0 to v7.25.0
|
|
230
315
|
- [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)
|
|
316
|
+
|
|
317
|
+
### Added
|
|
318
|
+
|
|
231
319
|
- [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
|
|
232
320
|
|
|
233
321
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.25.2...v1.26.0)
|
|
@@ -261,6 +349,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
261
349
|
- [eslint] Updated `eslint-plugin-import` from v2.23.4 to v2.24.1
|
|
262
350
|
- [eslint] Updated `eslint-plugin-jsdoc` from v36.0.6 to v36.0.7
|
|
263
351
|
- [eslint] Updated `eslint-plugin-unicorn` from v34.0.1 to v35.0.0
|
|
352
|
+
|
|
353
|
+
### Added
|
|
354
|
+
|
|
264
355
|
- [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
|
|
265
356
|
- [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
|
|
266
357
|
- [eslint] Make use of [`functional/prefer-tacit`](https://github.com/jonaskello/eslint-plugin-functional/blob/master/docs/rules/prefer-tacit.md) rule
|
|
@@ -276,10 +367,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
276
367
|
|
|
277
368
|
### Changed
|
|
278
369
|
|
|
279
|
-
- [stylelint] Added `overscroll-behavior` CSS property to `order/properties-order` plugin configuration after `overflow[-x/y]`
|
|
280
|
-
- [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
|
|
281
|
-
- [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
|
|
282
|
-
- [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
|
|
283
370
|
- [eslint] Updated `@typescript-eslint` from v4.26.1 to v4.28.5
|
|
284
371
|
- [eslint] Updated `eslint` from v7.28.0 to v7.31.0
|
|
285
372
|
- [eslint] Updated `eslint-plugin-functional` from v3.2.1 to v3.3.0
|
|
@@ -291,6 +378,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
291
378
|
- [stylelint] Updated `stylelint-scss` from v3.19.0 to v3.20.1
|
|
292
379
|
- [stylelint] Updated `stylelint-use-logical-spec` from v3.2.0 to v3.2.2
|
|
293
380
|
|
|
381
|
+
### Added
|
|
382
|
+
|
|
383
|
+
- [stylelint] Added `overscroll-behavior` CSS property to `order/properties-order` plugin configuration after `overflow[-x/y]`
|
|
384
|
+
- [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
|
|
385
|
+
- [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
|
|
386
|
+
- [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
|
|
387
|
+
|
|
294
388
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v1.23.0...v1.24.0)
|
|
295
389
|
|
|
296
390
|
## [1.23.0] - 2021.06.14
|
|
@@ -304,6 +398,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
304
398
|
|
|
305
399
|
## [1.22.3] - 2021.06.08
|
|
306
400
|
|
|
401
|
+
### Added
|
|
402
|
+
|
|
307
403
|
- [eslint] Re-added [`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript) for configurations without `webpack.config.js`
|
|
308
404
|
|
|
309
405
|
[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',
|
|
@@ -791,7 +792,7 @@ module.exports = {
|
|
|
791
792
|
]
|
|
792
793
|
}],
|
|
793
794
|
'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
|
|
794
|
-
'import/no-unused-modules': ['
|
|
795
|
+
'import/no-unused-modules': ['off', { unusedExports: true }], // Disabled because of false-positive with `export type { ... }` + `import type { ... }`
|
|
795
796
|
'import/no-useless-path-segments': 'error',
|
|
796
797
|
'import/no-webpack-loader-syntax': 'off', // Indeed, you should avoid that, but if we do it, we have a reason for it
|
|
797
798
|
'import/order': ['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, warnDuplicates: 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.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,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
|