linter-bundle 3.8.0 → 3.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 +21 -1
- package/eslint/index.js +2 -2
- package/eslint/rules/restricted-filenames.js +47 -41
- package/helper/find-missing-overrides.js +2 -2
- package/helper/get-stylelint-path.js +2 -2
- package/helper/is-npm-or-yarn.js +2 -2
- package/helper/run-process.js +3 -2
- package/helper/validate-package-overrides.js +2 -2
- package/lint.js +2 -2
- package/package.json +4 -4
- package/stylelint/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,27 @@ 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.10.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [3.10.0] - 2023-08-29
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [eslint] Updated `@typescript-eslint` from `6.4.1` to `6.5.0`
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- [eslint] Don't consider files outside of `basePath` in [`restricted-filenames`](./eslint/rules/restricted-filenames.md) rule
|
|
20
|
+
|
|
21
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v3.9.0...v3.10.0)
|
|
22
|
+
|
|
23
|
+
## [3.9.0] - 2023-08-28
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- [general] Use users default shell for linting sub-processes
|
|
28
|
+
|
|
29
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v3.8.0...v3.9.0)
|
|
10
30
|
|
|
11
31
|
## [3.8.0] - 2023-08-28
|
|
12
32
|
|
package/eslint/index.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/* eslint-disable max-lines -- The rules can be easier managed if they are all in one file */
|
|
6
6
|
/* eslint-disable n/no-process-env -- `process.env` is required to inject configuration adjustments */
|
|
7
7
|
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
10
|
|
|
11
11
|
const ensureType = require('../helper/ensure-type');
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file ESLint rule which ensures that only files which match given glob patterns are part of your project.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
const path = require('path');
|
|
5
|
+
const path = require('node:path');
|
|
6
6
|
|
|
7
7
|
const micromatch = require('micromatch');
|
|
8
8
|
|
|
@@ -46,52 +46,58 @@ module.exports = {
|
|
|
46
46
|
]
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
create: (context) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const options = context.options;
|
|
49
|
+
create: (context) => {
|
|
50
|
+
const filePath = context.getFilename();
|
|
51
|
+
/** @type {{ basePath: string, allowed?: string[]; disallowed?: string[]; }[]} */
|
|
52
|
+
const options = context.options;
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
for (const { basePath, allowed, disallowed } of options) {
|
|
55
|
+
const normalizedName = path.relative(path.join(process.cwd(), basePath), filePath);
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
if (normalizedName.startsWith('..')) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (allowed && !disallowed) {
|
|
62
|
+
if (!micromatch.isMatch(normalizedName, allowed, { dot: true })) {
|
|
63
|
+
return report();
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
65
|
+
}
|
|
66
|
+
else if (!allowed && disallowed) {
|
|
67
|
+
if (micromatch.isMatch(normalizedName, disallowed, { dot: true })) {
|
|
68
|
+
return report();
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
70
|
+
}
|
|
71
|
+
else if (allowed && disallowed) {
|
|
72
|
+
if (
|
|
73
|
+
micromatch.isMatch(normalizedName, disallowed, { dot: true }) ||
|
|
74
|
+
!micromatch.isMatch(normalizedName, allowed, { dot: true })
|
|
75
|
+
) {
|
|
76
|
+
return report();
|
|
78
77
|
}
|
|
79
78
|
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
return {};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Add rule listener which reports the error.
|
|
85
|
+
*
|
|
86
|
+
* @returns {import('eslint').Rule.RuleListener} Returns a `Program` rule lister which reports the error.
|
|
87
|
+
*/
|
|
88
|
+
function report () {
|
|
89
|
+
return {
|
|
90
|
+
Program: (node) => {
|
|
91
|
+
context.report({
|
|
92
|
+
node,
|
|
93
|
+
loc: { line: 1, column: 0 },
|
|
94
|
+
messageId: 'text',
|
|
95
|
+
data: {
|
|
96
|
+
name: path.relative(process.cwd(), filePath).replace(/\\/gu, '/')
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
95
101
|
}
|
|
96
|
-
}
|
|
102
|
+
}
|
|
97
103
|
};
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @see https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
10
|
|
|
11
11
|
/** @typedef {{ name: string; configuredVersion: string; expectedVersion: string; }} Dependency */
|
|
12
12
|
|
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
|
-
const fs = require('fs');
|
|
6
|
-
const path = require('path');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns if the project is using npm or yarn.
|
package/helper/run-process.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/** @typedef {{ code: number; stdout: string; stderr: string; runtime: number; }} ProcessResult */
|
|
6
6
|
|
|
7
|
-
const childProcess = require('child_process');
|
|
7
|
+
const childProcess = require('node:child_process');
|
|
8
|
+
const os = require('node:os');
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Executes a process asynchronously.
|
|
@@ -24,7 +25,7 @@ async function runProcess (command, options) {
|
|
|
24
25
|
/** @type {string[]} */
|
|
25
26
|
const stderr = [];
|
|
26
27
|
|
|
27
|
-
const lintingProcess = childProcess.exec(command, options);
|
|
28
|
+
const lintingProcess = childProcess.exec(command, { ...options, shell: os.userInfo().shell });
|
|
28
29
|
|
|
29
30
|
lintingProcess.stdout?.on('data', (/** @type {string} */data) => {
|
|
30
31
|
stdout.push(data);
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @see https://classic.yarnpkg.com/en/docs/selective-version-resolutions/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
10
|
|
|
11
11
|
/** @typedef {{ name: string; configuredVersion: string; expectedVersion: string; }} Dependency */
|
|
12
12
|
|
package/lint.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.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",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"_validate-stylelint-options": "node ./validate-stylelint-options.mjs"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
44
|
-
"@typescript-eslint/parser": "6.
|
|
45
|
-
"@typescript-eslint/utils": "6.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "6.5.0",
|
|
44
|
+
"@typescript-eslint/parser": "6.5.0",
|
|
45
|
+
"@typescript-eslint/utils": "6.5.0",
|
|
46
46
|
"eslint": "8.48.0",
|
|
47
47
|
"eslint-import-resolver-typescript": "3.6.0",
|
|
48
48
|
"eslint-import-resolver-webpack": "0.13.7",
|