linter-bundle 4.0.1 → 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 CHANGED
@@ -10,7 +10,6 @@ const snippets = {
10
10
 
11
11
  module.exports = {
12
12
  files: {
13
- git: true,
14
13
  restrictions: [
15
14
  {
16
15
  basePath: '.',
package/CHANGELOG.md CHANGED
@@ -6,7 +6,15 @@ 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.1...HEAD)
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)
10
18
 
11
19
  ## [4.0.1] - 2023-08-31
12
20
 
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, {
@@ -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, './**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}');
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')) : [pattern]);
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
- includedFiles = micromatch(gitFiles, includedFiles);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
5
5
  "keywords": [
6
6
  "eslint",