markdownlint-cli 0.46.0 → 0.48.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 +10 -10
- package/markdownlint.js +16 -12
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Options:
|
|
|
33
33
|
-c, --config <configFile> configuration file (JSON, JSONC, JS, YAML, or TOML)
|
|
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
|
-
-f, --fix fix basic
|
|
36
|
+
-f, --fix fix basic issues (does not work with STDIN)
|
|
37
37
|
-i, --ignore <file|directory|glob> file(s) to ignore/exclude (default: [])
|
|
38
38
|
-j, --json write issues in json format
|
|
39
39
|
-o, --output <outputFile> write issues to file (no console)
|
|
@@ -81,12 +81,12 @@ The order of operations is:
|
|
|
81
81
|
- Apply exclusions from `-p`/`--ignore-path` (if specified) or `.markdownlintignore` (if present)
|
|
82
82
|
- Apply exclusions from any `-i`/`--ignore` option(s) that are specified
|
|
83
83
|
|
|
84
|
-
### Fixing
|
|
84
|
+
### Fixing issues
|
|
85
85
|
|
|
86
|
-
When the `--fix` option is specified, `markdownlint-cli` tries to apply all fixes reported by the active rules and reports any
|
|
86
|
+
When the `--fix` option is specified, `markdownlint-cli` tries to apply all fixes reported by the active rules and reports any issues that remain.
|
|
87
87
|
Because this option makes changes to the input files, it is good to make a backup first or work with files under source control so any unwanted changes can be undone.
|
|
88
88
|
|
|
89
|
-
> Because not all rules include fix information when reporting
|
|
89
|
+
> Because not all rules include fix information when reporting issues, fixes may overlap, and not all issues are fixable, `--fix` will not usually address all issues.
|
|
90
90
|
|
|
91
91
|
## Configuration
|
|
92
92
|
|
|
@@ -130,11 +130,11 @@ If a rule is passed to both `--enable` and `--disable`, it will be disabled.
|
|
|
130
130
|
|
|
131
131
|
`markdownlint-cli` returns one of the following exit codes:
|
|
132
132
|
|
|
133
|
-
- `0`:
|
|
134
|
-
- `1`: Linting errors
|
|
133
|
+
- `0`: Linting successful, no errors (warnings possible)
|
|
134
|
+
- `1`: Linting successful, some errors (warnings possible)
|
|
135
135
|
- `2`: Unable to write `-o`/`--output` output file
|
|
136
136
|
- `3`: Unable to load `-r`/`--rules` custom rule
|
|
137
|
-
- `4`: Unexpected
|
|
137
|
+
- `4`: Unexpected problem (e.g. malformed config)
|
|
138
138
|
|
|
139
139
|
## Use with pre-commit
|
|
140
140
|
|
|
@@ -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.
|
|
145
|
+
rev: v0.48.0
|
|
146
146
|
hooks:
|
|
147
147
|
- id: markdownlint
|
|
148
148
|
```
|
|
@@ -160,8 +160,8 @@ To run `markdownlint-cli` as part of a [pre-commit][pre-commit] workflow, add so
|
|
|
160
160
|
|
|
161
161
|
MIT © Igor Shubovych
|
|
162
162
|
|
|
163
|
-
[actions-badge]: https://github.com/igorshubovych/markdownlint-cli/workflows/
|
|
164
|
-
[actions-url]: https://github.com/igorshubovych/markdownlint-cli/actions
|
|
163
|
+
[actions-badge]: https://github.com/igorshubovych/markdownlint-cli/actions/workflows/ci.yml/badge.svg
|
|
164
|
+
[actions-url]: https://github.com/igorshubovych/markdownlint-cli/actions/workflows/ci.yml
|
|
165
165
|
[commander-variadic]: https://github.com/tj/commander.js#variadic-option
|
|
166
166
|
[json-pointer]: https://datatracker.ietf.org/doc/html/rfc6901
|
|
167
167
|
[markdownlint]: https://github.com/DavidAnson/markdownlint
|
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.
|
|
19
|
+
const version = '0.48.0';
|
|
20
20
|
const description = 'MarkdownLint Command Line Interface';
|
|
21
21
|
|
|
22
22
|
function markdownItFactory() {
|
|
@@ -48,7 +48,7 @@ function tomlParse(text) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const exitCodes = {
|
|
51
|
-
|
|
51
|
+
lintErrorsPresent: 1,
|
|
52
52
|
failedToWriteOutputFile: 2,
|
|
53
53
|
failedToLoadCustomRules: 3,
|
|
54
54
|
unexpectedError: 4
|
|
@@ -154,7 +154,8 @@ function printResult(lintResult) {
|
|
|
154
154
|
lineNumber: result.lineNumber,
|
|
155
155
|
column: (result.errorRange && result.errorRange[0]) || 0,
|
|
156
156
|
names: result.ruleNames.join('/'),
|
|
157
|
-
description: result.ruleDescription + (result.errorDetail ? ' [' + result.errorDetail + ']' : '') + (result.errorContext ? ' [Context: "' + result.errorContext + '"]' : '')
|
|
157
|
+
description: result.ruleDescription + (result.errorDetail ? ' [' + result.errorDetail + ']' : '') + (result.errorContext ? ' [Context: "' + result.errorContext + '"]' : ''),
|
|
158
|
+
severity: result.severity
|
|
158
159
|
};
|
|
159
160
|
})
|
|
160
161
|
);
|
|
@@ -169,19 +170,22 @@ function printResult(lintResult) {
|
|
|
169
170
|
|
|
170
171
|
lintResultString = results
|
|
171
172
|
.map(result => {
|
|
172
|
-
const {file, lineNumber, column, names, description} = result;
|
|
173
|
+
const {file, lineNumber, column, names, description, severity} = result;
|
|
173
174
|
const columnText = column ? `:${column}` : '';
|
|
174
|
-
return `${file}:${lineNumber}${columnText} ${names} ${description}`;
|
|
175
|
+
return `${file}:${lineNumber}${columnText} ${severity} ${names} ${description}`;
|
|
175
176
|
})
|
|
176
177
|
.join('\n');
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
const errorsPresent = results.some(result => result.severity === 'error');
|
|
181
|
+
if (errorsPresent) {
|
|
182
|
+
// Note: process.exit(1) will end abruptly, interrupting asynchronous IO
|
|
183
|
+
// streams (e.g., when the output is being piped). Just set the exit code
|
|
184
|
+
// and let the program terminate normally.
|
|
185
|
+
// @see {@link https://nodejs.org/dist/latest-v8.x/docs/api/process.html#process_process_exit_code}
|
|
186
|
+
// @see {@link https://github.com/igorshubovych/markdownlint-cli/pull/29#issuecomment-343535291}
|
|
187
|
+
process.exitCode = exitCodes.lintErrorsPresent;
|
|
188
|
+
}
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
if (options.output) {
|
|
@@ -208,7 +212,7 @@ program
|
|
|
208
212
|
.option('-c, --config <configFile>', 'configuration file (JSON, JSONC, JS, YAML, or TOML)')
|
|
209
213
|
.option('--configPointer <pointer>', 'JSON Pointer to object within configuration file', '')
|
|
210
214
|
.option('-d, --dot', 'include files/folders with a dot (for example `.github`)')
|
|
211
|
-
.option('-f, --fix', 'fix basic
|
|
215
|
+
.option('-f, --fix', 'fix basic issues (does not work with STDIN)')
|
|
212
216
|
.option('-i, --ignore <file|directory|glob>', 'file(s) to ignore/exclude', concatArray, [])
|
|
213
217
|
.option('-j, --json', 'write issues in json format')
|
|
214
218
|
.option('-o, --output <outputFile>', 'write issues to file (no console)')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdownlint-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "MarkdownLint Command Line Interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "markdownlint.js",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/igorshubovych/markdownlint-cli#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"commander": "~14.0.
|
|
41
|
+
"commander": "~14.0.3",
|
|
42
42
|
"deep-extend": "~0.6.0",
|
|
43
43
|
"ignore": "~7.0.5",
|
|
44
44
|
"js-yaml": "~4.1.1",
|
|
45
45
|
"jsonc-parser": "~3.3.1",
|
|
46
46
|
"jsonpointer": "~5.0.1",
|
|
47
|
-
"markdownlint": "~0.
|
|
48
|
-
"markdown-it": "~14.1.
|
|
49
|
-
"minimatch": "~10.
|
|
47
|
+
"markdownlint": "~0.40.0",
|
|
48
|
+
"markdown-it": "~14.1.1",
|
|
49
|
+
"minimatch": "~10.2.4",
|
|
50
50
|
"run-con": "~1.3.2",
|
|
51
|
-
"smol-toml": "~1.
|
|
51
|
+
"smol-toml": "~1.6.0",
|
|
52
52
|
"tinyglobby": "~0.2.15"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"ava": "^
|
|
55
|
+
"ava": "^7.0.0",
|
|
56
56
|
"markdownlint-cli-local-test-rule": "./test/custom-rules/markdownlint-cli-local-test-rule",
|
|
57
57
|
"nano-spawn": "^2.0.0",
|
|
58
58
|
"xo": "^1.2.3"
|