markdownlint-cli 0.48.0 → 0.49.1
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 +1 -1
- package/markdownlint.js +19 -18
- package/package.json +17 -14
package/README.md
CHANGED
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.49.1';
|
|
20
20
|
const description = 'MarkdownLint Command Line Interface';
|
|
21
21
|
|
|
22
22
|
function markdownItFactory() {
|
|
@@ -51,7 +51,7 @@ const exitCodes = {
|
|
|
51
51
|
lintErrorsPresent: 1,
|
|
52
52
|
failedToWriteOutputFile: 2,
|
|
53
53
|
failedToLoadCustomRules: 3,
|
|
54
|
-
unexpectedError: 4
|
|
54
|
+
unexpectedError: 4,
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
const projectConfigFiles = ['.markdownlint.jsonc', '.markdownlint.json', '.markdownlint.yaml', '.markdownlint.yml'];
|
|
@@ -78,8 +78,8 @@ function readConfiguration(userConfigFile) {
|
|
|
78
78
|
// However I have to do it to overwrite configuration from .markdownlint.{jsonc,json,yaml,yml}.
|
|
79
79
|
if (userConfigFile) {
|
|
80
80
|
try {
|
|
81
|
-
const
|
|
82
|
-
const userConfig =
|
|
81
|
+
const isJsConfigFile = /\.c?js$/iv.test(userConfigFile);
|
|
82
|
+
const userConfig = isJsConfigFile ? require(path.resolve(processCwd, userConfigFile)) : readConfig(userConfigFile, configParsers);
|
|
83
83
|
config = require('deep-extend')(config, userConfig);
|
|
84
84
|
} catch (error) {
|
|
85
85
|
console.error(`Cannot read or parse config file '${userConfigFile}': ${error.message}`);
|
|
@@ -95,7 +95,7 @@ function prepareFileList(files, fileExtensions, previousResults) {
|
|
|
95
95
|
dot: Boolean(options.dot),
|
|
96
96
|
onlyFiles: true,
|
|
97
97
|
expandDirectories: false,
|
|
98
|
-
caseSensitiveMatch: !(os.platform() === 'win32' || os.platform() === 'darwin')
|
|
98
|
+
caseSensitiveMatch: !(os.platform() === 'win32' || os.platform() === 'darwin'),
|
|
99
99
|
};
|
|
100
100
|
let extensionGlobPart = '*.';
|
|
101
101
|
if (!fileExtensions) {
|
|
@@ -135,7 +135,7 @@ function prepareFileList(files, fileExtensions, previousResults) {
|
|
|
135
135
|
return files.flat().map(file => ({
|
|
136
136
|
original: file,
|
|
137
137
|
relative: path.relative(processCwd, file),
|
|
138
|
-
absolute: path.resolve(file)
|
|
138
|
+
absolute: path.resolve(file),
|
|
139
139
|
}));
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -145,7 +145,7 @@ function printResult(lintResult) {
|
|
|
145
145
|
if (options.json) {
|
|
146
146
|
return {
|
|
147
147
|
fileName: file,
|
|
148
|
-
...result
|
|
148
|
+
...result,
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -155,9 +155,9 @@ function printResult(lintResult) {
|
|
|
155
155
|
column: (result.errorRange && result.errorRange[0]) || 0,
|
|
156
156
|
names: result.ruleNames.join('/'),
|
|
157
157
|
description: result.ruleDescription + (result.errorDetail ? ' [' + result.errorDetail + ']' : '') + (result.errorContext ? ' [Context: "' + result.errorContext + '"]' : ''),
|
|
158
|
-
severity: result.severity
|
|
158
|
+
severity: result.severity,
|
|
159
159
|
};
|
|
160
|
-
})
|
|
160
|
+
}),
|
|
161
161
|
);
|
|
162
162
|
|
|
163
163
|
let lintResultString = '';
|
|
@@ -170,9 +170,9 @@ function printResult(lintResult) {
|
|
|
170
170
|
|
|
171
171
|
lintResultString = results
|
|
172
172
|
.map(result => {
|
|
173
|
-
const {file, lineNumber, column, names,
|
|
173
|
+
const {file, lineNumber, column, names, severity} = result;
|
|
174
174
|
const columnText = column ? `:${column}` : '';
|
|
175
|
-
return `${file}:${lineNumber}${columnText} ${severity} ${names} ${description}`;
|
|
175
|
+
return `${file}:${lineNumber}${columnText} ${severity} ${names} ${result.description}`;
|
|
176
176
|
})
|
|
177
177
|
.join('\n');
|
|
178
178
|
}
|
|
@@ -273,6 +273,7 @@ if (options.ignorePath) {
|
|
|
273
273
|
existsSync = () => true;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
// eslint-disable-next-line unicorn/consistent-boolean-name
|
|
276
277
|
let ignoreFilter = () => true;
|
|
277
278
|
if (existsSync(ignorePath)) {
|
|
278
279
|
const ignoreText = fs.readFileSync(ignorePath, fsOptions);
|
|
@@ -281,10 +282,10 @@ if (existsSync(ignorePath)) {
|
|
|
281
282
|
ignoreFilter = fileInfo => !ignoreInstance.ignores(fileInfo.relative);
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
const
|
|
285
|
-
const ignores = prepareFileList(options.ignore, null,
|
|
285
|
+
const inputs = prepareFileList(program.args, ['md', 'markdown']).filter(value => ignoreFilter(value));
|
|
286
|
+
const ignores = prepareFileList(options.ignore, null, inputs);
|
|
286
287
|
const customRules = loadCustomRules(options.rules);
|
|
287
|
-
const diff =
|
|
288
|
+
const diff = inputs.filter(file => ignores.every(ignore => ignore.absolute !== file.absolute)).map(paths => paths.original);
|
|
288
289
|
|
|
289
290
|
function lintAndPrint(stdin, files) {
|
|
290
291
|
files ||= [];
|
|
@@ -305,11 +306,11 @@ function lintAndPrint(stdin, files) {
|
|
|
305
306
|
config,
|
|
306
307
|
configParsers,
|
|
307
308
|
customRules,
|
|
308
|
-
files
|
|
309
|
+
files,
|
|
309
310
|
};
|
|
310
311
|
if (stdin) {
|
|
311
312
|
lintOptions.strings = {
|
|
312
|
-
stdin
|
|
313
|
+
stdin,
|
|
313
314
|
};
|
|
314
315
|
}
|
|
315
316
|
|
|
@@ -334,9 +335,9 @@ function lintAndPrint(stdin, files) {
|
|
|
334
335
|
}
|
|
335
336
|
|
|
336
337
|
try {
|
|
337
|
-
if (
|
|
338
|
+
if (inputs.length > 0 && !options.stdin) {
|
|
338
339
|
lintAndPrint(null, diff);
|
|
339
|
-
} else if (
|
|
340
|
+
} else if (inputs.length === 0 && options.stdin && !options.fix) {
|
|
340
341
|
import('node:stream/consumers').then(module => module.text(process.stdin)).then(lintAndPrint);
|
|
341
342
|
} else {
|
|
342
343
|
program.help();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdownlint-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "MarkdownLint Command Line Interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "markdownlint.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"markdownlint": "markdownlint.js"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
11
|
+
"node": ">=22"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"invalid": "node ./markdownlint.js --config test/test-config.json -- test/incorrect.md",
|
|
@@ -38,26 +38,27 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/igorshubovych/markdownlint-cli#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"commander": "~
|
|
41
|
+
"commander": "~15.0.0",
|
|
42
42
|
"deep-extend": "~0.6.0",
|
|
43
|
-
"ignore": "~7.0.
|
|
44
|
-
"js-yaml": "~
|
|
43
|
+
"ignore": "~7.0.6",
|
|
44
|
+
"js-yaml": "~5.2.1",
|
|
45
45
|
"jsonc-parser": "~3.3.1",
|
|
46
46
|
"jsonpointer": "~5.0.1",
|
|
47
|
-
"markdownlint": "~0.
|
|
48
|
-
"markdown-it": "~14.
|
|
49
|
-
"minimatch": "~10.2.
|
|
50
|
-
"run-con": "~1.3.
|
|
51
|
-
"smol-toml": "~1.
|
|
52
|
-
"tinyglobby": "~0.2.
|
|
47
|
+
"markdownlint": "~0.41.1",
|
|
48
|
+
"markdown-it": "~14.3.0",
|
|
49
|
+
"minimatch": "~10.2.5",
|
|
50
|
+
"run-con": "~1.3.3",
|
|
51
|
+
"smol-toml": "~1.7.0",
|
|
52
|
+
"tinyglobby": "~0.2.17"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"ava": "^
|
|
55
|
+
"ava": "^8.0.1",
|
|
56
56
|
"markdownlint-cli-local-test-rule": "./test/custom-rules/markdownlint-cli-local-test-rule",
|
|
57
|
-
"nano-spawn": "^2.
|
|
58
|
-
"xo": "^
|
|
57
|
+
"nano-spawn": "^2.1.0",
|
|
58
|
+
"xo": "^4.0.0"
|
|
59
59
|
},
|
|
60
60
|
"xo": {
|
|
61
|
+
"files": "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,svelte,astro,html}",
|
|
61
62
|
"prettier": true,
|
|
62
63
|
"space": true,
|
|
63
64
|
"rules": {
|
|
@@ -67,6 +68,8 @@
|
|
|
67
68
|
"prefer-arrow-callback": 0,
|
|
68
69
|
"promise/prefer-await-to-then": 0,
|
|
69
70
|
"object-shorthand": 0,
|
|
71
|
+
"regexp/prefer-named-capture-group": 0,
|
|
72
|
+
"unicorn/max-nested-calls": 0,
|
|
70
73
|
"unicorn/prefer-module": 0,
|
|
71
74
|
"unicorn/prefer-ternary": 0,
|
|
72
75
|
"unicorn/prefer-top-level-await": 0
|