linter-bundle 3.3.0 → 3.4.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 +19 -1
- package/eslint/index.js +12 -4
- package/eslint/overrides-javascript-lazy.js +2 -3
- package/eslint/overrides-javascript.js +6 -0
- package/eslint/overrides-storybook.js +1 -17
- package/helper/ensure-type.js +1 -0
- package/helper/find-missing-overrides.js +1 -0
- package/helper/get-stylelint-path.js +32 -0
- package/helper/is-npm-or-yarn.js +1 -0
- package/helper/run-process.js +1 -0
- package/helper/validate-package-overrides.js +1 -0
- package/lint.js +10 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,25 @@ 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/v3.
|
|
9
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v3.4.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [3.4.0] - 2023-07-20
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [eslint] Updated `@typescript-eslint` from `6.0.0` to `6.1.0`
|
|
16
|
+
- [eslint] Updated `eslint` from `8.44.0` to `8.45.0`
|
|
17
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from `46.4.3` to `46.4.4`
|
|
18
|
+
- [eslint] Updated `eslint-plugin-unicorn` from `47.0.0` to `48.0.0`
|
|
19
|
+
- [stylelint] Updated `stylelint` from `15.10.1` to `15.10.2`
|
|
20
|
+
- [eslint] Moved `unicorn/import-style` configuration for `path` (unassigned: false, default: false, namespace: true, named: true) from `overrides-storybook` into the main configuration.
|
|
21
|
+
- [eslint/overrides-javascript] Activated [`unicorn/prefer-top-level-await`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md) rule for `*.mjs` files.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- [stylelint] Fixed `Cannot find module 'node_modules/stylelint/bin/stylelint.js'` issue, if the file is called `stylelint.mjs`
|
|
26
|
+
|
|
27
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v3.3.0...v3.4.0)
|
|
10
28
|
|
|
11
29
|
## [3.3.0] - 2023-07-13
|
|
12
30
|
|
package/eslint/index.js
CHANGED
|
@@ -941,7 +941,16 @@ module.exports = {
|
|
|
941
941
|
/([A-Za-z0-9]?[a-z0-9]+)*[A-Z]{2,4}([A-Za-z0-9]?[a-z0-9]+)*/u // Up to 4 Characters can be upper-case in a row (e.g. in `prepareDOM` or `SVGIcon`)
|
|
942
942
|
]
|
|
943
943
|
}],
|
|
944
|
-
'unicorn/import-style': 'error',
|
|
944
|
+
'unicorn/import-style': ['error', {
|
|
945
|
+
styles: {
|
|
946
|
+
path: {
|
|
947
|
+
unassigned: false,
|
|
948
|
+
default: false,
|
|
949
|
+
namespace: true,
|
|
950
|
+
named: true
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}],
|
|
945
954
|
'unicorn/new-for-builtins': 'error',
|
|
946
955
|
'unicorn/no-abusive-eslint-disable': 'error',
|
|
947
956
|
'unicorn/no-array-callback-reference': 'off', // If I use functions, they are the best option for this use-case
|
|
@@ -972,7 +981,6 @@ module.exports = {
|
|
|
972
981
|
'unicorn/no-unnecessary-await': 'error',
|
|
973
982
|
'unicorn/no-unreadable-array-destructuring': 'error',
|
|
974
983
|
'unicorn/no-unreadable-iife': 'error',
|
|
975
|
-
'unicorn/no-unsafe-regex': 'off',
|
|
976
984
|
'unicorn/no-unused-properties': 'error',
|
|
977
985
|
'unicorn/no-useless-fallback-in-spread': 'error',
|
|
978
986
|
'unicorn/no-useless-promise-resolve-reject': 'error',
|
|
@@ -1021,13 +1029,13 @@ module.exports = {
|
|
|
1021
1029
|
'unicorn/prefer-set-has': 'error',
|
|
1022
1030
|
'unicorn/prefer-set-size': 'error',
|
|
1023
1031
|
'unicorn/prefer-spread': 'off', // @todo Disabled till there a solution for the warning, that `slice()` on Typed-Arrays should be replaced (which is not possible). @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1064
|
|
1024
|
-
'unicorn/prefer-string-replace-all': 'off', // @todo Available since 2020 in browsers.
|
|
1032
|
+
'unicorn/prefer-string-replace-all': 'off', // @todo Available since 2020 in browsers. Should this be preferred?
|
|
1025
1033
|
'unicorn/prefer-string-slice': 'off', // @todo As of today (2020.08.24) and since the last 9 years, substr() is three times faster than slice() in Firefox.
|
|
1026
1034
|
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
1027
1035
|
'unicorn/prefer-string-trim-start-end': 'error',
|
|
1028
1036
|
'unicorn/prefer-switch': 'error',
|
|
1029
1037
|
'unicorn/prefer-ternary': 'off', // We prefer readability over saving a few chars
|
|
1030
|
-
'unicorn/prefer-top-level-await': 'off', // @todo
|
|
1038
|
+
'unicorn/prefer-top-level-await': 'off', // @todo Available since 2021. Activate in 2024
|
|
1031
1039
|
'unicorn/prefer-regexp-test': 'error',
|
|
1032
1040
|
'unicorn/prefer-type-error': 'error',
|
|
1033
1041
|
'unicorn/prevent-abbreviations': ['error', { ignore: ['args', 'i', 'j', 'i18n', 'ref', 'Ref', 'params', 'props', 'Props'] }],
|
|
@@ -7,11 +7,10 @@ const overridesJavaScript = require('./overrides-javascript');
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
...overridesJavaScript,
|
|
9
9
|
overrides: [
|
|
10
|
+
...overridesJavaScript.overrides,
|
|
10
11
|
{
|
|
11
|
-
|
|
12
|
+
files: ['*.js', '*.cjs', '*.mjs'],
|
|
12
13
|
rules: {
|
|
13
|
-
...overridesJavaScript.overrides[0].rules,
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* typescript-eslint
|
|
17
16
|
*
|
|
@@ -103,6 +103,12 @@ module.exports = {
|
|
|
103
103
|
'unicorn/prevent-abbreviations': ['error', { ignore: ['args', 'dev', 'env', 'i', 'j', 'i18n', 'pkg', 'ref', 'Ref', 'req', 'res', 'setupDevServerMiddleware'] }],
|
|
104
104
|
'unicorn/text-encoding-identifier-case': 'off'
|
|
105
105
|
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
files: ['*.mjs'],
|
|
109
|
+
rules: {
|
|
110
|
+
'unicorn/prefer-top-level-await': 'error'
|
|
111
|
+
}
|
|
106
112
|
}
|
|
107
113
|
]
|
|
108
114
|
};
|
|
@@ -23,23 +23,7 @@ module.exports = {
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://github.com/import-js/eslint-plugin-import
|
|
25
25
|
*/
|
|
26
|
-
'import/no-nodejs-modules': 'off'
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* eslint-plugin-unicorn
|
|
30
|
-
*
|
|
31
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
32
|
-
*/
|
|
33
|
-
'unicorn/import-style': ['error', {
|
|
34
|
-
styles: {
|
|
35
|
-
path: {
|
|
36
|
-
unassigned: false,
|
|
37
|
-
default: false,
|
|
38
|
-
namespace: true,
|
|
39
|
-
named: true
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}]
|
|
26
|
+
'import/no-nodejs-modules': 'off'
|
|
43
27
|
}
|
|
44
28
|
},
|
|
45
29
|
{
|
package/helper/ensure-type.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures that the input `value` is an array, otherwise an empty array is returned.
|
|
7
7
|
*
|
|
8
|
+
* @public
|
|
8
9
|
* @template T
|
|
9
10
|
* @param {T} value - The value which should be checked.
|
|
10
11
|
* @returns {T extends Array<any> ? T : []} Either the input array, or an empty array, if the input array is not an array.
|
|
@@ -13,6 +13,7 @@ const path = require('path');
|
|
|
13
13
|
/**
|
|
14
14
|
* Detects if installed versions of dependencies don't match to the required dependencies.
|
|
15
15
|
*
|
|
16
|
+
* @public
|
|
16
17
|
* @returns {Dependency[]} An array of missing overrides (=wrong versions).
|
|
17
18
|
*/
|
|
18
19
|
function findMissingOverrides () {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Returns the path to the Stylelint CLI script.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns if the project is using npm or yarn.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
* @returns {string | null} Return the path to the Stylelint CLI script, or `null` if it can't be found.
|
|
13
|
+
*/
|
|
14
|
+
function getStylelintPath () {
|
|
15
|
+
const stylelintLibPath = path.dirname(require.resolve('stylelint'));
|
|
16
|
+
|
|
17
|
+
for (const stylelintBinPath of [
|
|
18
|
+
path.join(stylelintLibPath, '../bin/stylelint.mjs'),
|
|
19
|
+
path.join(stylelintLibPath, '../bin/stylelint.js')
|
|
20
|
+
]) {
|
|
21
|
+
if (fs.existsSync(stylelintBinPath)) {
|
|
22
|
+
return stylelintBinPath;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
getStylelintPath
|
|
31
|
+
};
|
|
32
|
+
|
package/helper/is-npm-or-yarn.js
CHANGED
package/helper/run-process.js
CHANGED
|
@@ -9,6 +9,7 @@ const childProcess = require('child_process');
|
|
|
9
9
|
/**
|
|
10
10
|
* Executes a process asynchronously.
|
|
11
11
|
*
|
|
12
|
+
* @public
|
|
12
13
|
* @param {string} command - The process to execute.
|
|
13
14
|
* @param {childProcess.ExecOptions | undefined} [options] - The options of the `childProcess.exec()` method.
|
|
14
15
|
* @returns {Promise<ProcessResult>} An object containing the result of the process execution
|
|
@@ -13,6 +13,7 @@ const path = require('path');
|
|
|
13
13
|
/**
|
|
14
14
|
* Detects outdated "overrides"/"resolutions" dependencies.
|
|
15
15
|
*
|
|
16
|
+
* @public
|
|
16
17
|
* @returns {{ overrides: Dependency[]; resolutions: Dependency[]; }} Either the input array, or an empty array, if the input array is not an array.
|
|
17
18
|
*/
|
|
18
19
|
function validatePackageOverrides () {
|
package/lint.js
CHANGED
|
@@ -10,6 +10,7 @@ const tty = require('tty');
|
|
|
10
10
|
const micromatch = require('micromatch');
|
|
11
11
|
|
|
12
12
|
const { findMissingOverrides } = require('./helper/find-missing-overrides.js');
|
|
13
|
+
const { getStylelintPath } = require('./helper/get-stylelint-path.js');
|
|
13
14
|
const { isNpmOrYarn } = require('./helper/is-npm-or-yarn.js');
|
|
14
15
|
const { runProcess } = require('./helper/run-process.js');
|
|
15
16
|
const { validatePackageOverrides } = require('./helper/validate-package-overrides.js');
|
|
@@ -115,10 +116,18 @@ void (async () => {
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
const stylelintBinPath = getStylelintPath();
|
|
120
|
+
|
|
121
|
+
if (stylelintBinPath === null) {
|
|
122
|
+
return generateDummyJobOutput(taskName, config, {
|
|
123
|
+
stderr: 'Stylelint CLI script not found.'
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
118
127
|
return runTask({
|
|
119
128
|
taskName,
|
|
120
129
|
config,
|
|
121
|
-
command: `node "${
|
|
130
|
+
command: `node "${stylelintBinPath}" ${includes} --formatter unix`
|
|
122
131
|
});
|
|
123
132
|
}
|
|
124
133
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -36,31 +36,31 @@
|
|
|
36
36
|
"preversion": "npm run check-outdated && npm run lint",
|
|
37
37
|
"postversion": "git push && git push --tags && npm publish",
|
|
38
38
|
"stylelint-find-rules": "stylelint-find-new-rules ./stylelint/index.js",
|
|
39
|
-
"validate-stylelint-options": "node ./validate-stylelint-options",
|
|
39
|
+
"validate-stylelint-options": "node ./validate-stylelint-options.mjs",
|
|
40
40
|
"check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
44
|
-
"@typescript-eslint/parser": "6.
|
|
45
|
-
"@typescript-eslint/utils": "6.
|
|
46
|
-
"eslint": "8.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "6.1.0",
|
|
44
|
+
"@typescript-eslint/parser": "6.1.0",
|
|
45
|
+
"@typescript-eslint/utils": "6.1.0",
|
|
46
|
+
"eslint": "8.45.0",
|
|
47
47
|
"eslint-import-resolver-typescript": "3.5.5",
|
|
48
48
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
49
49
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
50
50
|
"eslint-plugin-functional": "5.0.8",
|
|
51
51
|
"eslint-plugin-import": "2.27.5",
|
|
52
52
|
"eslint-plugin-jest": "27.2.3",
|
|
53
|
-
"eslint-plugin-jsdoc": "46.4.
|
|
53
|
+
"eslint-plugin-jsdoc": "46.4.4",
|
|
54
54
|
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
55
55
|
"eslint-plugin-n": "16.0.1",
|
|
56
56
|
"eslint-plugin-promise": "6.1.1",
|
|
57
57
|
"eslint-plugin-react": "7.32.2",
|
|
58
58
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
59
|
-
"eslint-plugin-unicorn": "
|
|
59
|
+
"eslint-plugin-unicorn": "48.0.0",
|
|
60
60
|
"markdownlint-cli": "0.35.0",
|
|
61
61
|
"micromatch": "4.0.5",
|
|
62
62
|
"postcss-scss": "4.0.6",
|
|
63
|
-
"stylelint": "15.10.
|
|
63
|
+
"stylelint": "15.10.2",
|
|
64
64
|
"stylelint-declaration-block-no-ignored-properties": "2.7.0",
|
|
65
65
|
"stylelint-order": "6.0.3",
|
|
66
66
|
"stylelint-scss": "5.0.1",
|