markdownlint-cli2 0.18.0 → 0.19.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0
4
+
5
+ - Add `--format` parameter for editor integration
6
+ - Update output formatters for severity `warning`
7
+ - Explicitly version Docker containers for `pre-commit`
8
+ - Update dependencies (including `markdownlint`)
9
+
10
+ ## 0.18.1
11
+
12
+ - Update dependencies (including `markdownlint`)
13
+
3
14
  ## 0.18.0
4
15
 
5
16
  - Use user ID in Docker containers for security
package/README.md CHANGED
@@ -37,7 +37,7 @@ As a [GitHub Action][github-action] via
37
37
 
38
38
  ```yaml
39
39
  - name: markdownlint-cli2-action
40
- uses: DavidAnson/markdownlint-cli2-action@v9
40
+ uses: DavidAnson/markdownlint-cli2-action@main
41
41
  ```
42
42
 
43
43
  ## Overview
@@ -67,7 +67,7 @@ As a [GitHub Action][github-action] via
67
67
  markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)
68
68
  https://github.com/DavidAnson/markdownlint-cli2
69
69
 
70
- Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN] [--config file] [--fix] [--help]
70
+ Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN] [--config file] [--fix] [--format] [--help] [--no-globs]
71
71
 
72
72
  Glob expressions (from the globby library):
73
73
  - * matches any number of characters, but not /
@@ -86,6 +86,7 @@ Dot-only glob:
86
86
  Optional parameters:
87
87
  - --config specifies the path to a configuration file to define the base configuration
88
88
  - --fix updates files to resolve fixable issues (can be overridden in configuration)
89
+ - --format reads standard input (stdin), applies fixes, writes standard output (stdout)
89
90
  - --help writes this message to the console and exits without doing anything else
90
91
  - --no-globs ignores the "globs" property if present in the top-level options object
91
92
 
@@ -149,7 +150,7 @@ A container image [`davidanson/markdownlint-cli2`][docker-hub-markdownlint-cli2]
149
150
  can also be used (e.g., as part of a CI pipeline):
150
151
 
151
152
  ```bash
152
- docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.18.0 "**/*.md" "#node_modules"
153
+ docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.19.0 "**/*.md" "#node_modules"
153
154
  ```
154
155
 
155
156
  Notes:
@@ -166,7 +167,7 @@ Notes:
166
167
  - A custom working directory can be specified with Docker's `-w` flag:
167
168
 
168
169
  ```bash
169
- docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.18.0 "**/*.md" "#node_modules"
170
+ docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.19.0 "**/*.md" "#node_modules"
170
171
  ```
171
172
 
172
173
  For convenience, the container image
@@ -178,11 +179,51 @@ onto the base image `davidanson/markdownlint-cli2`.
178
179
  **Note**: This container image exists for convenience and is not an endorsement
179
180
  of the rules within.
180
181
 
182
+ ### Output Formatters
183
+
184
+ In addition to (or instead of) the default behavior of writing a list of all
185
+ issues to the standard error (`stderr`) device, custom output formatters can be
186
+ configured to produce a variety of outputs like:
187
+
188
+ - [List of issues (default)][formatter-default]
189
+ - [List of issues with color and links][formatter-pretty]
190
+ - [GitLab Code Quality report file][formatter-codequality]
191
+ - [JSON file][formatter-json]
192
+ - [JUnit XML file][formatter-junit]
193
+ - [Static Analysis Results Interchange Format/SARIF file][formatter-sarif]
194
+ - [Summary of issues found][formatter-summarize]
195
+ - [Flexible string template][formatter-template] supporting:
196
+ - Azure Pipelines Task command LogIssue format
197
+ - GitHub Actions workflow commands format
198
+
199
+ [formatter-default]: ./formatter-default/README.md
200
+ [formatter-codequality]: ./formatter-codequality/README.md
201
+ [formatter-json]: ./formatter-json/README.md
202
+ [formatter-junit]: ./formatter-junit/README.md
203
+ [formatter-pretty]: ./formatter-pretty/README.md
204
+ [formatter-sarif]: ./formatter-sarif/README.md
205
+ [formatter-summarize]: ./formatter-summarize/README.md
206
+ [formatter-template]: ./formatter-template/README.md
207
+
208
+ For more information, refer to the documentation for the `outputFormatters`
209
+ parameter below.
210
+
181
211
  ### Exit Codes
182
212
 
183
- - `0`: Linting was successful and there were no errors
184
- - `1`: Linting was successful and there were errors
185
- - `2`: Linting was not completed due to a runtime issue
213
+ - `0`: Linting was successful and there were no errors (there may be warnings)
214
+ - `1`: Linting was successful and there were errors (and possibly warnings)
215
+ - `2`: Linting was not successful due to a problem or failure
216
+
217
+ ### Formatting
218
+
219
+ Some editors implement document formatting by invoking an external program,
220
+ passing the text of the current document on standard input (`stdin`), and
221
+ reading the formatted result from standard output (`stdout`). This scenario is
222
+ supported by the `--format` command-line parameter. When `--format` is set:
223
+
224
+ - Globs and other input sources are ignored
225
+ - The `--fix` parameter is implicitly set
226
+ - The exit code `1` is not used
186
227
 
187
228
  ## Rule List
188
229
 
@@ -404,10 +445,6 @@ of the rules within.
404
445
  - The `INI` config format, `.markdownlintrc`, and `.markdownlintignore` are not
405
446
  supported.
406
447
 
407
- ### `vscode-markdownlint`
408
-
409
- - `.markdownlintignore` is not supported.
410
-
411
448
  ## pre-commit
412
449
 
413
450
  To run `markdownlint-cli2` as part of a [pre-commit][pre-commit] workflow, add a
@@ -415,7 +452,7 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like:
415
452
 
416
453
  ```yaml
417
454
  - repo: https://github.com/DavidAnson/markdownlint-cli2
418
- rev: v0.18.0
455
+ rev: v0.19.0
419
456
  hooks:
420
457
  - id: markdownlint-cli2
421
458
  ```
@@ -451,12 +488,12 @@ See [CHANGELOG.md][changelog].
451
488
  [markdown-it-plugins]: https://www.npmjs.com/search?q=keywords:markdown-it-plugin
452
489
  [markdown-it-syntax-extensions]: https://github.com/markdown-it/markdown-it#syntax-extensions
453
490
  [markdownlint]: https://github.com/DavidAnson/markdownlint
454
- [markdownlint-config]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#optionsconfig
455
- [markdownlint-configuration]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#configuration
456
- [markdownlint-custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/CustomRules.md
457
- [markdownlint-options]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#options
458
- [markdownlint-rules-aliases]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#rules--aliases
459
- [markdownlint-rules-tags]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#tags
491
+ [markdownlint-config]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/README.md#optionsconfig
492
+ [markdownlint-configuration]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/README.md#configuration
493
+ [markdownlint-custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/CustomRules.md
494
+ [markdownlint-options]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/README.md#options
495
+ [markdownlint-rules-aliases]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/README.md#rules--aliases
496
+ [markdownlint-rules-tags]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/README.md#tags
460
497
  [markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
461
498
  [markdownlint-cli2]: https://github.com/DavidAnson/markdownlint-cli2
462
499
  [markdownlint-cli2-action]: https://github.com/marketplace/actions/markdownlint-cli2-action
@@ -468,15 +505,15 @@ See [CHANGELOG.md][changelog].
468
505
  [markdownlint-cli2-mjs]: test/markdownlint-cli2-mjs/.markdownlint-cli2.mjs
469
506
  [markdownlint-cli2-yaml]: test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml
470
507
  [markdownlint-cjs]: test/markdownlint-cjs/.markdownlint.cjs
471
- [markdownlint-jsonc]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/schema/.markdownlint.jsonc
508
+ [markdownlint-jsonc]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/schema/.markdownlint.jsonc
472
509
  [markdownlint-mjs]: test/markdownlint-mjs/.markdownlint.mjs
473
510
  [markdownlint-rule]: https://www.npmjs.com/search?q=keywords:markdownlint-rule
474
- [markdownlint-yaml]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/schema/.markdownlint.yaml
511
+ [markdownlint-yaml]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/schema/.markdownlint.yaml
475
512
  [nodejs]: https://nodejs.org/
476
513
  [nodejs-docker]: https://github.com/nodejs/docker-node
477
514
  [nodejs-docker-non-root]: https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
478
515
  [nodejs-import-expression]: https://nodejs.org/api/esm.html#import-expressions
479
- [nodejs-import-meta-resolve]: https://nodejs.org/api/esm.html#importmetaresolvespecifier-parent
516
+ [nodejs-import-meta-resolve]: https://nodejs.org/api/esm.html#importmetaresolvespecifier
480
517
  [nodejs-require]: https://nodejs.org/api/modules.html#modules_require_id
481
518
  [npm-image]: https://img.shields.io/npm/v/markdownlint-cli2.svg
482
519
  [npm-url]: https://www.npmjs.com/package/markdownlint-cli2
@@ -4,8 +4,9 @@ const sliceSize = 1000;
4
4
 
5
5
  /**
6
6
  * Efficiently appends the source array to the destination array.
7
- * @param {object[]} destination Destination Array.
8
- * @param {object[]} source Source Array.
7
+ * @template T
8
+ * @param {T[]} destination Destination Array.
9
+ * @param {T[]} source Source Array.
9
10
  * @returns {void}
10
11
  */
11
12
  const appendToArray = (destination, source) => {
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // @ts-check
4
+
3
5
  import { "main" as markdownlintCli2 } from "./markdownlint-cli2.mjs";
4
6
 
5
7
  const params = {