linter-bundle 2.10.1 → 2.11.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 +17 -2
- package/eslint/index.js +1 -1
- package/helper/validate-package-overrides.js +62 -0
- package/lint.js +18 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,22 @@ 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.11.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [2.11.0] - 2020.03.12
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Ensures that the ["overrides"](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) and ["resolutions"](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) configuration in the `package.json` is up-to-date for linter dependencies, to prevent errors with unknown
|
|
16
|
+
linter rules or options.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- [eslint] Updated `eslint` from `8.10.0` to `8.11.0`
|
|
21
|
+
- [eslint] Update `eslint-plugin-jsdoc` from `37.9.7` to `38.0.2`
|
|
22
|
+
- [eslint] Disabled [`unicorn/prefer-json-parse-buffer`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-json-parse-buffer.md) rule, as [TypeScript states](https://github.com/microsoft/TypeScript/issues/11842) that string needs to be used as of the ES specification.
|
|
23
|
+
|
|
24
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.10.1...v2.11.0)
|
|
10
25
|
|
|
11
26
|
## [2.10.1] - 2020.03.11
|
|
12
27
|
|
|
@@ -23,7 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
23
38
|
- [stylelint] Remove `"before-comment"` exception in `scss/dollar-variable-empty-line-after` rule
|
|
24
39
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from `5.12.1` to `5.14.0`
|
|
25
40
|
- [eslint] Updated `@typescript-eslint/parser` from `5.12.1` to `5.14.0`
|
|
26
|
-
- [eslint] Updated `eslint` from `8.9.0` to `8.10.0`
|
|
41
|
+
- [eslint] Updated `eslint` from `8.9.0` to `8.10.0`
|
|
27
42
|
- [eslint] Updated `eslint-plugin-jsdoc` from `37.9.4` to `37.9.7`
|
|
28
43
|
- [eslint] Updated `eslint-plugin-react` from `7.28.0` to `7.29.3`
|
|
29
44
|
- [stylelint] Updated `stylelint` from `14.5.2` to `14.5.3`
|
package/eslint/index.js
CHANGED
|
@@ -969,7 +969,7 @@ module.exports = {
|
|
|
969
969
|
'unicorn/prefer-dom-node-text-content': 'error',
|
|
970
970
|
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
|
|
971
971
|
'unicorn/prefer-includes': 'error',
|
|
972
|
-
'unicorn/prefer-json-parse-buffer': '
|
|
972
|
+
'unicorn/prefer-json-parse-buffer': 'off', // TypeScript states that string needs to be used as of the ES specification. @see https://github.com/microsoft/TypeScript/issues/11842
|
|
973
973
|
'unicorn/prefer-keyboard-event-key': 'error',
|
|
974
974
|
'unicorn/prefer-math-trunc': 'error',
|
|
975
975
|
'unicorn/prefer-modern-dom-apis': 'error',
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Ensures that the "overrides" and "resolutions" of the project where linter-bundle is used, match to the versions used in the linter-bundle itself.
|
|
3
|
+
*
|
|
4
|
+
* @see https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
|
|
5
|
+
* @see https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
/** @typedef {{ name: string; configuredVersion: string; expectedVersion: string; }} Dependency */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Detects outdated "overrides"/"resolutions" dependencies.
|
|
15
|
+
*
|
|
16
|
+
* @returns {{ overrides: Dependency[]; resolutions: Dependency[]; }} Either the input array, or an empty array, if the input array is not an array.
|
|
17
|
+
*/
|
|
18
|
+
function validatePackageOverrides () {
|
|
19
|
+
const linterBundleDependencies = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')).dependencies;
|
|
20
|
+
const projectPackageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
|
|
21
|
+
|
|
22
|
+
const overrides = [];
|
|
23
|
+
const resolutions = [];
|
|
24
|
+
|
|
25
|
+
if (typeof projectPackageJson.overrides === 'object' && projectPackageJson.overrides !== null) {
|
|
26
|
+
for (const [name, version] of Object.entries(projectPackageJson.overrides)) {
|
|
27
|
+
if (!(name in linterBundleDependencies)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (version !== linterBundleDependencies[name]) {
|
|
32
|
+
overrides.push({
|
|
33
|
+
name,
|
|
34
|
+
configuredVersion: version,
|
|
35
|
+
expectedVersion: linterBundleDependencies[name]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof projectPackageJson.resolutions === 'object' && projectPackageJson.resolutions !== null) {
|
|
42
|
+
for (const [name, version] of Object.entries(projectPackageJson.resolutions)) {
|
|
43
|
+
if (!(name in linterBundleDependencies)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (version !== linterBundleDependencies[name]) {
|
|
48
|
+
resolutions.push({
|
|
49
|
+
name,
|
|
50
|
+
configuredVersion: version,
|
|
51
|
+
expectedVersion: linterBundleDependencies[name]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return { overrides, resolutions };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
validatePackageOverrides
|
|
62
|
+
};
|
package/lint.js
CHANGED
|
@@ -11,6 +11,8 @@ const tty = require('tty');
|
|
|
11
11
|
|
|
12
12
|
const micromatch = require('micromatch');
|
|
13
13
|
|
|
14
|
+
const { validatePackageOverrides } = require('./helper/validate-package-overrides.js');
|
|
15
|
+
|
|
14
16
|
/** @typedef {{ taskName: string; config: Partial<Record<string, (string | true)[]>>; }} TaskNameAndConfig */
|
|
15
17
|
/** @typedef {TaskNameAndConfig & { command: string; options?: childProcess.ExecOptions; }} TaskSetup */
|
|
16
18
|
/** @typedef {{ code: number; stdout: string; stderr: string; runtime: number; }} ProcessResult */
|
|
@@ -19,6 +21,22 @@ const micromatch = require('micromatch');
|
|
|
19
21
|
const isTerminal = tty.isatty(1);
|
|
20
22
|
|
|
21
23
|
void (async () => {
|
|
24
|
+
const outdatedOverrides = validatePackageOverrides();
|
|
25
|
+
|
|
26
|
+
if (outdatedOverrides.overrides.length > 0 || outdatedOverrides.resolutions.length > 0) {
|
|
27
|
+
if (outdatedOverrides.overrides.length > 0) {
|
|
28
|
+
process.stderr.write(`Outdated "overrides" in package.json detected:\n- ${outdatedOverrides.overrides.map((dependency) => `${dependency.name}: ${dependency.configuredVersion} is configured, but ${dependency.expectedVersion} is expected`).join('\n- ')}\n\n`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (outdatedOverrides.resolutions.length > 0) {
|
|
32
|
+
process.stderr.write(`Outdated "resolutions" in package.json detected:\n- ${outdatedOverrides.overrides.map((dependency) => `${dependency.name}: ${dependency.configuredVersion} is configured, but ${dependency.expectedVersion} is expected`).join('\n- ')}\n\n`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
22
40
|
/** @type {{ diff: Promise<ProcessResult>; modified: Promise<ProcessResult>; deleted: Promise<ProcessResult>; } | undefined} */
|
|
23
41
|
let gitFilesProcessPromise;
|
|
24
42
|
/** @type {string[] | undefined} */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@typescript-eslint/eslint-plugin": "5.14.0",
|
|
43
43
|
"@typescript-eslint/parser": "5.14.0",
|
|
44
|
-
"eslint": "8.
|
|
44
|
+
"eslint": "8.11.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": "
|
|
51
|
+
"eslint-plugin-jsdoc": "38.0.2",
|
|
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",
|