markdownlint-cli 0.32.2 → 0.34.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 +4 -1
- package/markdownlint.js +12 -11
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -107,6 +107,7 @@ For more examples, see [.markdownlint.jsonc][markdownlint-jsonc], [.markdownlint
|
|
|
107
107
|
The CLI argument `--config` is not required.
|
|
108
108
|
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.
|
|
109
109
|
The algorithm is described in detail on the [`rc` package page][rc-standards].
|
|
110
|
+
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.
|
|
110
111
|
If the `--config` argument is provided, the file must be valid JSON, JSONC, JS, or YAML.
|
|
111
112
|
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.
|
|
112
113
|
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**.
|
|
@@ -133,7 +134,7 @@ To run `markdownlint-cli` as part of a [pre-commit][pre-commit] workflow, add so
|
|
|
133
134
|
|
|
134
135
|
```yaml
|
|
135
136
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
136
|
-
rev: v0.
|
|
137
|
+
rev: v0.34.0
|
|
137
138
|
hooks:
|
|
138
139
|
- id: markdownlint
|
|
139
140
|
```
|
|
@@ -143,6 +144,7 @@ To run `markdownlint-cli` as part of a [pre-commit][pre-commit] workflow, add so
|
|
|
143
144
|
## Related
|
|
144
145
|
|
|
145
146
|
- [markdownlint][markdownlint] - API for this module
|
|
147
|
+
- [markdownlint-cli2][markdownlint-cli2] - Alternate CLI implementation
|
|
146
148
|
- [glob][glob] - Pattern matching implementation
|
|
147
149
|
- [ignore][ignore] - `.markdownlintignore` implementation
|
|
148
150
|
|
|
@@ -154,6 +156,7 @@ MIT © Igor Shubovych
|
|
|
154
156
|
[actions-url]: https://github.com/igorshubovych/markdownlint-cli/actions?query=workflow%3ACI
|
|
155
157
|
[commander-variadic]: https://github.com/tj/commander.js#variadic-option
|
|
156
158
|
[markdownlint]: https://github.com/DavidAnson/markdownlint
|
|
159
|
+
[markdownlint-cli2]: https://github.com/DavidAnson/markdownlint-cli2
|
|
157
160
|
[markdownlint-jsonc]: https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc
|
|
158
161
|
[markdownlint-yaml]: https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
|
|
159
162
|
[rules]: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
|
package/markdownlint.js
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const Module = require('module');
|
|
8
|
-
const os = require('os');
|
|
9
|
-
const process = require('process');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const Module = require('node:module');
|
|
8
|
+
const os = require('node:os');
|
|
9
|
+
const process = require('node:process');
|
|
10
10
|
const program = require('commander');
|
|
11
|
-
|
|
12
|
-
const options = program.opts();
|
|
13
11
|
const glob = require('glob');
|
|
14
12
|
const markdownlint = require('markdownlint');
|
|
15
13
|
const rc = require('run-con');
|
|
16
14
|
const minimatch = require('minimatch');
|
|
17
15
|
const pkg = require('./package.json');
|
|
18
16
|
|
|
17
|
+
const options = program.opts();
|
|
18
|
+
|
|
19
19
|
function posixPath(p) {
|
|
20
20
|
return p.split(path.sep).join(path.posix.sep);
|
|
21
21
|
}
|
|
@@ -36,7 +36,7 @@ const exitCodes = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const projectConfigFiles = ['.markdownlint.jsonc', '.markdownlint.json', '.markdownlint.yaml', '.markdownlint.yml'];
|
|
39
|
-
const
|
|
39
|
+
const configParsers = [jsoncParse, jsYamlSafeLoad];
|
|
40
40
|
const fsOptions = {encoding: 'utf8'};
|
|
41
41
|
const processCwd = process.cwd();
|
|
42
42
|
|
|
@@ -48,7 +48,7 @@ function readConfiguration(userConfigFile) {
|
|
|
48
48
|
for (const projectConfigFile of projectConfigFiles) {
|
|
49
49
|
try {
|
|
50
50
|
fs.accessSync(projectConfigFile, fs.R_OK);
|
|
51
|
-
const projectConfig = markdownlint.readConfigSync(projectConfigFile,
|
|
51
|
+
const projectConfig = markdownlint.readConfigSync(projectConfigFile, configParsers);
|
|
52
52
|
config = {...config, ...projectConfig};
|
|
53
53
|
break;
|
|
54
54
|
} catch {
|
|
@@ -60,7 +60,7 @@ function readConfiguration(userConfigFile) {
|
|
|
60
60
|
// However I have to do it to overwrite configuration from .markdownlint.{json,yaml,yml}.
|
|
61
61
|
if (userConfigFile) {
|
|
62
62
|
try {
|
|
63
|
-
const userConfig = jsConfigFile ? require(path.resolve(processCwd, userConfigFile)) : markdownlint.readConfigSync(userConfigFile,
|
|
63
|
+
const userConfig = jsConfigFile ? require(path.resolve(processCwd, userConfigFile)) : markdownlint.readConfigSync(userConfigFile, configParsers);
|
|
64
64
|
config = require('deep-extend')(config, userConfig);
|
|
65
65
|
} catch (error) {
|
|
66
66
|
console.error(`Cannot read or parse config file '${userConfigFile}': ${error.message}`);
|
|
@@ -274,6 +274,7 @@ function lintAndPrint(stdin, files) {
|
|
|
274
274
|
|
|
275
275
|
const lintOptions = {
|
|
276
276
|
config,
|
|
277
|
+
configParsers,
|
|
277
278
|
customRules,
|
|
278
279
|
files
|
|
279
280
|
};
|
|
@@ -292,7 +293,7 @@ function lintAndPrint(stdin, files) {
|
|
|
292
293
|
...lintOptions,
|
|
293
294
|
resultVersion: 3
|
|
294
295
|
};
|
|
295
|
-
const markdownlintRuleHelpers = require('markdownlint
|
|
296
|
+
const markdownlintRuleHelpers = require('markdownlint/helpers');
|
|
296
297
|
for (const file of files) {
|
|
297
298
|
fixOptions.files = [file];
|
|
298
299
|
const fixResult = markdownlint.sync(fixOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdownlint-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "MarkdownLint Command Line Interface",
|
|
5
5
|
"main": "markdownlint.js",
|
|
6
6
|
"bin": {
|
|
@@ -37,22 +37,21 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/igorshubovych/markdownlint-cli#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"commander": "~
|
|
40
|
+
"commander": "~10.0.1",
|
|
41
41
|
"get-stdin": "~9.0.0",
|
|
42
|
-
"glob": "~
|
|
43
|
-
"ignore": "~5.2.
|
|
42
|
+
"glob": "~10.2.2",
|
|
43
|
+
"ignore": "~5.2.4",
|
|
44
44
|
"js-yaml": "^4.1.0",
|
|
45
|
-
"jsonc-parser": "~3.
|
|
46
|
-
"markdownlint": "~0.
|
|
47
|
-
"
|
|
48
|
-
"minimatch": "~5.1.0",
|
|
45
|
+
"jsonc-parser": "~3.2.0",
|
|
46
|
+
"markdownlint": "~0.28.2",
|
|
47
|
+
"minimatch": "~9.0.0",
|
|
49
48
|
"run-con": "~1.2.11"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"ava": "^
|
|
53
|
-
"execa": "^
|
|
54
|
-
"test-rule
|
|
55
|
-
"xo": "^0.
|
|
51
|
+
"ava": "^5.2.0",
|
|
52
|
+
"execa": "^7.1.1",
|
|
53
|
+
"markdownlint-cli-local-test-rule": "./test/custom-rules/markdownlint-cli-local-test-rule",
|
|
54
|
+
"xo": "^0.54.2"
|
|
56
55
|
},
|
|
57
56
|
"xo": {
|
|
58
57
|
"prettier": true,
|
|
@@ -65,7 +64,8 @@
|
|
|
65
64
|
"promise/prefer-await-to-then": 0,
|
|
66
65
|
"object-shorthand": 0,
|
|
67
66
|
"unicorn/prefer-module": 0,
|
|
68
|
-
"unicorn/prefer-ternary": 0
|
|
67
|
+
"unicorn/prefer-ternary": 0,
|
|
68
|
+
"unicorn/prefer-top-level-await": 0
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"prettier": {
|