markdownlint-cli2 0.13.0 → 0.15.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/CHANGELOG.md +12 -0
- package/README.md +14 -5
- package/markdownlint-cli2.js +80 -60
- package/package.json +33 -25
- package/schema/markdownlint-cli2-config-schema.json +21 -18
- package/schema/markdownlint-config-schema.json +141 -109
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
- Add support for `stdin` input via `-` glob
|
|
6
|
+
- Add output formatter based on string templates
|
|
7
|
+
- Update dependencies (including `markdownlint`)
|
|
8
|
+
|
|
9
|
+
## 0.14.0
|
|
10
|
+
|
|
11
|
+
- Handle `--` parameter per POSIX convention
|
|
12
|
+
- Add support for glob to `gitignore` configuration
|
|
13
|
+
- Update dependencies (including `markdownlint`)
|
|
14
|
+
|
|
3
15
|
## 0.13.0
|
|
4
16
|
|
|
5
17
|
- Add `noBanner` and `gitignore` configuration options
|
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ Glob expressions (from the globby library):
|
|
|
76
76
|
- {} allows for a comma-separated list of "or" expressions
|
|
77
77
|
- ! or # at the beginning of a pattern negate the match
|
|
78
78
|
- : at the beginning identifies a literal file path
|
|
79
|
+
- - as a glob represents standard input (stdin)
|
|
79
80
|
|
|
80
81
|
Dot-only glob:
|
|
81
82
|
- The command "markdownlint-cli2 ." would lint every file in the current directory tree which is probably not intended
|
|
@@ -103,6 +104,7 @@ Cross-platform compatibility:
|
|
|
103
104
|
- Shells that expand globs do not support negated patterns (!node_modules); quoting is required here
|
|
104
105
|
- Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases
|
|
105
106
|
- The path separator is forward slash (/) on all platforms; backslash (\) is automatically converted
|
|
107
|
+
- On any platform, passing the parameter "--" causes all remaining parameters to be treated literally
|
|
106
108
|
|
|
107
109
|
The most compatible syntax for cross-platform support:
|
|
108
110
|
$ markdownlint-cli2 "**/*.md" "#node_modules"
|
|
@@ -147,7 +149,7 @@ A container image [`davidanson/markdownlint-cli2`][docker-hub-markdownlint-cli2]
|
|
|
147
149
|
can also be used (e.g., as part of a CI pipeline):
|
|
148
150
|
|
|
149
151
|
```bash
|
|
150
|
-
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.
|
|
152
|
+
docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.15.0 "**/*.md" "#node_modules"
|
|
151
153
|
```
|
|
152
154
|
|
|
153
155
|
Notes:
|
|
@@ -164,7 +166,7 @@ Notes:
|
|
|
164
166
|
- A custom working directory can be specified with Docker's `-w` flag:
|
|
165
167
|
|
|
166
168
|
```bash
|
|
167
|
-
docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.
|
|
169
|
+
docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.15.0 "**/*.md" "#node_modules"
|
|
168
170
|
```
|
|
169
171
|
|
|
170
172
|
For convenience, the container image
|
|
@@ -256,8 +258,15 @@ of the rules within.
|
|
|
256
258
|
- The `String` is passed as the `pattern` parameter to the
|
|
257
259
|
[`RegExp` constructor][regexp-constructor]
|
|
258
260
|
- For example: `(^---\s*$[^]*?^---\s*$)(\r\n|\r|\n|$)`
|
|
259
|
-
- `gitignore`: `Boolean` value to ignore files
|
|
260
|
-
linting
|
|
261
|
+
- `gitignore`: `Boolean` or `String` value to automatically ignore files
|
|
262
|
+
referenced by `.gitignore` (or similar) when linting
|
|
263
|
+
- When the value `true` is specified, all `.gitignore` files in the tree are
|
|
264
|
+
imported (default `git` behavior)
|
|
265
|
+
- When a `String` value is specified, that glob pattern is used to identify
|
|
266
|
+
the set of ignore files to import
|
|
267
|
+
- The value `**/.gitignore` corresponds to the `Boolean` value `true`
|
|
268
|
+
- The value `.gitignore` imports only the file in the root of the tree;
|
|
269
|
+
this is usually equivalent and can be much faster for large trees
|
|
261
270
|
- This top-level setting is valid **only** in the directory from which
|
|
262
271
|
`markdownlint-cli2` is run
|
|
263
272
|
- `globs`: `Array` of `String`s defining glob expressions to append to the
|
|
@@ -404,7 +413,7 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like:
|
|
|
404
413
|
|
|
405
414
|
```yaml
|
|
406
415
|
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
|
407
|
-
rev: v0.
|
|
416
|
+
rev: v0.15.0
|
|
408
417
|
hooks:
|
|
409
418
|
- id: markdownlint-cli2
|
|
410
419
|
```
|
package/markdownlint-cli2.js
CHANGED
|
@@ -14,21 +14,25 @@ const pathDefault = require("node:path");
|
|
|
14
14
|
const pathPosix = pathDefault.posix;
|
|
15
15
|
const { pathToFileURL } = require("node:url");
|
|
16
16
|
const markdownlintLibrary = require("markdownlint");
|
|
17
|
+
const {
|
|
18
|
+
applyFixes,
|
|
19
|
+
"getVersion": getLibraryVersion,
|
|
20
|
+
"promises": markdownlintPromises
|
|
21
|
+
} = markdownlintLibrary;
|
|
17
22
|
const {
|
|
18
23
|
markdownlint,
|
|
19
24
|
"extendConfig": markdownlintExtendConfig,
|
|
20
25
|
"readConfig": markdownlintReadConfig
|
|
21
|
-
} =
|
|
22
|
-
const markdownlintRuleHelpers = require("markdownlint/helpers");
|
|
26
|
+
} = markdownlintPromises;
|
|
23
27
|
const appendToArray = require("./append-to-array");
|
|
24
28
|
const mergeOptions = require("./merge-options");
|
|
25
29
|
const resolveAndRequire = require("./resolve-and-require");
|
|
26
30
|
|
|
27
31
|
// Variables
|
|
28
32
|
const packageName = "markdownlint-cli2";
|
|
29
|
-
const packageVersion = "0.
|
|
33
|
+
const packageVersion = "0.15.0";
|
|
30
34
|
const libraryName = "markdownlint";
|
|
31
|
-
const libraryVersion =
|
|
35
|
+
const libraryVersion = getLibraryVersion();
|
|
32
36
|
const bannerMessage = `${packageName} v${packageVersion} (${libraryName} v${libraryVersion})`;
|
|
33
37
|
const dotOnlySubstitute = "*.{md,markdown}";
|
|
34
38
|
const utf8 = "utf8";
|
|
@@ -52,7 +56,6 @@ const negateGlob = (glob) => `!${glob}`;
|
|
|
52
56
|
const throwForConfigurationFile = (file, error) => {
|
|
53
57
|
throw new Error(
|
|
54
58
|
`Unable to use configuration file '${file}'; ${error?.message}`,
|
|
55
|
-
// @ts-ignore
|
|
56
59
|
{ "cause": error }
|
|
57
60
|
);
|
|
58
61
|
};
|
|
@@ -61,9 +64,10 @@ const throwForConfigurationFile = (file, error) => {
|
|
|
61
64
|
const posixPath = (p) => p.split(pathDefault.sep).join(pathPosix.sep);
|
|
62
65
|
|
|
63
66
|
// Expands a path with a tilde to an absolute path
|
|
64
|
-
const expandTildePath = (id) =>
|
|
65
|
-
markdownlintRuleHelpers
|
|
66
|
-
);
|
|
67
|
+
const expandTildePath = (id) => {
|
|
68
|
+
const markdownlintRuleHelpers = require("markdownlint/helpers");
|
|
69
|
+
return markdownlintRuleHelpers.expandTildePath(id, require("node:os"));
|
|
70
|
+
};
|
|
67
71
|
|
|
68
72
|
// Resolves module paths relative to the specified directory
|
|
69
73
|
const resolveModulePaths = (dir, modulePaths) => (
|
|
@@ -99,6 +103,7 @@ const importOrRequireResolve = async (dirOrDirs, id, noRequire) => {
|
|
|
99
103
|
errors.push(error);
|
|
100
104
|
}
|
|
101
105
|
try {
|
|
106
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
102
107
|
const isURL = !pathDefault.isAbsolute(expandId) && URL.canParse(expandId);
|
|
103
108
|
const urlString = (
|
|
104
109
|
isURL ? new URL(expandId) : pathToFileURL(pathDefault.resolve(dirs[0], expandId))
|
|
@@ -109,7 +114,6 @@ const importOrRequireResolve = async (dirOrDirs, id, noRequire) => {
|
|
|
109
114
|
} catch (error) {
|
|
110
115
|
errors.push(error);
|
|
111
116
|
}
|
|
112
|
-
// @ts-ignore
|
|
113
117
|
throw new AggregateError(
|
|
114
118
|
errors,
|
|
115
119
|
`Unable to require or import module '${id}'.`
|
|
@@ -257,6 +261,7 @@ Glob expressions (from the globby library):
|
|
|
257
261
|
- {} allows for a comma-separated list of "or" expressions
|
|
258
262
|
- ! or # at the beginning of a pattern negate the match
|
|
259
263
|
- : at the beginning identifies a literal file path
|
|
264
|
+
- - as a glob represents standard input (stdin)
|
|
260
265
|
|
|
261
266
|
Dot-only glob:
|
|
262
267
|
- The command "markdownlint-cli2 ." would lint every file in the current directory tree which is probably not intended
|
|
@@ -284,6 +289,7 @@ Cross-platform compatibility:
|
|
|
284
289
|
- Shells that expand globs do not support negated patterns (!node_modules); quoting is required here
|
|
285
290
|
- Some UNIX shells parse exclamation (!) in double-quotes; hashtag (#) is recommended in these cases
|
|
286
291
|
- The path separator is forward slash (/) on all platforms; backslash (\\) is automatically converted
|
|
292
|
+
- On any platform, passing the parameter "--" causes all remaining parameters to be treated literally
|
|
287
293
|
|
|
288
294
|
The most compatible syntax for cross-platform support:
|
|
289
295
|
$ markdownlint-cli2 "**/*.md" "#node_modules"`
|
|
@@ -317,7 +323,7 @@ const getAndProcessDirInfo = (
|
|
|
317
323
|
// Load markdownlint-cli2 object(s)
|
|
318
324
|
const markdownlintCli2Jsonc = pathPosix.join(dir, ".markdownlint-cli2.jsonc");
|
|
319
325
|
const markdownlintCli2Yaml = pathPosix.join(dir, ".markdownlint-cli2.yaml");
|
|
320
|
-
const markdownlintCli2Cjs =
|
|
326
|
+
const markdownlintCli2Cjs = pathPosix.join(dir, ".markdownlint-cli2.cjs");
|
|
321
327
|
const markdownlintCli2Mjs = pathPosix.join(dir, ".markdownlint-cli2.mjs");
|
|
322
328
|
const packageJson = pathPosix.join(dir, "package.json");
|
|
323
329
|
let file = "[UNKNOWN]";
|
|
@@ -365,8 +371,8 @@ const getAndProcessDirInfo = (
|
|
|
365
371
|
then((config) => {
|
|
366
372
|
options.config = config;
|
|
367
373
|
});
|
|
368
|
-
})
|
|
369
|
-
|
|
374
|
+
}).
|
|
375
|
+
catch((error) => {
|
|
370
376
|
throwForConfigurationFile(file, error);
|
|
371
377
|
})
|
|
372
378
|
);
|
|
@@ -477,6 +483,7 @@ const enumerateFiles = async (
|
|
|
477
483
|
globPatterns,
|
|
478
484
|
dirToDirInfo,
|
|
479
485
|
gitignore,
|
|
486
|
+
ignoreFiles,
|
|
480
487
|
noRequire
|
|
481
488
|
) => {
|
|
482
489
|
const tasks = [];
|
|
@@ -487,6 +494,7 @@ const enumerateFiles = async (
|
|
|
487
494
|
"dot": true,
|
|
488
495
|
"expandDirectories": false,
|
|
489
496
|
gitignore,
|
|
497
|
+
ignoreFiles,
|
|
490
498
|
"suppressErrors": true,
|
|
491
499
|
fs
|
|
492
500
|
};
|
|
@@ -612,6 +620,7 @@ const createDirInfos = async (
|
|
|
612
620
|
dirToDirInfo,
|
|
613
621
|
optionsOverride,
|
|
614
622
|
gitignore,
|
|
623
|
+
ignoreFiles,
|
|
615
624
|
noRequire
|
|
616
625
|
) => {
|
|
617
626
|
await enumerateFiles(
|
|
@@ -621,6 +630,7 @@ const createDirInfos = async (
|
|
|
621
630
|
globPatterns,
|
|
622
631
|
dirToDirInfo,
|
|
623
632
|
gitignore,
|
|
633
|
+
ignoreFiles,
|
|
624
634
|
noRequire
|
|
625
635
|
);
|
|
626
636
|
await enumerateParents(
|
|
@@ -766,6 +776,7 @@ const lintFiles = (fs, dirInfos, fileContents) => {
|
|
|
766
776
|
const filteredFiles = filesAfterIgnores.filter(
|
|
767
777
|
(file) => fileContents[file] === undefined
|
|
768
778
|
);
|
|
779
|
+
/** @type {Record<string, string>} */
|
|
769
780
|
const filteredStrings = {};
|
|
770
781
|
for (const file of filesAfterIgnores) {
|
|
771
782
|
if (fileContents[file] !== undefined) {
|
|
@@ -773,6 +784,7 @@ const lintFiles = (fs, dirInfos, fileContents) => {
|
|
|
773
784
|
}
|
|
774
785
|
}
|
|
775
786
|
// Create markdownlint options object
|
|
787
|
+
/** @type {import("markdownlint").Options} */
|
|
776
788
|
const options = {
|
|
777
789
|
"files": filteredFiles,
|
|
778
790
|
"strings": filteredStrings,
|
|
@@ -789,14 +801,14 @@ const lintFiles = (fs, dirInfos, fileContents) => {
|
|
|
789
801
|
fs
|
|
790
802
|
};
|
|
791
803
|
// Invoke markdownlint
|
|
792
|
-
// @ts-ignore
|
|
793
804
|
let task = markdownlint(options);
|
|
794
805
|
// For any fixable errors, read file, apply fixes, and write it back
|
|
795
806
|
if (markdownlintOptions.fix) {
|
|
796
807
|
task = task.then((results) => {
|
|
797
808
|
options.files = [];
|
|
798
809
|
const subTasks = [];
|
|
799
|
-
const errorFiles = Object.keys(results)
|
|
810
|
+
const errorFiles = Object.keys(results).
|
|
811
|
+
filter((result) => filteredFiles.includes(result));
|
|
800
812
|
for (const fileName of errorFiles) {
|
|
801
813
|
const errorInfos = results[fileName].
|
|
802
814
|
filter((errorInfo) => errorInfo.fixInfo);
|
|
@@ -805,15 +817,13 @@ const lintFiles = (fs, dirInfos, fileContents) => {
|
|
|
805
817
|
options.files.push(fileName);
|
|
806
818
|
subTasks.push(fs.promises.readFile(fileName, utf8).
|
|
807
819
|
then((original) => {
|
|
808
|
-
const fixed =
|
|
809
|
-
applyFixes(original, errorInfos);
|
|
820
|
+
const fixed = applyFixes(original, errorInfos);
|
|
810
821
|
return fs.promises.writeFile(fileName, fixed, utf8);
|
|
811
822
|
})
|
|
812
823
|
);
|
|
813
824
|
}
|
|
814
825
|
}
|
|
815
826
|
return Promise.all(subTasks).
|
|
816
|
-
// @ts-ignore
|
|
817
827
|
then(() => markdownlint(options)).
|
|
818
828
|
then((fixResults) => ({
|
|
819
829
|
...results,
|
|
@@ -899,11 +909,12 @@ const main = async (params) => {
|
|
|
899
909
|
optionsDefault,
|
|
900
910
|
optionsOverride,
|
|
901
911
|
fileContents,
|
|
902
|
-
|
|
903
|
-
|
|
912
|
+
noRequire,
|
|
913
|
+
allowStdin
|
|
904
914
|
} = params;
|
|
905
915
|
let {
|
|
906
|
-
noGlobs
|
|
916
|
+
noGlobs,
|
|
917
|
+
nonFileContents
|
|
907
918
|
} = params;
|
|
908
919
|
const logMessage = params.logMessage || noop;
|
|
909
920
|
const logError = params.logError || noop;
|
|
@@ -916,26 +927,31 @@ const main = async (params) => {
|
|
|
916
927
|
let fixDefault = false;
|
|
917
928
|
// eslint-disable-next-line unicorn/no-useless-undefined
|
|
918
929
|
let configPath = undefined;
|
|
930
|
+
let useStdin = false;
|
|
931
|
+
let sawDashDash = false;
|
|
919
932
|
let shouldShowHelp = false;
|
|
920
933
|
const argvFiltered = (argv || []).filter((arg) => {
|
|
921
|
-
if (
|
|
934
|
+
if (sawDashDash) {
|
|
935
|
+
return true;
|
|
936
|
+
} else if (configPath === null) {
|
|
922
937
|
configPath = arg;
|
|
923
|
-
|
|
938
|
+
} else if ((arg === "-") && allowStdin) {
|
|
939
|
+
useStdin = true;
|
|
924
940
|
// eslint-disable-next-line unicorn/prefer-switch
|
|
941
|
+
} else if (arg === "--") {
|
|
942
|
+
sawDashDash = true;
|
|
925
943
|
} else if (arg === "--config") {
|
|
926
944
|
configPath = null;
|
|
927
|
-
return false;
|
|
928
945
|
} else if (arg === "--fix") {
|
|
929
946
|
fixDefault = true;
|
|
930
|
-
return false;
|
|
931
947
|
} else if (arg === "--help") {
|
|
932
948
|
shouldShowHelp = true;
|
|
933
|
-
return false;
|
|
934
949
|
} else if (arg === "--no-globs") {
|
|
935
950
|
noGlobs = true;
|
|
936
|
-
|
|
951
|
+
} else {
|
|
952
|
+
return true;
|
|
937
953
|
}
|
|
938
|
-
return
|
|
954
|
+
return false;
|
|
939
955
|
});
|
|
940
956
|
if (shouldShowHelp) {
|
|
941
957
|
return showHelp(logMessage, true);
|
|
@@ -971,22 +987,30 @@ const main = async (params) => {
|
|
|
971
987
|
}
|
|
972
988
|
}
|
|
973
989
|
if (
|
|
974
|
-
((globPatterns.length === 0) && !nonFileContents) ||
|
|
990
|
+
((globPatterns.length === 0) && !useStdin && !nonFileContents) ||
|
|
975
991
|
(configPath === null)
|
|
976
992
|
) {
|
|
977
993
|
return showHelp(logMessage, false);
|
|
978
994
|
}
|
|
995
|
+
// Add stdin as a non-file input if necessary
|
|
996
|
+
if (useStdin) {
|
|
997
|
+
const key = pathPosix.join(baseDir, "stdin");
|
|
998
|
+
const { text } = require("node:stream/consumers");
|
|
999
|
+
nonFileContents = {
|
|
1000
|
+
...nonFileContents,
|
|
1001
|
+
[key]: await text(process.stdin)
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
979
1004
|
// Include any file overrides or non-file content
|
|
980
|
-
const { baseMarkdownlintOptions, dirToDirInfo } = baseOptions;
|
|
981
1005
|
const resolvedFileContents = {};
|
|
982
1006
|
for (const file in fileContents) {
|
|
983
1007
|
const resolvedFile = posixPath(pathDefault.resolve(baseDirSystem, file));
|
|
984
|
-
resolvedFileContents[resolvedFile] =
|
|
985
|
-
fileContents[file];
|
|
1008
|
+
resolvedFileContents[resolvedFile] = fileContents[file];
|
|
986
1009
|
}
|
|
987
1010
|
for (const nonFile in nonFileContents) {
|
|
988
1011
|
resolvedFileContents[nonFile] = nonFileContents[nonFile];
|
|
989
1012
|
}
|
|
1013
|
+
const { baseMarkdownlintOptions, dirToDirInfo } = baseOptions;
|
|
990
1014
|
appendToArray(
|
|
991
1015
|
dirToDirInfo[baseDir].files,
|
|
992
1016
|
Object.keys(nonFileContents || {})
|
|
@@ -997,6 +1021,13 @@ const main = async (params) => {
|
|
|
997
1021
|
logMessage(`Finding: ${globPatterns.join(" ")}`);
|
|
998
1022
|
}
|
|
999
1023
|
// Create linting tasks
|
|
1024
|
+
const gitignore =
|
|
1025
|
+
// https://github.com/sindresorhus/globby/issues/265
|
|
1026
|
+
(!params.fs && (baseMarkdownlintOptions.gitignore === true));
|
|
1027
|
+
const ignoreFiles =
|
|
1028
|
+
(!params.fs && (typeof baseMarkdownlintOptions.gitignore === "string"))
|
|
1029
|
+
? baseMarkdownlintOptions.gitignore
|
|
1030
|
+
: undefined;
|
|
1000
1031
|
const dirInfos =
|
|
1001
1032
|
await createDirInfos(
|
|
1002
1033
|
fs,
|
|
@@ -1005,8 +1036,8 @@ const main = async (params) => {
|
|
|
1005
1036
|
globPatterns,
|
|
1006
1037
|
dirToDirInfo,
|
|
1007
1038
|
optionsOverride,
|
|
1008
|
-
|
|
1009
|
-
|
|
1039
|
+
gitignore,
|
|
1040
|
+
ignoreFiles,
|
|
1010
1041
|
noRequire
|
|
1011
1042
|
);
|
|
1012
1043
|
// Output linting status
|
|
@@ -1051,37 +1082,26 @@ const main = async (params) => {
|
|
|
1051
1082
|
return errorsPresent ? 1 : 0;
|
|
1052
1083
|
};
|
|
1053
1084
|
|
|
1054
|
-
// Run function
|
|
1055
|
-
const run = (overrides, args) => {
|
|
1056
|
-
(async () => {
|
|
1057
|
-
const argsAndArgv = args || [];
|
|
1058
|
-
appendToArray(argsAndArgv, process.argv.slice(2));
|
|
1059
|
-
try {
|
|
1060
|
-
const defaultParams = {
|
|
1061
|
-
"argv": argsAndArgv,
|
|
1062
|
-
"logMessage": console.log,
|
|
1063
|
-
"logError": console.error
|
|
1064
|
-
};
|
|
1065
|
-
const params = {
|
|
1066
|
-
...defaultParams,
|
|
1067
|
-
...overrides
|
|
1068
|
-
};
|
|
1069
|
-
process.exitCode = await main(params);
|
|
1070
|
-
} catch (error) {
|
|
1071
|
-
console.error(error);
|
|
1072
|
-
process.exitCode = 2;
|
|
1073
|
-
}
|
|
1074
|
-
})();
|
|
1075
|
-
};
|
|
1076
|
-
|
|
1077
1085
|
// Export functions
|
|
1078
1086
|
module.exports = {
|
|
1079
|
-
main
|
|
1080
|
-
run
|
|
1087
|
+
main
|
|
1081
1088
|
};
|
|
1082
1089
|
|
|
1083
1090
|
// Run if invoked as a CLI
|
|
1084
|
-
// @ts-ignore
|
|
1085
1091
|
if (require.main === module) {
|
|
1086
|
-
|
|
1092
|
+
const params = {
|
|
1093
|
+
"argv": process.argv.slice(2),
|
|
1094
|
+
"logMessage": console.log,
|
|
1095
|
+
"logError": console.error,
|
|
1096
|
+
"allowStdin": true
|
|
1097
|
+
};
|
|
1098
|
+
main(params).
|
|
1099
|
+
then((exitCode) => {
|
|
1100
|
+
process.exitCode = exitCode;
|
|
1101
|
+
}).
|
|
1102
|
+
// eslint-disable-next-line unicorn/prefer-top-level-await
|
|
1103
|
+
catch((error) => {
|
|
1104
|
+
console.error(error);
|
|
1105
|
+
process.exitCode = 2;
|
|
1106
|
+
});
|
|
1087
1107
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdownlint-cli2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -31,11 +31,15 @@
|
|
|
31
31
|
"build-docker-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker build -t davidanson/markdownlint-cli2:v$VERSION -f docker/Dockerfile --label org.opencontainers.image.version=v$VERSION .",
|
|
32
32
|
"build-docker-image-rules": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker build -t davidanson/markdownlint-cli2-rules:v$VERSION -f docker/Dockerfile-rules --build-arg VERSION=v$VERSION --label org.opencontainers.image.version=v$VERSION .",
|
|
33
33
|
"ci": "npm-run-all --continue-on-error --parallel test-cover lint schema && git diff --exit-code",
|
|
34
|
-
"lint": "eslint --max-warnings 0
|
|
34
|
+
"lint": "eslint --max-warnings 0",
|
|
35
35
|
"lint-dockerfile": "docker run --rm -i hadolint/hadolint:latest-alpine < docker/Dockerfile",
|
|
36
36
|
"lint-watch": "git ls-files | entr npm run lint",
|
|
37
|
+
"playwright-install-bare": "npm run playwright-install-npm && playwright install",
|
|
38
|
+
"playwright-install-npm": "npm install --no-save playwright@1.48.2",
|
|
39
|
+
"playwright-test": "playwright test --config ./webworker/playwright.config.mjs",
|
|
40
|
+
"playwright-test-docker": "docker run --rm --volume $PWD:/home/workdir --workdir /home/workdir --ipc=host mcr.microsoft.com/playwright:v1.48.2 npm run playwright-test",
|
|
37
41
|
"schema": "cpy ./node_modules/markdownlint/schema/markdownlint-config-schema.json ./schema --flat",
|
|
38
|
-
"test": "ava --timeout=1m test/append-to-array-test.js test/fs-mock-test.js test/markdownlint-cli2-test.js test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-exports.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js test/merge-options-test.js test/resolve-and-require-test.js",
|
|
42
|
+
"test": "ava --timeout=1m test/append-to-array-test.js test/fs-mock-test.js test/fs-virtual-test.js test/markdownlint-cli2-test.js test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-exports.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js test/merge-options-test.js test/resolve-and-require-test.js",
|
|
39
43
|
"test-cover": "c8 --100 npm test",
|
|
40
44
|
"test-docker-hub-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker image rm davidanson/markdownlint-cli2:v$VERSION davidanson/markdownlint-cli2:latest || true && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:v$VERSION \"*.md\" && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:latest \"*.md\"",
|
|
41
45
|
"test-docker-hub-image-rules": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker image rm davidanson/markdownlint-cli2-rules:v$VERSION davidanson/markdownlint-cli2-rules:latest || true && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2-rules:v$VERSION \"*.md\" && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2-rules:latest \"*.md\"",
|
|
@@ -68,35 +72,39 @@
|
|
|
68
72
|
"schema/ValidatingConfiguration.md"
|
|
69
73
|
],
|
|
70
74
|
"dependencies": {
|
|
71
|
-
"globby": "14.0.
|
|
75
|
+
"globby": "14.0.2",
|
|
72
76
|
"js-yaml": "4.1.0",
|
|
73
|
-
"jsonc-parser": "3.
|
|
74
|
-
"markdownlint": "0.
|
|
75
|
-
"markdownlint-cli2-formatter-default": "0.0.
|
|
76
|
-
"micromatch": "4.0.
|
|
77
|
+
"jsonc-parser": "3.3.1",
|
|
78
|
+
"markdownlint": "0.36.1",
|
|
79
|
+
"markdownlint-cli2-formatter-default": "0.0.5",
|
|
80
|
+
"micromatch": "4.0.8"
|
|
77
81
|
},
|
|
78
82
|
"devDependencies": {
|
|
83
|
+
"@eslint/js": "9.14.0",
|
|
79
84
|
"@iktakahiro/markdown-it-katex": "4.0.1",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
85
|
+
"@playwright/test": "1.48.2",
|
|
86
|
+
"@stylistic/eslint-plugin": "2.10.1",
|
|
87
|
+
"ajv": "8.17.1",
|
|
88
|
+
"ava": "6.2.0",
|
|
89
|
+
"c8": "10.1.2",
|
|
90
|
+
"cpy": "11.1.0",
|
|
84
91
|
"cpy-cli": "5.0.0",
|
|
85
|
-
"del": "
|
|
86
|
-
"eslint": "
|
|
87
|
-
"eslint-plugin-jsdoc": "
|
|
88
|
-
"eslint-plugin-n": "
|
|
89
|
-
"eslint-plugin-unicorn": "
|
|
90
|
-
"
|
|
92
|
+
"del": "8.0.0",
|
|
93
|
+
"eslint": "9.14.0",
|
|
94
|
+
"eslint-plugin-jsdoc": "50.4.3",
|
|
95
|
+
"eslint-plugin-n": "17.13.1",
|
|
96
|
+
"eslint-plugin-unicorn": "56.0.0",
|
|
97
|
+
"nano-spawn": "0.2.0",
|
|
91
98
|
"markdown-it-emoji": "3.0.0",
|
|
92
99
|
"markdown-it-for-inline": "2.0.1",
|
|
93
|
-
"markdownlint-cli2-formatter-codequality": "0.0.
|
|
94
|
-
"markdownlint-cli2-formatter-json": "0.0.
|
|
95
|
-
"markdownlint-cli2-formatter-junit": "0.0.
|
|
96
|
-
"markdownlint-cli2-formatter-pretty": "0.0.
|
|
97
|
-
"markdownlint-cli2-formatter-sarif": "0.0.
|
|
98
|
-
"markdownlint-cli2-formatter-summarize": "0.0.
|
|
99
|
-
"markdownlint-
|
|
100
|
+
"markdownlint-cli2-formatter-codequality": "0.0.5",
|
|
101
|
+
"markdownlint-cli2-formatter-json": "0.0.8",
|
|
102
|
+
"markdownlint-cli2-formatter-junit": "0.0.12",
|
|
103
|
+
"markdownlint-cli2-formatter-pretty": "0.0.7",
|
|
104
|
+
"markdownlint-cli2-formatter-sarif": "0.0.2",
|
|
105
|
+
"markdownlint-cli2-formatter-summarize": "0.0.7",
|
|
106
|
+
"markdownlint-cli2-formatter-template": "0.0.2",
|
|
107
|
+
"markdownlint-rule-extended-ascii": "0.1.0",
|
|
100
108
|
"npm-run-all": "4.1.5"
|
|
101
109
|
},
|
|
102
110
|
"keywords": [
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.15.0/schema/markdownlint-cli2-config-schema.json",
|
|
4
4
|
"title": "markdownlint-cli2 configuration schema",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"$schema": {
|
|
8
8
|
"description": "JSON Schema URI (expected by some editors)",
|
|
9
9
|
"type": "string",
|
|
10
|
-
"default": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.
|
|
10
|
+
"default": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.15.0/schema/markdownlint-cli2-config-schema.json"
|
|
11
11
|
},
|
|
12
12
|
"config": {
|
|
13
|
-
"description": "markdownlint configuration schema : https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
14
|
-
"$ref": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.
|
|
13
|
+
"description": "markdownlint configuration schema : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/schema/.markdownlint.jsonc",
|
|
14
|
+
"$ref": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.36.1/schema/markdownlint-config-schema.json",
|
|
15
15
|
"default": {}
|
|
16
16
|
},
|
|
17
17
|
"customRules": {
|
|
18
|
-
"description": "Module names or paths of custom rules to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
18
|
+
"description": "Module names or paths of custom rules to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
19
19
|
"type": "array",
|
|
20
20
|
"default": [],
|
|
21
21
|
"items": {
|
|
@@ -25,23 +25,26 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"fix": {
|
|
28
|
-
"description": "Whether to enable fixing of linting errors reported by rules that emit fix information : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
28
|
+
"description": "Whether to enable fixing of linting errors reported by rules that emit fix information : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
29
29
|
"type": "boolean",
|
|
30
30
|
"default": false
|
|
31
31
|
},
|
|
32
32
|
"frontMatter": {
|
|
33
|
-
"description": "Regular expression used to match and ignore any front matter at the beginning of a document : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
33
|
+
"description": "Regular expression used to match and ignore any front matter at the beginning of a document : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
34
34
|
"type": "string",
|
|
35
35
|
"minLength": 1,
|
|
36
36
|
"default": ""
|
|
37
37
|
},
|
|
38
38
|
"gitignore": {
|
|
39
|
-
"description": "Whether to ignore files referenced by .gitignore
|
|
40
|
-
"type":
|
|
39
|
+
"description": "Whether to ignore files referenced by .gitignore (or glob expression) (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
40
|
+
"type": [
|
|
41
|
+
"boolean",
|
|
42
|
+
"string"
|
|
43
|
+
],
|
|
41
44
|
"default": false
|
|
42
45
|
},
|
|
43
46
|
"globs": {
|
|
44
|
-
"description": "Glob expressions to include when linting (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
47
|
+
"description": "Glob expressions to include when linting (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
45
48
|
"type": "array",
|
|
46
49
|
"default": [],
|
|
47
50
|
"items": {
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
}
|
|
52
55
|
},
|
|
53
56
|
"ignores": {
|
|
54
|
-
"description": "Glob expressions to ignore when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
57
|
+
"description": "Glob expressions to ignore when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
55
58
|
"type": "array",
|
|
56
59
|
"default": [],
|
|
57
60
|
"items": {
|
|
@@ -61,7 +64,7 @@
|
|
|
61
64
|
}
|
|
62
65
|
},
|
|
63
66
|
"markdownItPlugins": {
|
|
64
|
-
"description": "markdown-it plugins to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
67
|
+
"description": "markdown-it plugins to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
65
68
|
"type": "array",
|
|
66
69
|
"default": [],
|
|
67
70
|
"items": {
|
|
@@ -81,7 +84,7 @@
|
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
86
|
"modulePaths": {
|
|
84
|
-
"description": "Additional paths to resolve module locations from : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
87
|
+
"description": "Additional paths to resolve module locations from : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
85
88
|
"type": "array",
|
|
86
89
|
"default": [],
|
|
87
90
|
"items": {
|
|
@@ -91,22 +94,22 @@
|
|
|
91
94
|
}
|
|
92
95
|
},
|
|
93
96
|
"noBanner": {
|
|
94
|
-
"description": "Whether to disable the display of the banner message and version numbers on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
97
|
+
"description": "Whether to disable the display of the banner message and version numbers on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
95
98
|
"type": "boolean",
|
|
96
99
|
"default": false
|
|
97
100
|
},
|
|
98
101
|
"noInlineConfig": {
|
|
99
|
-
"description": "Whether to disable support of HTML comments within Markdown content : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
102
|
+
"description": "Whether to disable support of HTML comments within Markdown content : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
100
103
|
"type": "boolean",
|
|
101
104
|
"default": false
|
|
102
105
|
},
|
|
103
106
|
"noProgress": {
|
|
104
|
-
"description": "Whether to disable the display of progress on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
107
|
+
"description": "Whether to disable the display of progress on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
105
108
|
"type": "boolean",
|
|
106
109
|
"default": false
|
|
107
110
|
},
|
|
108
111
|
"outputFormatters": {
|
|
109
|
-
"description": "Output formatters to load and use to customize markdownlint-cli2 output (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
112
|
+
"description": "Output formatters to load and use to customize markdownlint-cli2 output (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
110
113
|
"type": "array",
|
|
111
114
|
"default": [],
|
|
112
115
|
"items": {
|
|
@@ -126,7 +129,7 @@
|
|
|
126
129
|
}
|
|
127
130
|
},
|
|
128
131
|
"showFound": {
|
|
129
|
-
"description": "Whether to show the list of found files on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.
|
|
132
|
+
"description": "Whether to show the list of found files on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc",
|
|
130
133
|
"type": "boolean",
|
|
131
134
|
"default": false
|
|
132
135
|
}
|