markdownlint-cli2 0.10.0 → 0.12.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 +16 -0
- package/README.md +39 -53
- package/markdownlint-cli2.js +393 -331
- package/package.json +22 -28
- package/resolve-and-require.js +3 -3
- package/schema/ValidatingConfiguration.md +24 -0
- package/schema/markdownlint-cli2-config-schema.json +14 -3
- package/schema/markdownlint-config-schema.json +894 -188
- package/markdownlint-cli2-config.js +0 -14
- package/markdownlint-cli2-fix.js +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
- Remove deprecated `markdownlint-cli2-config` entry point
|
|
6
|
+
- Use `markdownlint-cli2 --config ...` instead
|
|
7
|
+
- Remove deprecated `markdownlint-cli2-fix` entry point
|
|
8
|
+
- Use `markdownlint-cli2 --fix ...` instead
|
|
9
|
+
- Add `--help` and `--no-globs` parameters
|
|
10
|
+
- Improve and document included JSON schemas
|
|
11
|
+
- Update dependencies (including `markdownlint`)
|
|
12
|
+
|
|
13
|
+
## 0.11.0
|
|
14
|
+
|
|
15
|
+
- Add `modulePaths` configuration option
|
|
16
|
+
- Update dependencies (including `markdownlint`)
|
|
17
|
+
- Remove support for end-of-life Node 16
|
|
18
|
+
|
|
3
19
|
## 0.10.0
|
|
4
20
|
|
|
5
21
|
- Add `showFound` configuration option
|
package/README.md
CHANGED
|
@@ -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]
|
|
70
|
+
Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN] [--config file] [--fix] [--help]
|
|
71
71
|
|
|
72
72
|
Glob expressions (from the globby library):
|
|
73
73
|
- * matches any number of characters, but not /
|
|
@@ -83,8 +83,10 @@ Dot-only glob:
|
|
|
83
83
|
- To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead
|
|
84
84
|
|
|
85
85
|
Optional parameters:
|
|
86
|
-
- --config
|
|
87
|
-
- --fix
|
|
86
|
+
- --config specifies the path to a configuration file to define the base configuration
|
|
87
|
+
- --fix updates files to resolve fixable issues (can be overridden in configuration)
|
|
88
|
+
- --help writes this message to the console and exits without doing anything else
|
|
89
|
+
- --no-globs ignores the "globs" property if present in the top-level options object
|
|
88
90
|
|
|
89
91
|
Configuration via:
|
|
90
92
|
- .markdownlint-cli2.jsonc
|
|
@@ -126,17 +128,6 @@ below) to `true` (though it can still be overridden by a configuration file):
|
|
|
126
128
|
markdownlint-cli2 --fix "**/*.md" "#node_modules"
|
|
127
129
|
```
|
|
128
130
|
|
|
129
|
-
> **Deprecated**
|
|
130
|
-
>
|
|
131
|
-
> The following command behaves similarly, defaulting the `fix` property to
|
|
132
|
-
> `true`:
|
|
133
|
-
>
|
|
134
|
-
> ```bash
|
|
135
|
-
> markdownlint-cli2-fix "**/*.md" "#node_modules"
|
|
136
|
-
> ```
|
|
137
|
-
>
|
|
138
|
-
> Otherwise, `markdownlint-cli2-fix` behaves the same as `markdownlint-cli2`.
|
|
139
|
-
|
|
140
131
|
In cases where it is not convenient to store a configuration file in the root
|
|
141
132
|
of a project, the `--config` argument can be used to provide a path to any
|
|
142
133
|
supported configuration file (except `package.json`):
|
|
@@ -150,29 +141,18 @@ above. For example, `.markdownlint.json` or `example.markdownlint-cli2.jsonc`.
|
|
|
150
141
|
The specified configuration file will be loaded, parsed, and applied as a base
|
|
151
142
|
configuration for the current directory - which will then be handled normally.
|
|
152
143
|
|
|
153
|
-
> **Deprecated**
|
|
154
|
-
>
|
|
155
|
-
> The following command behaves similarly, accepting a base configuration file
|
|
156
|
-
> path as its first parameter:
|
|
157
|
-
>
|
|
158
|
-
> ```bash
|
|
159
|
-
> markdownlint-cli2-config "config/.markdownlint-cli2.jsonc" "**/*.md" "#node_modules"
|
|
160
|
-
> ```
|
|
161
|
-
>
|
|
162
|
-
> Otherwise, `markdownlint-cli2-config` behaves the same as `markdownlint-cli2`.
|
|
163
|
-
|
|
164
144
|
### Container Image
|
|
165
145
|
|
|
166
146
|
A container image [`davidanson/markdownlint-cli2`][docker-hub-markdownlint-cli2]
|
|
167
147
|
can also be used (e.g., as part of a CI pipeline):
|
|
168
148
|
|
|
169
149
|
```bash
|
|
170
|
-
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.
|
|
150
|
+
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.12.0 "**/*.md" "#node_modules"
|
|
171
151
|
```
|
|
172
152
|
|
|
173
153
|
Notes:
|
|
174
154
|
|
|
175
|
-
- As when using the [command line]
|
|
155
|
+
- As when using the [command line][command-line], glob patterns are passed as
|
|
176
156
|
arguments.
|
|
177
157
|
- This image is built on the official [Node.js Docker image][nodejs-docker].
|
|
178
158
|
Per security best practices, the [default user `node`][nodejs-docker-non-root]
|
|
@@ -184,18 +164,9 @@ Notes:
|
|
|
184
164
|
- A custom working directory can be specified with Docker's `-w` flag:
|
|
185
165
|
|
|
186
166
|
```bash
|
|
187
|
-
docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.
|
|
167
|
+
docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.12.0 "**/*.md" "#node_modules"
|
|
188
168
|
```
|
|
189
169
|
|
|
190
|
-
> **Deprecated**
|
|
191
|
-
>
|
|
192
|
-
> To invoke the `markdownlint-cli2-config` or `markdownlint-cli2-fix` commands
|
|
193
|
-
> instead, use Docker's `--entrypoint` flag:
|
|
194
|
-
>
|
|
195
|
-
> ```bash
|
|
196
|
-
> docker run -v $PWD:/workdir --entrypoint="markdownlint-cli2-fix" davidanson/markdownlint-cli2:v0.10.0 "**/*.md" "#node_modules"
|
|
197
|
-
> ```
|
|
198
|
-
|
|
199
170
|
For convenience, the container image
|
|
200
171
|
[`davidanson/markdownlint-cli2-rules`][docker-hub-markdownlint-cli2-rules]
|
|
201
172
|
includes the latest versions of custom rules published to npm with the tag
|
|
@@ -231,6 +202,8 @@ of the rules within.
|
|
|
231
202
|
- When glob expressions match files *not* under the current directory,
|
|
232
203
|
configuration for the current directory is applied to the closest common
|
|
233
204
|
parent directory.
|
|
205
|
+
- Paths beginning with `~` are resolved relative to the user's home directory
|
|
206
|
+
(typically `$HOME` on UNIX and `%USERPROFILE%` on Windows)
|
|
234
207
|
- There are two kinds of configuration file (both detailed below):
|
|
235
208
|
- Configuration files like `.markdownlint-cli2.*` allow complete control of
|
|
236
209
|
`markdownlint-cli2` behavior and are also used by `vscode-markdownlint`.
|
|
@@ -252,9 +225,12 @@ of the rules within.
|
|
|
252
225
|
4. `.markdownlint.yml`
|
|
253
226
|
5. `.markdownlint.cjs`
|
|
254
227
|
6. `.markdownlint.mjs`
|
|
255
|
-
- The VS Code extension
|
|
256
|
-
|
|
257
|
-
|
|
228
|
+
- The VS Code extension includes a [JSON Schema][json-schema] definition for the
|
|
229
|
+
`JSON(C)` configuration files described below. This adds auto-complete and can
|
|
230
|
+
make it easier to define proper structure.
|
|
231
|
+
- See [markdownlint-cli2-config-schema.json][markdownlint-cli2-config-schema]
|
|
232
|
+
for that schema and [ValidatingConfiguration.md][validating-configuration] for
|
|
233
|
+
ways to use it to validate configuration files.
|
|
258
234
|
|
|
259
235
|
### `.markdownlint-cli2.jsonc`
|
|
260
236
|
|
|
@@ -284,6 +260,8 @@ of the rules within.
|
|
|
284
260
|
command-line arguments
|
|
285
261
|
- This setting can be used instead of (or in addition to) passing globs on
|
|
286
262
|
the command-line and offers identical performance
|
|
263
|
+
- This setting is ignored when the `--no-globs` parameter is passed on the
|
|
264
|
+
command-line
|
|
287
265
|
- This top-level setting is valid **only** in the directory from which
|
|
288
266
|
`markdownlint-cli2` is run
|
|
289
267
|
- `ignores`: `Array` of `String`s defining glob expressions to ignore when
|
|
@@ -305,6 +283,8 @@ of the rules within.
|
|
|
305
283
|
- Relative paths are resolved based on the location of the `JSONC` file
|
|
306
284
|
- For example: `[ [ "plugin-name", param_0, param_1, ... ], ... ]`
|
|
307
285
|
- Search [`markdown-it-plugins` on npm][markdown-it-plugins]
|
|
286
|
+
- `modulePaths`: `Array` of `String`s providing additional paths to use when
|
|
287
|
+
resolving module references (e.g., alternate locations for `node_modules`)
|
|
308
288
|
- `noInlineConfig`: `Boolean` value to disable the support of
|
|
309
289
|
[HTML comments][html-comment] within Markdown content
|
|
310
290
|
- For example: `<!-- markdownlint-disable some-rule -->`
|
|
@@ -348,7 +328,7 @@ of the rules within.
|
|
|
348
328
|
|
|
349
329
|
- The format of this file is a [CommonJS module][commonjs-module] (`.cjs`) or
|
|
350
330
|
[ECMAScript module][ecmascript-module] (`.mjs`) that exports the object
|
|
351
|
-
described above for `.markdownlint-cli2.jsonc
|
|
331
|
+
described above for `.markdownlint-cli2.jsonc` (directly or from a `Promise`).
|
|
352
332
|
- Instead of passing a `String` to identify the module name/path to load for
|
|
353
333
|
`customRules`, `markdownItPlugins`, and `outputFormatters`, the corresponding
|
|
354
334
|
`Object` or `Function` can be provided directly.
|
|
@@ -388,7 +368,8 @@ of the rules within.
|
|
|
388
368
|
|
|
389
369
|
- The format of this file is a [CommonJS module][commonjs-module] (`.cjs`) or
|
|
390
370
|
[ECMAScript module][ecmascript-module] (`.mjs`) that exports the
|
|
391
|
-
[`markdownlint` `config` object][markdownlint-config]
|
|
371
|
+
[`markdownlint` `config` object][markdownlint-config] (directly or from a
|
|
372
|
+
`Promise`).
|
|
392
373
|
- Other details are the same as for `jsonc`/`json` files described above.
|
|
393
374
|
- For example: [`.markdownlint.cjs`][markdownlint-cjs] or
|
|
394
375
|
[`.markdownlint.mjs`][markdownlint-mjs]
|
|
@@ -415,7 +396,7 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like:
|
|
|
415
396
|
|
|
416
397
|
```yaml
|
|
417
398
|
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
|
418
|
-
rev: v0.
|
|
399
|
+
rev: v0.12.0
|
|
419
400
|
hooks:
|
|
420
401
|
- id: markdownlint-cli2
|
|
421
402
|
```
|
|
@@ -425,8 +406,10 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like:
|
|
|
425
406
|
|
|
426
407
|
## History
|
|
427
408
|
|
|
428
|
-
See [CHANGELOG.md]
|
|
409
|
+
See [CHANGELOG.md][changelog].
|
|
429
410
|
|
|
411
|
+
[changelog]: CHANGELOG.md
|
|
412
|
+
[command-line]: #command-line
|
|
430
413
|
[commonmark]: https://commonmark.org/
|
|
431
414
|
[commonjs-module]: https://nodejs.org/api/modules.html#modules_modules_commonjs_modules
|
|
432
415
|
[ecmascript-module]: https://nodejs.org/api/esm.html#modules-ecmascript-modules
|
|
@@ -440,6 +423,7 @@ See [CHANGELOG.md](CHANGELOG.md).
|
|
|
440
423
|
[homebrew]: https://brew.sh
|
|
441
424
|
[html-comment]: https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started
|
|
442
425
|
[json]: https://wikipedia.org/wiki/JSON
|
|
426
|
+
[json-schema]: https://json-schema.org
|
|
443
427
|
[jsonc]: https://code.visualstudio.com/Docs/languages/json#_json-with-comments
|
|
444
428
|
[license-image]: https://img.shields.io/npm/l/markdownlint-cli2.svg
|
|
445
429
|
[license-url]: https://opensource.org/licenses/MIT
|
|
@@ -448,26 +432,27 @@ See [CHANGELOG.md](CHANGELOG.md).
|
|
|
448
432
|
[markdown-it-plugins]: https://www.npmjs.com/search?q=keywords:markdown-it-plugin
|
|
449
433
|
[markdown-it-syntax-extensions]: https://github.com/markdown-it/markdown-it#syntax-extensions
|
|
450
434
|
[markdownlint]: https://github.com/DavidAnson/markdownlint
|
|
451
|
-
[markdownlint-config]: https://github.com/DavidAnson/markdownlint/blob/
|
|
452
|
-
[markdownlint-configuration]: https://github.com/DavidAnson/markdownlint/blob/
|
|
453
|
-
[markdownlint-custom-rules]: https://github.com/DavidAnson/markdownlint/blob/
|
|
454
|
-
[markdownlint-options]: https://github.com/DavidAnson/markdownlint/blob/
|
|
455
|
-
[markdownlint-rules-aliases]: https://github.com/DavidAnson/markdownlint/blob/
|
|
456
|
-
[markdownlint-rules-tags]: https://github.com/DavidAnson/markdownlint/blob/
|
|
435
|
+
[markdownlint-config]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#optionsconfig
|
|
436
|
+
[markdownlint-configuration]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#configuration
|
|
437
|
+
[markdownlint-custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/CustomRules.md
|
|
438
|
+
[markdownlint-options]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#options
|
|
439
|
+
[markdownlint-rules-aliases]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#rules--aliases
|
|
440
|
+
[markdownlint-rules-tags]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/README.md#tags
|
|
457
441
|
[markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
|
|
458
442
|
[markdownlint-cli2]: https://github.com/DavidAnson/markdownlint-cli2
|
|
459
443
|
[markdownlint-cli2-action]: https://github.com/marketplace/actions/markdownlint-cli2-action
|
|
460
444
|
[markdownlint-cli2-blog]: https://dlaa.me/blog/post/markdownlintcli2
|
|
461
|
-
[markdownlint-cli2-formatter]: https://www.npmjs.com/search?q=keywords:markdownlint-cli2-formatter
|
|
462
445
|
[markdownlint-cli2-cjs]: test/markdownlint-cli2-cjs/.markdownlint-cli2.cjs
|
|
446
|
+
[markdownlint-cli2-config-schema]: schema/markdownlint-cli2-config-schema.json
|
|
447
|
+
[markdownlint-cli2-formatter]: https://www.npmjs.com/search?q=keywords:markdownlint-cli2-formatter
|
|
463
448
|
[markdownlint-cli2-jsonc]: test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc
|
|
464
449
|
[markdownlint-cli2-mjs]: test/markdownlint-cli2-mjs/.markdownlint-cli2.mjs
|
|
465
450
|
[markdownlint-cli2-yaml]: test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml
|
|
466
451
|
[markdownlint-cjs]: test/markdownlint-cjs/.markdownlint.cjs
|
|
467
|
-
[markdownlint-jsonc]: https://github.com/DavidAnson/markdownlint/blob/
|
|
452
|
+
[markdownlint-jsonc]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/schema/.markdownlint.jsonc
|
|
468
453
|
[markdownlint-mjs]: test/markdownlint-mjs/.markdownlint.mjs
|
|
469
454
|
[markdownlint-rule]: https://www.npmjs.com/search?q=keywords:markdownlint-rule
|
|
470
|
-
[markdownlint-yaml]: https://github.com/DavidAnson/markdownlint/blob/
|
|
455
|
+
[markdownlint-yaml]: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/schema/.markdownlint.yaml
|
|
471
456
|
[nodejs]: https://nodejs.org/
|
|
472
457
|
[nodejs-docker]: https://github.com/nodejs/docker-node
|
|
473
458
|
[nodejs-docker-non-root]: https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
|
|
@@ -483,6 +468,7 @@ See [CHANGELOG.md](CHANGELOG.md).
|
|
|
483
468
|
[pre-commit-version]: https://pre-commit.com/#overriding-language-version
|
|
484
469
|
[regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
485
470
|
[regexp-constructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp
|
|
471
|
+
[validating-configuration]: schema/ValidatingConfiguration.md
|
|
486
472
|
[vscode]: https://code.visualstudio.com/
|
|
487
473
|
[vscode-markdownlint]: https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
|
|
488
474
|
[yaml]: https://wikipedia.org/wiki/YAML
|