markdownlint-cli 0.49.1 → 0.50.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/README.md CHANGED
@@ -30,7 +30,7 @@ Arguments:
30
30
 
31
31
  Options:
32
32
  -V, --version output the version number
33
- -c, --config <configFile> configuration file (JSON, JSONC, JS, YAML, or TOML)
33
+ -c, --config <configFile> configuration file (JSON, JSONC, JS, TOML, or YAML)
34
34
  --configPointer <pointer> JSON Pointer to object within configuration file (default: "")
35
35
  -d, --dot include files/folders with a dot (for example `.github`)
36
36
  -f, --fix fix basic issues (does not work with STDIN)
@@ -109,10 +109,10 @@ A sample configuration file:
109
109
  For more examples, see [.markdownlint.jsonc][markdownlint-jsonc], [.markdownlint.yaml][markdownlint-yaml], [test-config.toml](test/test-config.toml) or the [style folder][style-folder].
110
110
 
111
111
  The CLI argument `--config` is not required.
112
- If it is not provided, `markdownlint-cli` looks for the file `.markdownlint.jsonc`/`.markdownlint.json`/`.markdownlint.yaml`/`.markdownlint.yml` in current folder, or for the file `.markdownlintrc` in the current or all parent folders.
113
- The algorithm is described in detail on the [`rc` package page][rc-standards].
114
- Note that when relying on the lookup of a file named `.markdownlintrc` in the current or parent folders, the only syntaxes accepted are INI and JSON, and the file cannot have an extension.
115
- If the `--config` argument is provided, the file must be valid JSON, JSONC, JS, or YAML.
112
+ If it is not provided, `markdownlint-cli` uses the [`run-con` package to merge configuration from all supported locations][run-con-standards], then overlays any configuration from the first matching file of `.markdownlint.jsonc`/`.markdownlint.json`/`.markdownlint.yaml`/`.markdownlint.yml` in the current folder.
113
+ (For compatibility with other `markdownlint` tooling, use of `run-con` configuration files is discouraged.)
114
+
115
+ If the `--config` argument is provided, the `configFile` specified must be valid JSON, JSONC, JS, TOML, or YAML.
116
116
  JS configuration files contain JavaScript code, must have the `.js` or `.cjs` file extension, and must export (via `module.exports = ...`) a configuration object of the form shown above.
117
117
  If your workspace _(project)_ is [ESM-only] _(`"type": "module"` set in the root `package.json` file)_, then the configuration file **should end with `.cjs` file extension**.
118
118
  A JS configuration file may internally `require` one or more npm packages as a way of reusing configuration across projects.
@@ -142,7 +142,7 @@ To run `markdownlint-cli` as part of a [pre-commit][pre-commit] workflow, add so
142
142
 
143
143
  ```yaml
144
144
  - repo: https://github.com/igorshubovych/markdownlint-cli
145
- rev: v0.49.1
145
+ rev: v0.50.0
146
146
  hooks:
147
147
  - id: markdownlint
148
148
  ```
@@ -171,7 +171,7 @@ MIT © Igor Shubovych
171
171
  [rules]: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
172
172
  [config]: https://github.com/DavidAnson/markdownlint#optionsconfig
173
173
  [style-folder]: https://github.com/DavidAnson/markdownlint/tree/main/style
174
- [rc-standards]: https://www.npmjs.com/package/rc#standards
174
+ [run-con-standards]: https://www.npmjs.com/package/run-con#standards
175
175
  [glob]: https://github.com/isaacs/node-glob
176
176
  [globprimer]: https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer
177
177
  [ignore]: https://github.com/kaelzhang/node-ignore
package/markdownlint.js CHANGED
@@ -16,7 +16,7 @@ import jsonpointer from 'jsonpointer';
16
16
  const require = Module.createRequire(import.meta.url);
17
17
  const options = program.opts();
18
18
  // The following two values are copied from package.json (and validated by tests)
19
- const version = '0.49.1';
19
+ const version = '0.50.0';
20
20
  const description = 'MarkdownLint Command Line Interface';
21
21
 
22
22
  function markdownItFactory() {
@@ -209,7 +209,7 @@ function concatArray(item, array) {
209
209
  program
210
210
  .version(version)
211
211
  .description(description)
212
- .option('-c, --config <configFile>', 'configuration file (JSON, JSONC, JS, YAML, or TOML)')
212
+ .option('-c, --config <configFile>', 'configuration file (JSON, JSONC, JS, TOML, or YAML)')
213
213
  .option('--configPointer <pointer>', 'JSON Pointer to object within configuration file', '')
214
214
  .option('-d, --dot', 'include files/folders with a dot (for example `.github`)')
215
215
  .option('-f, --fix', 'fix basic issues (does not work with STDIN)')
@@ -308,6 +308,7 @@ function lintAndPrint(stdin, files) {
308
308
  customRules,
309
309
  files,
310
310
  };
311
+ // eslint-disable-next-line unicorn/no-immediate-mutation
311
312
  if (stdin) {
312
313
  lintOptions.strings = {
313
314
  stdin,
@@ -320,6 +321,7 @@ function lintAndPrint(stdin, files) {
320
321
  fixOptions.files = [file];
321
322
  const fixResult = lint(fixOptions);
322
323
  const fixes = fixResult[file].filter(error => error.fixInfo);
324
+ // eslint-disable-next-line unicorn/prefer-continue
323
325
  if (fixes.length > 0) {
324
326
  const originalText = fs.readFileSync(file, fsOptions);
325
327
  const fixedText = applyFixes(originalText, fixes);
@@ -339,6 +341,9 @@ try {
339
341
  lintAndPrint(null, diff);
340
342
  } else if (inputs.length === 0 && options.stdin && !options.fix) {
341
343
  import('node:stream/consumers').then(module => module.text(process.stdin)).then(lintAndPrint);
344
+ } else if (program.args.length > 0 && !options.stdin) {
345
+ // Files, directories, or globs were given, but none of them resolved to a Markdown file.
346
+ console.warn('No matching files found');
342
347
  } else {
343
348
  program.help();
344
349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdownlint-cli",
3
- "version": "0.49.1",
3
+ "version": "0.50.0",
4
4
  "description": "MarkdownLint Command Line Interface",
5
5
  "type": "module",
6
6
  "main": "markdownlint.js",
@@ -40,41 +40,49 @@
40
40
  "dependencies": {
41
41
  "commander": "~15.0.0",
42
42
  "deep-extend": "~0.6.0",
43
- "ignore": "~7.0.6",
44
- "js-yaml": "~5.2.1",
43
+ "ignore": "~7.0.13",
44
+ "js-yaml": "~5.5.0",
45
45
  "jsonc-parser": "~3.3.1",
46
46
  "jsonpointer": "~5.0.1",
47
- "markdownlint": "~0.41.1",
48
- "markdown-it": "~14.3.0",
49
- "minimatch": "~10.2.5",
47
+ "markdownlint": "~0.42.0",
48
+ "markdown-it": "~15.0.3",
49
+ "minimatch": "~10.2.6",
50
50
  "run-con": "~1.3.3",
51
- "smol-toml": "~1.7.0",
51
+ "smol-toml": "~1.9.1",
52
52
  "tinyglobby": "~0.2.17"
53
53
  },
54
54
  "devDependencies": {
55
- "ava": "^8.0.1",
55
+ "ava": "^8.1.0",
56
56
  "markdownlint-cli-local-test-rule": "./test/custom-rules/markdownlint-cli-local-test-rule",
57
57
  "nano-spawn": "^2.1.0",
58
- "xo": "^4.0.0"
58
+ "xo": "^5.0.1"
59
59
  },
60
- "xo": {
61
- "files": "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,svelte,astro,html}",
62
- "prettier": true,
63
- "space": true,
64
- "rules": {
65
- "comma-dangle": 0,
66
- "linebreak-style": 0,
67
- "no-var": 0,
68
- "prefer-arrow-callback": 0,
69
- "promise/prefer-await-to-then": 0,
70
- "object-shorthand": 0,
71
- "regexp/prefer-named-capture-group": 0,
72
- "unicorn/max-nested-calls": 0,
73
- "unicorn/prefer-module": 0,
74
- "unicorn/prefer-ternary": 0,
75
- "unicorn/prefer-top-level-await": 0
60
+ "xo": [
61
+ {
62
+ "files": "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,svelte,astro,html}",
63
+ "rules": {
64
+ "comma-dangle": 0,
65
+ "linebreak-style": 0,
66
+ "no-var": 0,
67
+ "prefer-arrow-callback": 0,
68
+ "promise/prefer-await-to-then": 0,
69
+ "object-shorthand": 0,
70
+ "@stylistic/indent": [ "error", 2 ],
71
+ "@stylistic/max-len": 0,
72
+ "regexp/prefer-named-capture-group": 0,
73
+ "unicorn/max-nested-calls": 0,
74
+ "unicorn/prefer-module": 0,
75
+ "unicorn/prefer-ternary": 0,
76
+ "unicorn/prefer-top-level-await": 0
77
+ }
78
+ },
79
+ {
80
+ "ignores": [
81
+ "**/package.json",
82
+ "test/config-files/json-c/.markdownlint.json"
83
+ ]
76
84
  }
77
- },
85
+ ],
78
86
  "prettier": {
79
87
  "arrowParens": "avoid",
80
88
  "bracketSpacing": false,