linter-bundle 2.10.1 → 2.12.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 +48 -3
- package/README.md +1 -1
- package/eslint/index.js +22 -3
- package/helper/validate-package-overrides.js +62 -0
- package/lint.js +18 -0
- package/package.json +16 -16
- package/stylelint/index.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,9 +6,54 @@ 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.12.0...HEAD)
|
|
10
10
|
|
|
11
|
-
## [2.
|
|
11
|
+
## [2.12.0] - 2022.03.30
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [eslint] Updated `@typescript-eslint` from `5.14.0` to `5.17.0`
|
|
16
|
+
- [eslint] Updated `eslint` from `8.11.0` to `8.12.0`
|
|
17
|
+
- [eslint] Updated `eslint-import-resolver-typescript` from `2.5.0` to `2.7.0`
|
|
18
|
+
- [eslint] Updated `eslint-plugin-jest` from `26.1.1` to `26.1.3`
|
|
19
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from `38.0.2` to `38.1.4`
|
|
20
|
+
- [eslint] Updated `eslint-plugin-react` from `7.29.3` to `7.29.4`
|
|
21
|
+
- [eslint] Updated `eslint-plugin-react-hooks` from `4.3.0` to `4.4.0`
|
|
22
|
+
- [eslint] Updated `eslint-plugin-unicorn` from `41.0.0` to `41.0.1`
|
|
23
|
+
- [stylelint] Updated `stylelint` from `14.5.3` to `14.6.1`
|
|
24
|
+
- [stylelint] Updated `stylelint-scss` from `4.1.0` to `4.2.0`
|
|
25
|
+
- Updated `micromatch` from `4.0.4` to `4.0.5`
|
|
26
|
+
- [eslint] Make use of [`destructuredArrayIgnorePattern`](https://eslint.org/docs/rules/no-unused-vars#destructuredarrayignorepattern) of `@typescript-eslint/no-unused-vars` rule, to ignore variables with leading underscore.
|
|
27
|
+
- [stylelint] Make use of [`declaration-property-max-values`](https://stylelint.io/user-guide/rules/list/declaration-property-max-values/) rule, and set `unprefixed-property-name` to `4`
|
|
28
|
+
- [stylelint] Replace `function-no-unknown` by `scss/function-no-unknown`
|
|
29
|
+
|
|
30
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.11.1...v2.12.0)
|
|
31
|
+
|
|
32
|
+
## [2.11.1] - 2022.03.13
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- [eslint] Disabled `@typescript-eslint/no-redundant-type-constituents`, because of false positives with `Promise<... | never>`
|
|
37
|
+
- [eslint] Weaken `@typescript-eslint/naming-convention` rule to allow names with special characters for `objectLiteralProperty`.
|
|
38
|
+
|
|
39
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.11.0...v2.11.1)
|
|
40
|
+
|
|
41
|
+
## [2.11.0] - 2022.03.12
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- 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
|
|
46
|
+
linter rules or options.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- [eslint] Updated `eslint` from `8.10.0` to `8.11.0`
|
|
51
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from `37.9.7` to `38.0.2`
|
|
52
|
+
- [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.
|
|
53
|
+
|
|
54
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.10.1...v2.11.0)
|
|
55
|
+
|
|
56
|
+
## [2.10.1] - 2022.03.11
|
|
12
57
|
|
|
13
58
|
### Fixed
|
|
14
59
|
|
|
@@ -23,7 +68,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
23
68
|
- [stylelint] Remove `"before-comment"` exception in `scss/dollar-variable-empty-line-after` rule
|
|
24
69
|
- [eslint] Updated `@typescript-eslint/eslint-plugin` from `5.12.1` to `5.14.0`
|
|
25
70
|
- [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`
|
|
71
|
+
- [eslint] Updated `eslint` from `8.9.0` to `8.10.0`
|
|
27
72
|
- [eslint] Updated `eslint-plugin-jsdoc` from `37.9.4` to `37.9.7`
|
|
28
73
|
- [eslint] Updated `eslint-plugin-react` from `7.28.0` to `7.29.3`
|
|
29
74
|
- [stylelint] Updated `stylelint` from `14.5.2` to `14.5.3`
|
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ module.exports = {
|
|
|
168
168
|
Source | Description | Rules setup
|
|
169
169
|
-|-|-
|
|
170
170
|
`linter-bundle/eslint` | General rule setup. This is also the base for the following **overrides**. | [View](./eslint/index.js)
|
|
171
|
-
`linter-bundle/eslint/overrides-gatsby` | Settings for Gatsby-based projects. | [View](./eslint/overrides-gatsby)
|
|
171
|
+
`linter-bundle/eslint/overrides-gatsby` | Settings for Gatsby-based projects. | [View](./eslint/overrides-gatsby.js)
|
|
172
172
|
`linter-bundle/eslint/overrides-javascript` | Strict settings for JavaScript files, which enforces correct types everywhere. | [View](./eslint/overrides-javascript.js)
|
|
173
173
|
`linter-bundle/eslint/overrides-javascript-lazy` | Can be used instead of `overrides-javascript`. It's less strict and allows the `any` type. | [View](./eslint/overrides-javascript-lazy.js)
|
|
174
174
|
`linter-bundle/eslint/overrides-jest` | Settings for projects using Jest. | [View](./eslint/overrides-jest.js)
|
package/eslint/index.js
CHANGED
|
@@ -561,10 +561,29 @@ module.exports = {
|
|
|
561
561
|
},
|
|
562
562
|
{
|
|
563
563
|
selector: 'objectLiteralProperty',
|
|
564
|
+
// `__html` is a property of React's `dangerouslySetInnerHTML` object
|
|
564
565
|
filter: '^__html$',
|
|
565
566
|
types: ['string'],
|
|
566
567
|
format: null
|
|
567
568
|
},
|
|
569
|
+
{
|
|
570
|
+
// Allow properties which only contain digits
|
|
571
|
+
selector: 'objectLiteralProperty',
|
|
572
|
+
filter: '^\\d+$',
|
|
573
|
+
format: null
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
// Allow empty or one-character properties
|
|
577
|
+
selector: 'objectLiteralProperty',
|
|
578
|
+
filter: '^.?$',
|
|
579
|
+
format: null
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
// Allow properties which which don't contain an underscore (to prevent usage of "UPPER_CASE") and contain atleast 4 characters
|
|
583
|
+
selector: 'objectLiteralProperty',
|
|
584
|
+
filter: '^[^_]{4,}$',
|
|
585
|
+
format: null
|
|
586
|
+
},
|
|
568
587
|
{ selector: 'typeProperty', format: ['camelCase', 'PascalCase'] },
|
|
569
588
|
{
|
|
570
589
|
selector: 'typeProperty',
|
|
@@ -641,7 +660,7 @@ module.exports = {
|
|
|
641
660
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
642
661
|
'@typescript-eslint/no-parameter-properties': 'error',
|
|
643
662
|
'@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
|
|
644
|
-
'@typescript-eslint/no-redundant-type-constituents': '
|
|
663
|
+
'@typescript-eslint/no-redundant-type-constituents': 'off', // False positive with Promise<... | never>
|
|
645
664
|
'@typescript-eslint/no-require-imports': 'error',
|
|
646
665
|
'@typescript-eslint/no-shadow': 'error',
|
|
647
666
|
'@typescript-eslint/no-this-alias': 'error',
|
|
@@ -670,7 +689,7 @@ module.exports = {
|
|
|
670
689
|
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
671
690
|
'@typescript-eslint/no-unsafe-return': 'error',
|
|
672
691
|
'@typescript-eslint/no-unused-expressions': 'error',
|
|
673
|
-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
692
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' }],
|
|
674
693
|
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
|
|
675
694
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
676
695
|
'@typescript-eslint/no-var-requires': 'error',
|
|
@@ -969,7 +988,7 @@ module.exports = {
|
|
|
969
988
|
'unicorn/prefer-dom-node-text-content': 'error',
|
|
970
989
|
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
|
|
971
990
|
'unicorn/prefer-includes': 'error',
|
|
972
|
-
'unicorn/prefer-json-parse-buffer': '
|
|
991
|
+
'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
992
|
'unicorn/prefer-keyboard-event-key': 'error',
|
|
974
993
|
'unicorn/prefer-math-trunc': 'error',
|
|
975
994
|
'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.12.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,29 +39,29 @@
|
|
|
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.
|
|
45
|
-
"eslint-import-resolver-typescript": "2.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "5.17.0",
|
|
43
|
+
"@typescript-eslint/parser": "5.17.0",
|
|
44
|
+
"eslint": "8.12.0",
|
|
45
|
+
"eslint-import-resolver-typescript": "2.7.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
|
-
"eslint-plugin-jest": "26.1.
|
|
51
|
-
"eslint-plugin-jsdoc": "
|
|
50
|
+
"eslint-plugin-jest": "26.1.3",
|
|
51
|
+
"eslint-plugin-jsdoc": "38.1.4",
|
|
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.29.
|
|
56
|
-
"eslint-plugin-react-hooks": "4.
|
|
57
|
-
"eslint-plugin-unicorn": "41.0.
|
|
55
|
+
"eslint-plugin-react": "7.29.4",
|
|
56
|
+
"eslint-plugin-react-hooks": "4.4.0",
|
|
57
|
+
"eslint-plugin-unicorn": "41.0.1",
|
|
58
58
|
"markdownlint-cli": "0.31.1",
|
|
59
|
-
"micromatch": "4.0.
|
|
59
|
+
"micromatch": "4.0.5",
|
|
60
60
|
"postcss-scss": "4.0.3",
|
|
61
|
-
"stylelint": "14.
|
|
61
|
+
"stylelint": "14.6.1",
|
|
62
62
|
"stylelint-declaration-block-no-ignored-properties": "2.5.0",
|
|
63
63
|
"stylelint-order": "5.0.0",
|
|
64
|
-
"stylelint-scss": "4.
|
|
64
|
+
"stylelint-scss": "4.2.0",
|
|
65
65
|
"stylelint-selector-no-empty": "1.0.8",
|
|
66
66
|
"stylelint-use-logical-spec": "3.2.2"
|
|
67
67
|
},
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/eslint": "8.4.1",
|
|
74
74
|
"@types/micromatch": "4.0.2",
|
|
75
|
-
"@types/node": "17.0.
|
|
76
|
-
"stylelint-find-new-rules": "
|
|
77
|
-
"typescript": "4.6.
|
|
75
|
+
"@types/node": "17.0.23",
|
|
76
|
+
"stylelint-find-new-rules": "4.0.0",
|
|
77
|
+
"typescript": "4.6.3"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/stylelint/index.js
CHANGED
|
@@ -157,6 +157,7 @@ module.exports = {
|
|
|
157
157
|
]
|
|
158
158
|
}
|
|
159
159
|
],
|
|
160
|
+
'declaration-property-max-values': [true, { 'unprefixed-property-name': 4 }],
|
|
160
161
|
'declaration-no-important': [true, {
|
|
161
162
|
severity: 'warning'
|
|
162
163
|
}],
|
|
@@ -183,7 +184,7 @@ module.exports = {
|
|
|
183
184
|
'function-linear-gradient-no-nonstandard-direction': true,
|
|
184
185
|
'function-max-empty-lines': 0,
|
|
185
186
|
'function-name-case': 'lower',
|
|
186
|
-
'function-no-unknown': null, //
|
|
187
|
+
'function-no-unknown': null, // Implemented by scss/function-no-unknown
|
|
187
188
|
'function-parentheses-newline-inside': 'always-multi-line',
|
|
188
189
|
'function-parentheses-space-inside': 'never-single-line',
|
|
189
190
|
'function-url-no-scheme-relative': true,
|
|
@@ -890,6 +891,7 @@ module.exports = {
|
|
|
890
891
|
'scss/double-slash-comment-inline': null,
|
|
891
892
|
'scss/double-slash-comment-whitespace-inside': 'always',
|
|
892
893
|
'scss/function-color-relative': true,
|
|
894
|
+
'scss/function-no-unknown': true,
|
|
893
895
|
'scss/function-quote-no-quoted-strings-inside': true,
|
|
894
896
|
'scss/function-unquote-no-unquoted-strings-inside': true,
|
|
895
897
|
'scss/map-keys-quotes': 'always',
|