diff --git a/README.md b/README.md index 0a458189..60820970 100644 --- a/README.md +++ b/README.md @@ -83,9 +83,10 @@ Dot-only glob: - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead Optional parameters: -- --config specifies the path to a configuration file to define the base configuration -- --fix updates files to resolve fixable issues (can be overridden in configuration) -- --help writes this message to the console and exits without doing anything else +- --config specifies the path to a configuration file to define the base configuration +- --fix updates files to resolve fixable issues (can be overridden in configuration) +- --help writes this message to the console and exits without doing anything else +- --no-globs ignores the "globs" property if present in the top-level options object Configuration via: - .markdownlint-cli2.jsonc @@ -290,6 +291,8 @@ of the rules within. command-line arguments - This setting can be used instead of (or in addition to) passing globs on the command-line and offers identical performance + - This setting is ignored when the `--no-globs` parameter is passed on the + command-line - This top-level setting is valid **only** in the directory from which `markdownlint-cli2` is run - `ignores`: `Array` of `String`s defining glob expressions to ignore when diff --git a/markdownlint-cli2.js b/markdownlint-cli2.js index d3e79305..ddf53349 100755 --- a/markdownlint-cli2.js +++ b/markdownlint-cli2.js @@ -259,9 +259,10 @@ Dot-only glob: - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead Optional parameters: -- --config specifies the path to a configuration file to define the base configuration -- --fix updates files to resolve fixable issues (can be overridden in configuration) -- --help writes this message to the console and exits without doing anything else +- --config specifies the path to a configuration file to define the base configuration +- --fix updates files to resolve fixable issues (can be overridden in configuration) +- --help writes this message to the console and exits without doing anything else +- --no-globs ignores the "globs" property if present in the top-level options object Configuration via: - .markdownlint-cli2.jsonc @@ -895,10 +896,12 @@ const main = async (params) => { optionsOverride, fileContents, nonFileContents, - noGlobs, noRequire, name } = params; + let { + noGlobs + } = params; const logMessage = params.logMessage || noop; const logError = params.logError || noop; const fs = params.fs || require("node:fs"); @@ -929,6 +932,9 @@ const main = async (params) => { } else if (arg === "--help") { shouldShowHelp = true; return false; + } else if (arg === "--no-globs") { + noGlobs = true; + return false; } return true; }); diff --git a/test/markdownlint-cli2-test-cases.js b/test/markdownlint-cli2-test-cases.js index 0423ff9b..556394fe 100644 --- a/test/markdownlint-cli2-test-cases.js +++ b/test/markdownlint-cli2-test-cases.js @@ -296,6 +296,20 @@ const testCases = ({ "exitCode": 1 }); + testCase({ + "name": "no-globs-and-args", + "args": [ "--no-globs", "dir/about.md", "dir/**/*.markdown" ], + "exitCode": 1, + "cwd": "globs-and-args" + }); + + testCase({ + "name": "no-globs-and-empty-args", + "args": [ "--no-globs" ], + "exitCode": 2, + "cwd": "globs-and-args" + }); + testCase({ "name": "globs-and-ignores", "args": [], diff --git a/test/snapshots/markdownlint-cli2-test-exec.js.md b/test/snapshots/markdownlint-cli2-test-exec.js.md index bff366d9..db8889c6 100644 --- a/test/snapshots/markdownlint-cli2-test-exec.js.md +++ b/test/snapshots/markdownlint-cli2-test-exec.js.md @@ -34,9 +34,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -89,9 +90,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -144,9 +146,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -199,9 +202,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -254,9 +258,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -309,9 +314,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -364,9 +370,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -805,6 +812,88 @@ Generated by [AVA](https://avajs.dev). `, } +## no-globs-and-args (exec) + +> Snapshot 1 + + { + exitCode: 1, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: `dir/about.md:1:1 MD021/no-multiple-space-closed-atx Multiple spaces inside hashes on closed atx style heading [Context: "# About #"]␊ + dir/about.md:4 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. List"]␊ + dir/about.md:5:1 MD029/ol-prefix Ordered list item prefix [Expected: 2; Actual: 3; Style: 1/2/3]␊ + dir/subdir/info.markdown:1 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Information"]␊ + dir/subdir/info.markdown:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Information"]␊ + dir/subdir/info.markdown:2:6 MD038/no-space-in-code Spaces inside code span elements [Context: "\` code1\`"]␊ + dir/subdir/info.markdown:2:20 MD038/no-space-in-code Spaces inside code span elements [Context: "\`code2 \`"]␊ + dir/subdir/info.markdown:4 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + `, + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + Finding: dir/about.md dir/**/*.markdown␊ + Linting: 2 file(s)␊ + Summary: 8 error(s)␊ + `, + } + +## no-globs-and-empty-args (exec) + +> Snapshot 1 + + { + exitCode: 2, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: '', + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + https://github.com/DavidAnson/markdownlint-cli2␊ + ␊ + Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN] [--config file] [--fix] [--help]␊ + ␊ + Glob expressions (from the globby library):␊ + - * matches any number of characters, but not /␊ + - ? matches a single character, but not /␊ + - ** matches any number of characters, including /␊ + - {} allows for a comma-separated list of "or" expressions␊ + - ! or # at the beginning of a pattern negate the match␊ + - : at the beginning identifies a literal file path␊ + ␊ + Dot-only glob:␊ + - The command "markdownlint-cli2 ." would lint every file in the current directory tree which is probably not intended␊ + - Instead, it is mapped to "markdownlint-cli2 *.{md,markdown}" which lints all Markdown files in the current directory␊ + - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ + ␊ + Optional parameters:␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ + ␊ + Configuration via:␊ + - .markdownlint-cli2.jsonc␊ + - .markdownlint-cli2.yaml␊ + - .markdownlint-cli2.cjs or .markdownlint-cli2.mjs␊ + - .markdownlint.jsonc or .markdownlint.json␊ + - .markdownlint.yaml or .markdownlint.yml␊ + - .markdownlint.cjs or .markdownlint.mjs␊ + - package.json␊ + ␊ + Cross-platform compatibility:␊ + - UNIX and Windows shells expand globs according to different rules; quoting arguments is recommended␊ + - Some Windows shells don't handle single-quoted (') arguments well; double-quote (") is recommended␊ + - Shells that expand globs do not support negated patterns (!node_modules); quoting is required here␊ + - Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases␊ + - The path separator is forward slash (/) on all platforms; backslash (\\) is automatically converted␊ + ␊ + The most compatible syntax for cross-platform support:␊ + $ markdownlint-cli2 "**/*.md" "#node_modules"␊ + `, + } + ## globs-and-ignores (exec) > Snapshot 1 diff --git a/test/snapshots/markdownlint-cli2-test-exec.js.snap b/test/snapshots/markdownlint-cli2-test-exec.js.snap index f89da952..eca3c77f 100644 Binary files a/test/snapshots/markdownlint-cli2-test-exec.js.snap and b/test/snapshots/markdownlint-cli2-test-exec.js.snap differ diff --git a/test/snapshots/markdownlint-cli2-test-fs.js.md b/test/snapshots/markdownlint-cli2-test-fs.js.md index 298e02e3..3513a0b7 100644 --- a/test/snapshots/markdownlint-cli2-test-fs.js.md +++ b/test/snapshots/markdownlint-cli2-test-fs.js.md @@ -34,9 +34,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -89,9 +90,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -144,9 +146,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -199,9 +202,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -640,6 +644,88 @@ Generated by [AVA](https://avajs.dev). `, } +## no-globs-and-args (fs) + +> Snapshot 1 + + { + exitCode: 1, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: `dir/about.md:1:1 MD021/no-multiple-space-closed-atx Multiple spaces inside hashes on closed atx style heading [Context: "# About #"]␊ + dir/about.md:4 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. List"]␊ + dir/about.md:5:1 MD029/ol-prefix Ordered list item prefix [Expected: 2; Actual: 3; Style: 1/2/3]␊ + dir/subdir/info.markdown:1 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Information"]␊ + dir/subdir/info.markdown:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Information"]␊ + dir/subdir/info.markdown:2:6 MD038/no-space-in-code Spaces inside code span elements [Context: "\` code1\`"]␊ + dir/subdir/info.markdown:2:20 MD038/no-space-in-code Spaces inside code span elements [Context: "\`code2 \`"]␊ + dir/subdir/info.markdown:4 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + `, + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + Finding: dir/about.md dir/**/*.markdown␊ + Linting: 2 file(s)␊ + Summary: 8 error(s)␊ + `, + } + +## no-globs-and-empty-args (fs) + +> Snapshot 1 + + { + exitCode: 2, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: '', + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + https://github.com/DavidAnson/markdownlint-cli2␊ + ␊ + Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN] [--config file] [--fix] [--help]␊ + ␊ + Glob expressions (from the globby library):␊ + - * matches any number of characters, but not /␊ + - ? matches a single character, but not /␊ + - ** matches any number of characters, including /␊ + - {} allows for a comma-separated list of "or" expressions␊ + - ! or # at the beginning of a pattern negate the match␊ + - : at the beginning identifies a literal file path␊ + ␊ + Dot-only glob:␊ + - The command "markdownlint-cli2 ." would lint every file in the current directory tree which is probably not intended␊ + - Instead, it is mapped to "markdownlint-cli2 *.{md,markdown}" which lints all Markdown files in the current directory␊ + - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ + ␊ + Optional parameters:␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ + ␊ + Configuration via:␊ + - .markdownlint-cli2.jsonc␊ + - .markdownlint-cli2.yaml␊ + - .markdownlint-cli2.cjs or .markdownlint-cli2.mjs␊ + - .markdownlint.jsonc or .markdownlint.json␊ + - .markdownlint.yaml or .markdownlint.yml␊ + - .markdownlint.cjs or .markdownlint.mjs␊ + - package.json␊ + ␊ + Cross-platform compatibility:␊ + - UNIX and Windows shells expand globs according to different rules; quoting arguments is recommended␊ + - Some Windows shells don't handle single-quoted (') arguments well; double-quote (") is recommended␊ + - Shells that expand globs do not support negated patterns (!node_modules); quoting is required here␊ + - Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases␊ + - The path separator is forward slash (/) on all platforms; backslash (\\) is automatically converted␊ + ␊ + The most compatible syntax for cross-platform support:␊ + $ markdownlint-cli2 "**/*.md" "#node_modules"␊ + `, + } + ## globs-and-ignores (fs) > Snapshot 1 diff --git a/test/snapshots/markdownlint-cli2-test-fs.js.snap b/test/snapshots/markdownlint-cli2-test-fs.js.snap index 8eb1317f..6440847e 100644 Binary files a/test/snapshots/markdownlint-cli2-test-fs.js.snap and b/test/snapshots/markdownlint-cli2-test-fs.js.snap differ diff --git a/test/snapshots/markdownlint-cli2-test-main.js.md b/test/snapshots/markdownlint-cli2-test-main.js.md index 50cb03b3..6c514e2b 100644 --- a/test/snapshots/markdownlint-cli2-test-main.js.md +++ b/test/snapshots/markdownlint-cli2-test-main.js.md @@ -34,9 +34,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -89,9 +90,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -144,9 +146,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -199,9 +202,10 @@ Generated by [AVA](https://avajs.dev). - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ ␊ Optional parameters:␊ - - --config specifies the path to a configuration file to define the base configuration␊ - - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ - - --help writes this message to the console and exits without doing anything else␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ ␊ Configuration via:␊ - .markdownlint-cli2.jsonc␊ @@ -640,6 +644,88 @@ Generated by [AVA](https://avajs.dev). `, } +## no-globs-and-args (main) + +> Snapshot 1 + + { + exitCode: 1, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: `dir/about.md:1:1 MD021/no-multiple-space-closed-atx Multiple spaces inside hashes on closed atx style heading [Context: "# About #"]␊ + dir/about.md:4 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. List"]␊ + dir/about.md:5:1 MD029/ol-prefix Ordered list item prefix [Expected: 2; Actual: 3; Style: 1/2/3]␊ + dir/subdir/info.markdown:1 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Information"]␊ + dir/subdir/info.markdown:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Information"]␊ + dir/subdir/info.markdown:2:6 MD038/no-space-in-code Spaces inside code span elements [Context: "\` code1\`"]␊ + dir/subdir/info.markdown:2:20 MD038/no-space-in-code Spaces inside code span elements [Context: "\`code2 \`"]␊ + dir/subdir/info.markdown:4 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊ + `, + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + Finding: dir/about.md dir/**/*.markdown␊ + Linting: 2 file(s)␊ + Summary: 8 error(s)␊ + `, + } + +## no-globs-and-empty-args (main) + +> Snapshot 1 + + { + exitCode: 2, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: '', + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + https://github.com/DavidAnson/markdownlint-cli2␊ + ␊ + Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN] [--config file] [--fix] [--help]␊ + ␊ + Glob expressions (from the globby library):␊ + - * matches any number of characters, but not /␊ + - ? matches a single character, but not /␊ + - ** matches any number of characters, including /␊ + - {} allows for a comma-separated list of "or" expressions␊ + - ! or # at the beginning of a pattern negate the match␊ + - : at the beginning identifies a literal file path␊ + ␊ + Dot-only glob:␊ + - The command "markdownlint-cli2 ." would lint every file in the current directory tree which is probably not intended␊ + - Instead, it is mapped to "markdownlint-cli2 *.{md,markdown}" which lints all Markdown files in the current directory␊ + - To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead␊ + ␊ + Optional parameters:␊ + - --config specifies the path to a configuration file to define the base configuration␊ + - --fix updates files to resolve fixable issues (can be overridden in configuration)␊ + - --help writes this message to the console and exits without doing anything else␊ + - --no-globs ignores the "globs" property if present in the top-level options object␊ + ␊ + Configuration via:␊ + - .markdownlint-cli2.jsonc␊ + - .markdownlint-cli2.yaml␊ + - .markdownlint-cli2.cjs or .markdownlint-cli2.mjs␊ + - .markdownlint.jsonc or .markdownlint.json␊ + - .markdownlint.yaml or .markdownlint.yml␊ + - .markdownlint.cjs or .markdownlint.mjs␊ + - package.json␊ + ␊ + Cross-platform compatibility:␊ + - UNIX and Windows shells expand globs according to different rules; quoting arguments is recommended␊ + - Some Windows shells don't handle single-quoted (') arguments well; double-quote (") is recommended␊ + - Shells that expand globs do not support negated patterns (!node_modules); quoting is required here␊ + - Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases␊ + - The path separator is forward slash (/) on all platforms; backslash (\\) is automatically converted␊ + ␊ + The most compatible syntax for cross-platform support:␊ + $ markdownlint-cli2 "**/*.md" "#node_modules"␊ + `, + } + ## globs-and-ignores (main) > Snapshot 1 diff --git a/test/snapshots/markdownlint-cli2-test-main.js.snap b/test/snapshots/markdownlint-cli2-test-main.js.snap index 896969ba..2c03c3e1 100644 Binary files a/test/snapshots/markdownlint-cli2-test-main.js.snap and b/test/snapshots/markdownlint-cli2-test-main.js.snap differ