markdownlint-cli2 0.1.3 → 0.2.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 CHANGED
@@ -68,11 +68,11 @@ Configuration via:
68
68
  - .markdownlint.js
69
69
 
70
70
  Cross-platform compatibility:
71
- - UNIX and Windows shells expand globs according to different rules, so quoting glob arguments is recommended
72
- - Shells that expand globs do not support negated patterns (!node_modules), so quoting negated globs is required
73
- - Some Windows shells do not handle single-quoted (') arguments correctly, so double-quotes (") are recommended
74
- - Some UNIX shells handle exclamation (!) in double-quotes specially, so hashtag (#) is recommended for negated globs
75
- - Some shells use backslash (\) to escape special characters, so forward slash (/) is the recommended path separator
71
+ - UNIX and Windows shells expand globs according to different rules; quoting arguments is recommended
72
+ - Some Windows shells don't handle single-quoted (') arguments well; double-quote (") is recommended
73
+ - Shells that expand globs do not support negated patterns (!node_modules); quoting is required here
74
+ - Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases
75
+ - The path separator is forward slash (/) on all platforms; backslash (\) is automatically converted
76
76
 
77
77
  Therefore, the most compatible glob syntax for cross-platform support:
78
78
  $ markdownlint-cli2 "**/*.md" "#node_modules"
@@ -266,7 +266,7 @@ in both cases), these two commands behave identically.
266
266
 
267
267
  ### `vscode-markdownlint`
268
268
 
269
- - `.markdownlintrc` and `.markdownlintignore` are not supported.
269
+ - `.markdownlintignore` is not supported.
270
270
 
271
271
  ## pre-commit
272
272
 
@@ -275,7 +275,7 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like:
275
275
 
276
276
  ```yaml
277
277
  - repo: https://github.com/DavidAnson/markdownlint-cli2
278
- rev: v0.1.3
278
+ rev: v0.2.0
279
279
  hooks:
280
280
  - id: markdownlint-cli2
281
281
  ```
@@ -303,6 +303,7 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like:
303
303
  - 0.1.1 - Restore previous use of `require`
304
304
  - 0.1.2 - Update use of `require` to be more flexible
305
305
  - 0.1.3 - Support rule collections
306
+ - 0.2.0 - Improve handling of Windows paths using backslash
306
307
 
307
308
  <!-- markdownlint-disable line-length -->
308
309
 
@@ -23,7 +23,7 @@ const resolveAndRequire = require("./resolve-and-require");
23
23
 
24
24
  // Variables
25
25
  const packageName = "markdownlint-cli2";
26
- const packageVersion = "0.1.3";
26
+ const packageVersion = "0.2.0";
27
27
  const libraryName = "markdownlint";
28
28
  const libraryVersion = markdownlintLibrary.getVersion();
29
29
  const dotOnlySubstitute = "*.{md,markdown}";
@@ -93,7 +93,9 @@ const requireConfig = (dir, name, noRequire) => {
93
93
 
94
94
  // Process command-line arguments and return glob patterns
95
95
  const processArgv = (argv) => {
96
- const globPatterns = argv.map((glob) => glob.replace(/^#/u, "!"));
96
+ const globPatterns = argv.map(
97
+ (glob) => glob.replace(/^#/u, "!").replace(/\\(?![$()*+?[\]^])/gu, "/")
98
+ );
97
99
  if ((globPatterns.length === 1) && (globPatterns[0] === ".")) {
98
100
  // Substitute a more reasonable pattern
99
101
  globPatterns[0] = dotOnlySubstitute;
@@ -130,11 +132,11 @@ Configuration via:
130
132
  - .markdownlint.js
131
133
 
132
134
  Cross-platform compatibility:
133
- - UNIX and Windows shells expand globs according to different rules, so quoting glob arguments is recommended
134
- - Shells that expand globs do not support negated patterns (!node_modules), so quoting negated globs is required
135
- - Some Windows shells do not handle single-quoted (') arguments correctly, so double-quotes (") are recommended
136
- - Some UNIX shells handle exclamation (!) in double-quotes specially, so hashtag (#) is recommended for negated globs
137
- - Some shells use backslash (\\) to escape special characters, so forward slash (/) is the recommended path separator
135
+ - UNIX and Windows shells expand globs according to different rules; quoting arguments is recommended
136
+ - Some Windows shells don't handle single-quoted (') arguments well; double-quote (") is recommended
137
+ - Shells that expand globs do not support negated patterns (!node_modules); quoting is required here
138
+ - Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases
139
+ - The path separator is forward slash (/) on all platforms; backslash (\\) is automatically converted
138
140
 
139
141
  Therefore, the most compatible glob syntax for cross-platform support:
140
142
  $ ${name} "**/*.md" "#node_modules"`
@@ -235,6 +237,7 @@ async (baseDir, globPatterns, optionsDefault, fixDefault, noRequire) => {
235
237
 
236
238
  // Pass base ignore globs as globby patterns (best performance)
237
239
  const ignorePatterns =
240
+ // eslint-disable-next-line unicorn/no-array-callback-reference
238
241
  (baseMarkdownlintOptions.ignores || []).map(negateGlob);
239
242
  appendToArray(globPatterns, ignorePatterns);
240
243
  delete baseMarkdownlintOptions.ignores;
@@ -333,7 +336,7 @@ async (baseDir, globPatterns, dirToDirInfo, optionsOverride, noRequire) => {
333
336
  noRequire
334
337
  );
335
338
  // Expand nested arrays (for packages that export multiple rules)
336
- markdownlintOptions.customRules = [].concat(...customRules);
339
+ markdownlintOptions.customRules = customRules.flat();
337
340
  }
338
341
  if (markdownlintOptions && markdownlintOptions.markdownItPlugins) {
339
342
  markdownlintOptions.markdownItPlugins =
@@ -427,6 +430,7 @@ const lintFiles = (dirInfos, fileContents) => {
427
430
  (file) => fileContents[file] === undefined
428
431
  );
429
432
  if (markdownlintOptions.ignores) {
433
+ // eslint-disable-next-line unicorn/no-array-callback-reference
430
434
  const ignores = markdownlintOptions.ignores.map(negateGlob);
431
435
  const micromatch = require("micromatch");
432
436
  filteredFiles = micromatch(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdownlint-cli2",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library",
5
5
  "author": {
6
6
  "name": "David Anson",
@@ -27,7 +27,7 @@
27
27
  "test-watch": "git ls-files | entr npm run test"
28
28
  },
29
29
  "engines": {
30
- "node": ">=10.17.0"
30
+ "node": ">=12"
31
31
  },
32
32
  "files": [
33
33
  "append-to-array.js",
@@ -37,24 +37,24 @@
37
37
  "resolve-and-require.js"
38
38
  ],
39
39
  "dependencies": {
40
- "globby": "~11.0.3",
40
+ "globby": "~11.0.4",
41
41
  "markdownlint": "~0.23.1",
42
42
  "markdownlint-cli2-formatter-default": "^0.0.2",
43
43
  "markdownlint-rule-helpers": "~0.14.0",
44
- "micromatch": "~4.0.2",
44
+ "micromatch": "~4.0.4",
45
45
  "strip-json-comments": "~3.1.1",
46
46
  "yaml": "~1.10.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@iktakahiro/markdown-it-katex": "~4.0.1",
50
50
  "ava": "~3.15.0",
51
- "c8": "~7.7.0",
51
+ "c8": "~7.7.3",
52
52
  "cpy": "~8.1.2",
53
53
  "del": "~6.0.0",
54
- "eslint": "~7.23.0",
54
+ "eslint": "~7.31.0",
55
55
  "eslint-plugin-node": "~11.1.0",
56
- "eslint-plugin-unicorn": "~29.0.0",
57
- "execa": "~5.0.0",
56
+ "eslint-plugin-unicorn": "~34.0.1",
57
+ "execa": "~5.1.1",
58
58
  "markdown-it-emoji": "~2.0.0",
59
59
  "markdown-it-for-inline": "~0.1.1",
60
60
  "markdownlint-cli2-formatter-json": "^0.0.4",