linter-bundle 6.3.0 → 7.1.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/.linter-bundle.js +27 -17
- package/.linter-bundle.schema.json +45 -0
- package/CHANGELOG.md +146 -3
- package/README.md +56 -63
- package/TODO.md +0 -58
- package/eslint/gatsby.mjs +95 -0
- package/eslint/index.mjs +1146 -0
- package/eslint/javascript-lazy.mjs +24 -0
- package/eslint/javascript.mjs +126 -0
- package/eslint/jest.mjs +175 -0
- package/eslint/jsdoc.mjs +103 -0
- package/eslint/react.mjs +244 -0
- package/eslint/rules/enforce-logical-expression-parens.md +31 -0
- package/eslint/rules/enforce-logical-expression-parens.mjs +39 -0
- package/eslint/rules/enforce-ternary-parens.md +29 -0
- package/eslint/rules/enforce-ternary-parens.mjs +39 -0
- package/eslint/rules/ensure-lucide-import-consistency.md +38 -0
- package/eslint/rules/ensure-lucide-import-consistency.mjs +112 -0
- package/eslint/rules/helper/is-parenthesized.mjs +40 -0
- package/eslint/rules/no-extra-spaces-in-generics.md +25 -0
- package/eslint/rules/no-extra-spaces-in-generics.mjs +55 -0
- package/eslint/rules/no-ternary-return.md +29 -0
- package/eslint/rules/no-ternary-return.mjs +50 -0
- package/eslint/rules/no-unnecessary-typeof.md +1 -1
- package/eslint/rules/{no-unnecessary-typeof.js → no-unnecessary-typeof.mjs} +14 -21
- package/eslint/rules/restricted-filenames.md +4 -4
- package/eslint/rules/{restricted-filenames.js → restricted-filenames.mjs} +7 -7
- package/eslint/storybook.mjs +42 -0
- package/eslint/type-declarations.mjs +49 -0
- package/eslint/{overrides-worker.cjs → worker.mjs} +12 -14
- package/eslint.mjs +5 -0
- package/files/index.js +3 -3
- package/helper/{ensure-type.cjs → ensure-type.mjs} +7 -6
- package/helper/get-git-files.js +1 -1
- package/helper/get-outdated-dependencies.js +4 -4
- package/helper/get-outdated-overrides.js +2 -2
- package/helper/get-stylelint-path.js +4 -3
- package/helper/is-npm-or-yarn.js +2 -2
- package/helper/linter-bundle-config.js +9 -14
- package/helper/run-process.js +6 -4
- package/lint.js +33 -24
- package/package.json +32 -29
- package/stylelint/index.mjs +1111 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/{index.cjs → index.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/{selectors.cjs → selectors.mjs} +15 -31
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/{index.cjs → index.mjs} +6 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/{index.cjs → index.mjs} +11 -13
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/{index.cjs → index.mjs} +18 -22
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/{index.cjs → index.mjs} +10 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{atRuleNameSpaceChecker.cjs → atRuleNameSpaceChecker.mjs} +4 -3
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/{index.cjs → index.mjs} +16 -30
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/{index.cjs → index.mjs} +13 -35
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/{index.cjs → index.mjs} +11 -40
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/{index.cjs → index.mjs} +10 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/{index.cjs → index.mjs} +14 -65
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/{index.cjs → index.mjs} +13 -30
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/{index.cjs → index.mjs} +14 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/{index.cjs → index.mjs} +10 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +93 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/{index.cjs → index.mjs} +11 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/{index.cjs → index.mjs} +11 -29
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/{index.cjs → index.mjs} +9 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/{index.cjs → index.mjs} +10 -23
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/{index.cjs → index.mjs} +11 -36
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/{index.cjs → index.mjs} +9 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/{index.cjs → index.mjs} +9 -25
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationBangSpaceChecker.cjs → declarationBangSpaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationColonSpaceChecker.cjs → declarationColonSpaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{findMediaOperator.cjs → findMediaOperator.mjs} +2 -2
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/{index.cjs → index.mjs} +19 -39
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/{index.cjs → index.mjs} +19 -54
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/{index.cjs → index.mjs} +21 -68
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/{index.cjs → index.mjs} +16 -31
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceChecker.cjs → functionCommaSpaceChecker.mjs} +8 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceFix.cjs → functionCommaSpaceFix.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/{index.cjs → index.mjs} +39 -64
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/{index.cjs → index.mjs} +15 -44
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/{index.cjs → index.mjs} +10 -49
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/{index.cjs → index.mjs} +10 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/{index.cjs → index.mjs} +9 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/{index.cjs → index.mjs} +8 -21
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaFeatureColonSpaceChecker.cjs → mediaFeatureColonSpaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaQueryListCommaWhitespaceChecker.cjs → mediaQueryListCommaWhitespaceChecker.mjs} +6 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/{index.cjs → index.mjs} +6 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/{index.cjs → index.mjs} +13 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/{index.cjs → index.mjs} +10 -33
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/{index.cjs → index.mjs} +7 -13
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/{index.cjs → index.mjs} +13 -31
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/{index.cjs → index.mjs} +9 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/{index.cjs → index.mjs} +10 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/{index.cjs → index.mjs} +9 -36
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/{index.cjs → index.mjs} +9 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/{index.cjs → index.mjs} +9 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/{index.cjs → index.mjs} +10 -21
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/{index.cjs → index.mjs} +10 -24
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/{index.cjs → index.mjs} +12 -35
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/{index.cjs → index.mjs} +10 -15
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorAttributeOperatorSpaceChecker.cjs → selectorAttributeOperatorSpaceChecker.mjs} +6 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorCombinatorSpaceChecker.cjs → selectorCombinatorSpaceChecker.mjs} +12 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorListCommaWhitespaceChecker.cjs → selectorListCommaWhitespaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/{index.cjs → index.mjs} +43 -65
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/{index.cjs → index.mjs} +5 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/{index.cjs → index.mjs} +17 -34
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/{index.cjs → index.mjs} +11 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/{index.cjs → index.mjs} +12 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{valueListCommaWhitespaceChecker.cjs → valueListCommaWhitespaceChecker.mjs} +6 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/{index.cjs → index.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{addEmptyLineAfter.cjs → addEmptyLineAfter.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{hasEmptyBlock.cjs → hasEmptyBlock.mjs} +2 -2
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{nextNonCommentNode.cjs → nextNonCommentNode.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{removeEmptyLinesAfter.cjs → removeEmptyLinesAfter.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/transformSelector.mjs +19 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{whitespaceChecker.cjs → whitespaceChecker.mjs} +5 -5
- package/stylelint/plugins/stylelint-selector-no-empty.js +2 -0
- package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +2 -2
- package/stylelint.mjs +6 -0
- package/eslint/index.cjs +0 -1071
- package/eslint/overrides-gatsby.cjs +0 -108
- package/eslint/overrides-javascript-lazy.cjs +0 -27
- package/eslint/overrides-javascript.cjs +0 -121
- package/eslint/overrides-jest.cjs +0 -144
- package/eslint/overrides-jsdoc.cjs +0 -94
- package/eslint/overrides-react.cjs +0 -220
- package/eslint/overrides-storybook.cjs +0 -44
- package/eslint/overrides-type-declarations.cjs +0 -51
- package/eslint/rules/no-global-undefined-check.js +0 -85
- package/eslint/rules/no-global-undefined-check.md +0 -34
- package/eslint/rules/package.json +0 -8
- package/eslint.cjs +0 -5
- package/stylelint/index.cjs +0 -1104
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +0 -95
- package/stylelint.cjs +0 -5
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Settings for TypeScript type definition files.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
files: ['**/*.d.ts'],
|
|
8
|
+
rules: {
|
|
9
|
+
/**
|
|
10
|
+
* eslint
|
|
11
|
+
*
|
|
12
|
+
* @see https://eslint.org/docs/rules/
|
|
13
|
+
*/
|
|
14
|
+
'max-classes-per-file': 'off',
|
|
15
|
+
'one-var': 'off',
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* eslint-plugin-import
|
|
19
|
+
*
|
|
20
|
+
* @see https://github.com/import-js/eslint-plugin-import
|
|
21
|
+
*/
|
|
22
|
+
'import/no-default-export': 'off',
|
|
23
|
+
'import/no-unused-modules': 'off',
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* eslint-plugin-unicorn
|
|
27
|
+
*
|
|
28
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
29
|
+
*/
|
|
30
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
31
|
+
cases: {
|
|
32
|
+
kebabCase: true,
|
|
33
|
+
pascalCase: true
|
|
34
|
+
}
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
files: ['**/*.scss.d.ts'],
|
|
40
|
+
rules: {
|
|
41
|
+
/**
|
|
42
|
+
* eslint
|
|
43
|
+
*
|
|
44
|
+
* @see https://eslint.org/docs/rules/
|
|
45
|
+
*/
|
|
46
|
+
'linebreak-style': 'off' // Ignore for automatically generated .scss.d.ts files, since that does not affect the project.
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
];
|
|
@@ -8,18 +8,16 @@
|
|
|
8
8
|
* export default undefined as unknown as WebpackWorker;
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'import/no-default-export': 'off'
|
|
22
|
-
}
|
|
11
|
+
export default [
|
|
12
|
+
{
|
|
13
|
+
files: ['**/*.worker.ts'],
|
|
14
|
+
rules: {
|
|
15
|
+
/**
|
|
16
|
+
* eslint-plugin-import
|
|
17
|
+
*
|
|
18
|
+
* @see https://github.com/import-js/eslint-plugin-import
|
|
19
|
+
*/
|
|
20
|
+
'import/no-default-export': 'off'
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
}
|
|
23
|
+
];
|
package/eslint.mjs
ADDED
package/files/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file Ensures that only files which match given glob patterns are part of the project.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
7
|
|
|
8
8
|
import micromatch from 'micromatch';
|
|
9
9
|
|
|
@@ -43,7 +43,7 @@ if (Array.isArray(restrictions)) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
return;
|
|
46
|
+
return undefined;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
for (const { basePath, allowed, disallowed } of restrictions) {
|
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
* @param {T} value - The value which should be checked
|
|
13
13
|
* @returns {T extends Array<any> ? T : []} Either the input array, or an empty array, if the input array is not an array
|
|
14
14
|
*/
|
|
15
|
-
function array (value) {
|
|
15
|
+
export function array (value) {
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
// @ts-expect-error -- Right now the type definition of `Array.isArray()` is incorrect since it uses `arg is any[]` instead of the correct type of `arg`.
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
// @ts-expect-error -- Right now the type definition of `Array.isArray()` is incorrect since it uses `arg is any[]` instead of the correct type of `arg`.
|
|
17
|
-
return
|
|
22
|
+
return [];
|
|
18
23
|
}
|
|
19
|
-
|
|
20
|
-
module.exports = {
|
|
21
|
-
array
|
|
22
|
-
};
|
package/helper/get-git-files.js
CHANGED
|
@@ -41,7 +41,7 @@ export async function getGitFiles () {
|
|
|
41
41
|
gitFiles = [
|
|
42
42
|
...gitProcessResult.diff.stdout.trim().split('\0'),
|
|
43
43
|
...gitProcessResult.modified.stdout.trim().split('\0')
|
|
44
|
-
].filter((file, index, self) => !deletedFiles.includes(file) && self.indexOf(file) === index);
|
|
44
|
+
].filter((file, index, self) => (!deletedFiles.includes(file) && self.indexOf(file) === index));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return gitFiles;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @see https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import fs from 'node:fs/promises';
|
|
9
|
+
import path from 'node:path';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
|
|
12
12
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -30,7 +30,7 @@ export async function getOutdatedDependencies () {
|
|
|
30
30
|
}
|
|
31
31
|
catch {
|
|
32
32
|
// If the file does not exist, we ignore it, because in this case it's most likely a linter-bundle-only dependency.
|
|
33
|
-
return;
|
|
33
|
+
return undefined;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (dependencyPackageJson.version !== expectedVersion) {
|
|
@@ -41,7 +41,7 @@ export async function getOutdatedDependencies () {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return;
|
|
44
|
+
return undefined;
|
|
45
45
|
}));
|
|
46
46
|
|
|
47
47
|
return /** @type {Dependency[]} */(outdatedDependencies.filter((dependency) => dependency !== undefined));
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @see https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import fs from 'node:fs/promises';
|
|
9
|
+
import path from 'node:path';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
|
|
12
12
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @file Returns the path to the Stylelint CLI script.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import fs from 'node:fs/promises';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
|
-
import
|
|
7
|
+
import path from 'node:path';
|
|
8
8
|
|
|
9
9
|
const require = createRequire(import.meta.url);
|
|
10
10
|
|
|
@@ -17,11 +17,12 @@ const require = createRequire(import.meta.url);
|
|
|
17
17
|
export async function getStylelintPath () {
|
|
18
18
|
const stylelintLibPath = path.dirname(require.resolve('stylelint'));
|
|
19
19
|
|
|
20
|
-
for
|
|
20
|
+
for (const stylelintBinPath of [
|
|
21
21
|
path.join(stylelintLibPath, '../bin/stylelint.mjs'),
|
|
22
22
|
path.join(stylelintLibPath, '../bin/stylelint.js')
|
|
23
23
|
]) {
|
|
24
24
|
try {
|
|
25
|
+
// eslint-disable-next-line no-await-in-loop -- As we return from the method on the first file which exist, we cannot run the promises in parallel.
|
|
25
26
|
const stat = await fs.stat(stylelintBinPath);
|
|
26
27
|
|
|
27
28
|
if (stat.isFile()) {
|
package/helper/is-npm-or-yarn.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file Check if the project is using npm or yarn by checking the existence of a `package-lock.json` or a `yarn.lock`.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import fs from 'node:fs/promises';
|
|
6
|
+
import path from 'node:path';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns if the project is using npm or yarn.
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file Returns the `.linter-bundle.js` configuration result.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import fs from 'node:fs/promises';
|
|
6
|
+
import path from 'node:path';
|
|
7
7
|
|
|
8
8
|
export const linterBundleConfig = (
|
|
9
9
|
await loadConfig('.linter-bundle.json') ??
|
|
@@ -23,7 +23,7 @@ async function loadConfig (fileName) {
|
|
|
23
23
|
const filePath = path.join(process.cwd(), fileName);
|
|
24
24
|
|
|
25
25
|
if (!await fs.access(filePath, fs.constants.F_OK).then(() => true).catch(() => false)) {
|
|
26
|
-
return;
|
|
26
|
+
return undefined;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
try {
|
|
@@ -33,9 +33,11 @@ async function loadConfig (fileName) {
|
|
|
33
33
|
return JSON.parse(content);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const fileUrl = new URL('file:');
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
fileUrl.pathname = filePath;
|
|
39
|
+
|
|
40
|
+
const config = await import(fileUrl.toString());
|
|
39
41
|
|
|
40
42
|
if ('default' in config) {
|
|
41
43
|
return config.default;
|
|
@@ -44,15 +46,8 @@ async function loadConfig (fileName) {
|
|
|
44
46
|
return config;
|
|
45
47
|
}
|
|
46
48
|
catch (error) {
|
|
47
|
-
process.stderr.write(`Error reading ${filePath}\n`);
|
|
48
|
-
|
|
49
|
-
if (error instanceof Error) {
|
|
50
|
-
process.stderr.write(`${error.stack}\n`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
process.stderr.write(`${error}\n`);
|
|
54
|
-
}
|
|
49
|
+
process.stderr.write(`Error reading ${filePath}\n${error}\n`);
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
return;
|
|
52
|
+
return undefined;
|
|
58
53
|
}
|
package/helper/run-process.js
CHANGED
|
@@ -28,12 +28,14 @@ export async function runProcess (command, options) {
|
|
|
28
28
|
const lintingProcess = childProcess.exec(command, {
|
|
29
29
|
...options,
|
|
30
30
|
env: {
|
|
31
|
-
// eslint-disable-next-line n/no-process-env --
|
|
31
|
+
// eslint-disable-next-line n/no-process-env -- Pass all environment variables to the child process
|
|
32
32
|
...process.env,
|
|
33
33
|
...options?.env,
|
|
34
|
-
LINTER_BUNDLE: '1'
|
|
34
|
+
LINTER_BUNDLE: '1',
|
|
35
|
+
FORCE_COLOR: 'true',
|
|
36
|
+
NODE_NO_WARNINGS: '1'
|
|
35
37
|
},
|
|
36
|
-
shell: os.userInfo().shell ?? undefined
|
|
38
|
+
shell: (os.userInfo().shell ?? undefined)
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
lintingProcess.stdout?.on('data', (/** @type {string} */data) => {
|
|
@@ -45,7 +47,7 @@ export async function runProcess (command, options) {
|
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
lintingProcess.on('exit', (code) => resolve({
|
|
48
|
-
code: code ?? 0,
|
|
50
|
+
code: (code ?? 0),
|
|
49
51
|
stdout: stdout.join(''),
|
|
50
52
|
stderr: stderr.join(''),
|
|
51
53
|
runtime: performance.now() - startTimestamp
|
package/lint.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import tty from 'node:tty';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
|
|
12
12
|
import micromatch from 'micromatch';
|
|
@@ -22,12 +22,14 @@ import { runProcess } from './helper/run-process.js';
|
|
|
22
22
|
const require = createRequire(import.meta.url);
|
|
23
23
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {'files' | 'tsc' | 'ts' | 'sass' | 'md' | 'audit'} TaskNames
|
|
27
|
+
* @typedef {Partial<Record<string, (string | boolean)[]>>} TaskConfig
|
|
28
|
+
* @typedef {import('./helper/run-process.js').ProcessResult} ProcessResult
|
|
29
|
+
* @typedef {{ taskName: TaskNames; taskConfig: TaskConfig; }} TaskNameAndConfig
|
|
30
|
+
* @typedef {TaskNameAndConfig & { command: string; options?: import('child_process').ExecOptions; }} TaskSetup
|
|
31
|
+
* @typedef {{ jobTitle: string; taskSetup: TaskSetup; job: Promise<ProcessResult>; }} Job
|
|
32
|
+
*/
|
|
31
33
|
|
|
32
34
|
const isTerminal = tty.isatty(1);
|
|
33
35
|
|
|
@@ -104,7 +106,7 @@ await (async () => {
|
|
|
104
106
|
showTimingForAllJobs = false;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
if (process.exitCode === undefined || code > process.exitCode) {
|
|
109
|
+
if (process.exitCode === undefined || code > Number.parseInt(String(process.exitCode), 10)) {
|
|
108
110
|
process.exitCode = code;
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -199,14 +201,12 @@ async function runESLintTask (taskName, taskConfig) {
|
|
|
199
201
|
`"${path.join(path.dirname(require.resolve('eslint')), '../bin/eslint.js')}"`,
|
|
200
202
|
includes,
|
|
201
203
|
newTaskConfig.exclude?.map((exclude) => `--ignore-pattern ${exclude}`).join(' '),
|
|
202
|
-
|
|
203
|
-
'--format unix',
|
|
204
|
-
`--resolve-plugins-relative-to "${dirname}"`
|
|
204
|
+
'--format unix'
|
|
205
205
|
].filter((argument) => Boolean(argument)).join(' '),
|
|
206
206
|
taskConfig: newTaskConfig,
|
|
207
207
|
options: {
|
|
208
208
|
env: {
|
|
209
|
-
TIMING: '10', // Show timing information about the 10 slowest rules
|
|
209
|
+
TIMING: (getConfigValue(taskName, taskConfig, 'timing')?.[0] ? '10' : undefined), // Show timing information about the 10 slowest rules
|
|
210
210
|
TSCONFIG: (typeof newTaskConfig.tsconfig?.[0] === 'string' ? newTaskConfig.tsconfig[0] : undefined)
|
|
211
211
|
}
|
|
212
212
|
}
|
|
@@ -253,7 +253,12 @@ async function runStylelintTask (taskName, taskConfig) {
|
|
|
253
253
|
(newTaskConfig.verbose?.[0] ? '--verbose' : undefined),
|
|
254
254
|
'--formatter unix'
|
|
255
255
|
|
|
256
|
-
].filter((argument) => Boolean(argument)).join(' ')
|
|
256
|
+
].filter((argument) => Boolean(argument)).join(' '),
|
|
257
|
+
options: {
|
|
258
|
+
env: {
|
|
259
|
+
TIMING: (getConfigValue(taskName, taskConfig, 'timing')?.[0] ? '10' : undefined) // Show timing information about the 10 slowest rules
|
|
260
|
+
}
|
|
261
|
+
}
|
|
257
262
|
});
|
|
258
263
|
}
|
|
259
264
|
|
|
@@ -312,9 +317,9 @@ async function runAuditTask (taskName, taskConfig) {
|
|
|
312
317
|
'npx',
|
|
313
318
|
'--yes',
|
|
314
319
|
'--',
|
|
315
|
-
'better-npm-audit@3.
|
|
320
|
+
'better-npm-audit@3.11.0',
|
|
316
321
|
'audit',
|
|
317
|
-
`-l ${newTaskConfig.minSeverity?.[0] ?? 'moderate'}`,
|
|
322
|
+
`-l ${(newTaskConfig.minSeverity?.[0] ?? 'moderate')}`,
|
|
318
323
|
'-p',
|
|
319
324
|
newTaskConfig.exclude?.map((exclude) => `-i ${exclude}`).join(' ')
|
|
320
325
|
].filter((argument) => Boolean(argument)).join(' ')
|
|
@@ -328,8 +333,8 @@ async function runAuditTask (taskName, taskConfig) {
|
|
|
328
333
|
'npx',
|
|
329
334
|
'--yes',
|
|
330
335
|
'--',
|
|
331
|
-
'improved-yarn-audit@3.0.
|
|
332
|
-
`--min-severity ${newTaskConfig.minSeverity?.[0] ?? 'moderate'}`,
|
|
336
|
+
'improved-yarn-audit@3.0.3',
|
|
337
|
+
`--min-severity ${(newTaskConfig.minSeverity?.[0] ?? 'moderate')}`,
|
|
333
338
|
'--fail-on-missing-exclusions',
|
|
334
339
|
'--ignore-dev-deps',
|
|
335
340
|
newTaskConfig.exclude?.map((exclude) => `--exclude ${exclude}`).join(' ')
|
|
@@ -373,7 +378,7 @@ async function validateEnvironment () {
|
|
|
373
378
|
}
|
|
374
379
|
|
|
375
380
|
const outdatedDependencies = await getOutdatedDependencies();
|
|
376
|
-
const missingOverrides = outdatedDependencies.filter(({ name }) => !(npmOrYarn === 'npm' && outdatedOverrides.overrides.some((override) => name === override.name)) && !(npmOrYarn === 'yarn' && outdatedOverrides.resolutions.some((override) => name === override.name)));
|
|
381
|
+
const missingOverrides = outdatedDependencies.filter(({ name }) => (!(npmOrYarn === 'npm' && outdatedOverrides.overrides.some((override) => name === override.name)) && !(npmOrYarn === 'yarn' && outdatedOverrides.resolutions.some((override) => name === override.name))));
|
|
377
382
|
|
|
378
383
|
if (missingOverrides.length > 0) {
|
|
379
384
|
let installCommand;
|
|
@@ -388,9 +393,9 @@ async function validateEnvironment () {
|
|
|
388
393
|
propertyName = 'overrides';
|
|
389
394
|
}
|
|
390
395
|
|
|
391
|
-
process.stderr.write(`The installed version of ${missingOverrides.length === 1 ? 'one dependency' : `${missingOverrides.length} dependencies`} does not match to the version required by the linter-bundle:\n`);
|
|
396
|
+
process.stderr.write(`The installed version of ${(missingOverrides.length === 1 ? 'one dependency' : `${missingOverrides.length} dependencies`)} does not match to the version required by the linter-bundle:\n`);
|
|
392
397
|
process.stderr.write(`- ${missingOverrides.map((dependency) => `${dependency.name}: ${dependency.configuredVersion} is installed, but ${dependency.expectedVersion} is expected`).join('\n- ')}\n\n`);
|
|
393
|
-
process.stderr.write(`This could be caused by forgetting to execute \`${installCommand}\` after changing a version number in the package.json, or by some other package shipping outdated versions of the ${missingOverrides.length === 1 ? 'dependency' : 'dependencies'}.\n`);
|
|
398
|
+
process.stderr.write(`This could be caused by forgetting to execute \`${installCommand}\` after changing a version number in the package.json, or by some other package shipping outdated versions of the ${(missingOverrides.length === 1 ? 'dependency' : 'dependencies')}.\n`);
|
|
394
399
|
process.stderr.write('If another package is causing this problem, you can fix it by adding the following entry to your package.json:\n');
|
|
395
400
|
process.stderr.write(`{\n "${propertyName}": {\n ${missingOverrides.map((dependency) => `"${dependency.name}": "${dependency.expectedVersion}"`).join(',\n ')}\n }\n}\n\n`);
|
|
396
401
|
|
|
@@ -472,7 +477,7 @@ function getTasksToRun (argv) {
|
|
|
472
477
|
async function getIncludes (taskConfig, pattern) {
|
|
473
478
|
const include = taskConfig['include'];
|
|
474
479
|
|
|
475
|
-
let includedFiles = (Array.isArray(include) && include.length > 0 ? /** @type {string[]} */(include.filter((item) => typeof item === 'string')) : undefined);
|
|
480
|
+
let includedFiles = ((Array.isArray(include) && include.length > 0) ? /** @type {string[]} */(include.filter((item) => typeof item === 'string')) : undefined);
|
|
476
481
|
|
|
477
482
|
if (taskConfig['git']?.[0]) {
|
|
478
483
|
const gitFiles = await getGitFiles();
|
|
@@ -493,7 +498,11 @@ async function getIncludes (taskConfig, pattern) {
|
|
|
493
498
|
}
|
|
494
499
|
|
|
495
500
|
if (!includedFiles) {
|
|
496
|
-
|
|
501
|
+
if (pattern) {
|
|
502
|
+
return `"${pattern}"`;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return '';
|
|
497
506
|
}
|
|
498
507
|
|
|
499
508
|
return `"${includedFiles.join('" "')}"`;
|
|
@@ -596,5 +605,5 @@ function getConfigValue (taskName, taskConfig, optionName) {
|
|
|
596
605
|
}
|
|
597
606
|
}
|
|
598
607
|
|
|
599
|
-
return;
|
|
608
|
+
return undefined;
|
|
600
609
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
6
6
|
"keywords": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lint": "lint.js"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
26
|
+
"node": "^20.9.0 || >=21.1.0"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
@@ -37,46 +37,49 @@
|
|
|
37
37
|
"preversion": "npm run check-outdated && npm run lint",
|
|
38
38
|
"postversion": "git push && git push --tags && npm publish",
|
|
39
39
|
"check-outdated": "npx --yes -- check-outdated --ignore-pre-releases",
|
|
40
|
-
"_stylelint-find-rules": "stylelint-find-new-rules ./stylelint/index.
|
|
40
|
+
"_stylelint-find-rules": "stylelint-find-new-rules ./stylelint/index.mjs",
|
|
41
41
|
"_test-stylelint": "node ./test-stylelint.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"eslint": "8.
|
|
48
|
-
"eslint-import-resolver-typescript": "3.
|
|
49
|
-
"eslint-import-resolver-webpack": "0.13.
|
|
44
|
+
"@stylistic/eslint-plugin": "4.2.0",
|
|
45
|
+
"@stylistic/eslint-plugin-jsx": "4.2.0",
|
|
46
|
+
"eslint": "9.22.0",
|
|
47
|
+
"eslint-formatter-unix": "8.40.0",
|
|
48
|
+
"eslint-import-resolver-typescript": "3.9.0",
|
|
49
|
+
"eslint-import-resolver-webpack": "0.13.10",
|
|
50
50
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
51
|
-
"eslint-plugin-functional": "
|
|
52
|
-
"eslint-plugin-import": "2.
|
|
53
|
-
"eslint-plugin-jest": "
|
|
54
|
-
"eslint-plugin-jsdoc": "
|
|
55
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
56
|
-
"eslint-plugin-n": "16.
|
|
57
|
-
"eslint-plugin-promise": "
|
|
58
|
-
"eslint-plugin-react": "7.
|
|
59
|
-
"eslint-plugin-react-hooks": "
|
|
60
|
-
"eslint-plugin-unicorn": "
|
|
61
|
-
"
|
|
62
|
-
"
|
|
51
|
+
"eslint-plugin-functional": "9.0.1",
|
|
52
|
+
"eslint-plugin-import": "2.31.0",
|
|
53
|
+
"eslint-plugin-jest": "28.11.0",
|
|
54
|
+
"eslint-plugin-jsdoc": "50.6.6",
|
|
55
|
+
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
56
|
+
"eslint-plugin-n": "17.16.2",
|
|
57
|
+
"eslint-plugin-promise": "7.2.1",
|
|
58
|
+
"eslint-plugin-react": "7.37.4",
|
|
59
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
60
|
+
"eslint-plugin-unicorn": "57.0.0",
|
|
61
|
+
"globals": "16.0.0",
|
|
62
|
+
"markdownlint-cli": "0.44.0",
|
|
63
|
+
"micromatch": "4.0.8",
|
|
63
64
|
"postcss-scss": "4.0.9",
|
|
64
|
-
"stylelint": "16.
|
|
65
|
+
"stylelint": "16.16.0",
|
|
65
66
|
"stylelint-declaration-block-no-ignored-properties": "2.8.0",
|
|
66
|
-
"stylelint-high-performance-animation": "1.
|
|
67
|
+
"stylelint-high-performance-animation": "1.11.0",
|
|
67
68
|
"stylelint-order": "6.0.4",
|
|
68
|
-
"stylelint-scss": "6.1
|
|
69
|
-
"stylelint-use-logical-spec": "5.0.1"
|
|
69
|
+
"stylelint-scss": "6.11.1",
|
|
70
|
+
"stylelint-use-logical-spec": "5.0.1",
|
|
71
|
+
"typescript-eslint": "8.26.1"
|
|
70
72
|
},
|
|
71
73
|
"peerDependencies": {
|
|
74
|
+
"@typescript-eslint/utils": "*",
|
|
72
75
|
"postcss-value-parser": "*",
|
|
73
76
|
"typescript": ">=4.0.0"
|
|
74
77
|
},
|
|
75
78
|
"devDependencies": {
|
|
76
|
-
"@types/eslint": "
|
|
77
|
-
"@types/micromatch": "4.0.
|
|
78
|
-
"@types/node": "
|
|
79
|
+
"@types/eslint": "9.6.1",
|
|
80
|
+
"@types/micromatch": "4.0.9",
|
|
81
|
+
"@types/node": "22.13.10",
|
|
79
82
|
"stylelint-find-new-rules": "5.0.0",
|
|
80
|
-
"typescript": "5.
|
|
83
|
+
"typescript": "5.8.2"
|
|
81
84
|
}
|
|
82
85
|
}
|