markdownlint-cli 0.49.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 CHANGED
@@ -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.49.0
145
+ rev: v0.49.1
146
146
  hooks:
147
147
  - id: markdownlint
148
148
  ```
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.49.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 jsConfigFile = /\.c?js$/iv.test(userConfigFile);
82
- const userConfig = jsConfigFile ? require(path.resolve(processCwd, userConfigFile)) : readConfig(userConfigFile, configParsers);
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, description, severity} = result;
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 files = prepareFileList(program.args, ['md', 'markdown']).filter(value => ignoreFilter(value));
285
- const ignores = prepareFileList(options.ignore, null, files);
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 = files.filter(file => !ignores.some(ignore => ignore.absolute === file.absolute)).map(paths => paths.original);
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 (files.length > 0 && !options.stdin) {
338
+ if (inputs.length > 0 && !options.stdin) {
338
339
  lintAndPrint(null, diff);
339
- } else if (files.length === 0 && options.stdin && !options.fix) {
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.49.0",
3
+ "version": "0.49.1",
4
4
  "description": "MarkdownLint Command Line Interface",
5
5
  "type": "module",
6
6
  "main": "markdownlint.js",
@@ -40,24 +40,25 @@
40
40
  "dependencies": {
41
41
  "commander": "~15.0.0",
42
42
  "deep-extend": "~0.6.0",
43
- "ignore": "~7.0.5",
44
- "js-yaml": "~4.2.0",
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.41.0",
48
- "markdown-it": "~14.2.0",
47
+ "markdownlint": "~0.41.1",
48
+ "markdown-it": "~14.3.0",
49
49
  "minimatch": "~10.2.5",
50
- "run-con": "~1.3.2",
51
- "smol-toml": "~1.6.1",
50
+ "run-con": "~1.3.3",
51
+ "smol-toml": "~1.7.0",
52
52
  "tinyglobby": "~0.2.17"
53
53
  },
54
54
  "devDependencies": {
55
55
  "ava": "^8.0.1",
56
56
  "markdownlint-cli-local-test-rule": "./test/custom-rules/markdownlint-cli-local-test-rule",
57
57
  "nano-spawn": "^2.1.0",
58
- "xo": "^2.0.2"
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