linter-bundle 4.0.0 → 4.0.2
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 +0 -1
- package/CHANGELOG.md +22 -1
- package/eslint/index.js +1 -1
- package/eslint/overrides-gatsby.js +2 -2
- package/eslint/overrides-javascript.js +1 -1
- package/eslint/overrides-type-declarations.js +1 -1
- package/lint.js +18 -6
- package/package.json +1 -1
package/.linter-bundle.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,24 @@ 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/v4.0.
|
|
9
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v4.0.2...HEAD)
|
|
10
|
+
|
|
11
|
+
## [4.0.2] - 2023-08-31
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [files] Don't append `"**"` as fallback argument to the command line
|
|
16
|
+
|
|
17
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v4.0.1...v4.0.2)
|
|
18
|
+
|
|
19
|
+
## [4.0.1] - 2023-08-31
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- [eslint] Disabled `unicorn/filename-case` in favour of the new linter-bundle `files` task
|
|
24
|
+
- [files] Fixed path to `files` task
|
|
25
|
+
|
|
26
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v4.0.0...v4.0.1)
|
|
10
27
|
|
|
11
28
|
## [4.0.0] - 2023-08-30
|
|
12
29
|
|
|
@@ -14,6 +31,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
14
31
|
|
|
15
32
|
- [general] The global configuration variable `global.linterBundleSettings` has been replaced by a `.linter-bundle.json` / `.linter-bundle.cjs` / `.linter-bundle.js` configuration file in the projects root directory
|
|
16
33
|
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- [general] New `files` task which ensures that files in the project match the restrictions defined in the linter-bundle configuration file.
|
|
37
|
+
|
|
17
38
|
### Changed
|
|
18
39
|
|
|
19
40
|
- [eslint] Updated `eslint-plugin-jsdoc` from `46.5.0` to `46.5.1`
|
package/eslint/index.js
CHANGED
|
@@ -931,7 +931,7 @@ module.exports = {
|
|
|
931
931
|
'unicorn/escape-case': 'error',
|
|
932
932
|
'unicorn/expiring-todo-comments': 'error',
|
|
933
933
|
'unicorn/explicit-length-check': 'error',
|
|
934
|
-
'unicorn/filename-case': ['
|
|
934
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
935
935
|
cases: {
|
|
936
936
|
camelCase: true,
|
|
937
937
|
pascalCase: true
|
|
@@ -62,7 +62,7 @@ module.exports = {
|
|
|
62
62
|
* eslint-plugin-unicorn
|
|
63
63
|
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
64
64
|
*/
|
|
65
|
-
'unicorn/filename-case': ['
|
|
65
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
66
66
|
cases: {
|
|
67
67
|
camelCase: true,
|
|
68
68
|
pascalCase: true
|
|
@@ -87,7 +87,7 @@ module.exports = {
|
|
|
87
87
|
* eslint-plugin-unicorn
|
|
88
88
|
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
89
89
|
*/
|
|
90
|
-
'unicorn/filename-case': ['
|
|
90
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
91
91
|
cases: {
|
|
92
92
|
kebabCase: true
|
|
93
93
|
}
|
|
@@ -92,7 +92,7 @@ module.exports = {
|
|
|
92
92
|
*
|
|
93
93
|
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
94
94
|
*/
|
|
95
|
-
'unicorn/filename-case': ['
|
|
95
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
96
96
|
cases: {
|
|
97
97
|
kebabCase: true
|
|
98
98
|
}
|
|
@@ -28,7 +28,7 @@ module.exports = {
|
|
|
28
28
|
*
|
|
29
29
|
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
30
30
|
*/
|
|
31
|
-
'unicorn/filename-case': ['
|
|
31
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
32
32
|
cases: {
|
|
33
33
|
kebabCase: true,
|
|
34
34
|
pascalCase: true
|
package/lint.js
CHANGED
|
@@ -124,7 +124,7 @@ async function runFilesTask (taskName, taskConfig) {
|
|
|
124
124
|
git: getConfigValue(taskName, taskConfig, 'git')
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
const includes = await getIncludes(newTaskConfig
|
|
127
|
+
const includes = await getIncludes(newTaskConfig);
|
|
128
128
|
|
|
129
129
|
if (!includes) {
|
|
130
130
|
return generateDummyJobOutput(taskName, newTaskConfig, {
|
|
@@ -135,7 +135,7 @@ async function runFilesTask (taskName, taskConfig) {
|
|
|
135
135
|
return runTask({
|
|
136
136
|
taskName,
|
|
137
137
|
taskConfig: newTaskConfig,
|
|
138
|
-
command: `node ./files ${includes}`
|
|
138
|
+
command: `node "${path.resolve(__dirname, './files/index.js')}" ${includes}`
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -181,7 +181,7 @@ async function runESLintTask (taskName, taskConfig) {
|
|
|
181
181
|
git: getConfigValue(taskName, taskConfig, 'git')
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
-
const includes = await getIncludes(newTaskConfig, '
|
|
184
|
+
const includes = await getIncludes(newTaskConfig, '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}');
|
|
185
185
|
|
|
186
186
|
if (!includes) {
|
|
187
187
|
return generateDummyJobOutput(taskName, newTaskConfig, {
|
|
@@ -464,24 +464,36 @@ function getTasksToRun (argv) {
|
|
|
464
464
|
* Returns a list of changed files, based on the Git-diff result and the glob pattern to be used in the command-line.
|
|
465
465
|
*
|
|
466
466
|
* @param {TaskConfig} taskConfig - Linter configuration
|
|
467
|
-
* @param {string} pattern - Glob pattern
|
|
467
|
+
* @param {string | undefined} [pattern] - Glob pattern
|
|
468
468
|
* @returns {Promise<string>} Space-separated file names in double-quotes to be used in the command-line, or an empty string if no file matches.
|
|
469
469
|
*/
|
|
470
470
|
async function getIncludes (taskConfig, pattern) {
|
|
471
471
|
const include = taskConfig['include'];
|
|
472
472
|
|
|
473
|
-
let includedFiles = (Array.isArray(include) && include.length > 0 ? /** @type {string[]} */(include.filter((item) => typeof item === 'string')) :
|
|
473
|
+
let includedFiles = (Array.isArray(include) && include.length > 0 ? /** @type {string[]} */(include.filter((item) => typeof item === 'string')) : undefined);
|
|
474
474
|
|
|
475
475
|
if (taskConfig['git']?.[0]) {
|
|
476
476
|
const gitFiles = await getGitFiles();
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
if (includedFiles) {
|
|
479
|
+
includedFiles = micromatch(gitFiles, includedFiles);
|
|
480
|
+
}
|
|
481
|
+
else if (pattern) {
|
|
482
|
+
includedFiles = micromatch(gitFiles, [pattern]);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
includedFiles = gitFiles;
|
|
486
|
+
}
|
|
479
487
|
|
|
480
488
|
if (includedFiles.length === 0) {
|
|
481
489
|
return '';
|
|
482
490
|
}
|
|
483
491
|
}
|
|
484
492
|
|
|
493
|
+
if (!includedFiles) {
|
|
494
|
+
return (pattern ? `"${pattern}"` : '');
|
|
495
|
+
}
|
|
496
|
+
|
|
485
497
|
return `"${includedFiles.join('" "')}"`;
|
|
486
498
|
}
|
|
487
499
|
|