markdownlint-cli2 0.12.1 → 0.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdownlint-cli2",
3
- "version": "0.12.1",
3
+ "version": "0.14.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",
@@ -12,7 +12,10 @@
12
12
  "exports": {
13
13
  ".": "./markdownlint-cli2.js",
14
14
  "./markdownlint": "./export-markdownlint.js",
15
- "./markdownlint/helpers": "./export-markdownlint-helpers.js"
15
+ "./markdownlint/helpers": "./export-markdownlint-helpers.js",
16
+ "./parsers": "./parsers/parsers.js",
17
+ "./parsers/jsonc": "./parsers/jsonc-parse.js",
18
+ "./parsers/yaml": "./parsers/yaml-parse.js"
16
19
  },
17
20
  "bin": {
18
21
  "markdownlint-cli2": "markdownlint-cli2.js"
@@ -28,11 +31,11 @@
28
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 .",
29
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 .",
30
33
  "ci": "npm-run-all --continue-on-error --parallel test-cover lint schema && git diff --exit-code",
31
- "lint": "eslint --max-warnings 0 --no-eslintrc --config .eslintrc.json .",
34
+ "lint": "eslint --max-warnings 0",
32
35
  "lint-dockerfile": "docker run --rm -i hadolint/hadolint:latest-alpine < docker/Dockerfile",
33
36
  "lint-watch": "git ls-files | entr npm run lint",
34
37
  "schema": "cpy ./node_modules/markdownlint/schema/markdownlint-config-schema.json ./schema --flat",
35
- "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-fs.js test/markdownlint-cli2-test-main.js test/merge-options-test.js test/resolve-and-require-test.js",
38
+ "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",
36
39
  "test-cover": "c8 --100 npm test",
37
40
  "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\"",
38
41
  "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\"",
@@ -55,6 +58,9 @@
55
58
  "LICENSE",
56
59
  "markdownlint-cli2.js",
57
60
  "merge-options.js",
61
+ "parsers/parsers.js",
62
+ "parsers/jsonc-parse.js",
63
+ "parsers/yaml-parse.js",
58
64
  "README.md",
59
65
  "resolve-and-require.js",
60
66
  "schema/markdownlint-cli2-config-schema.json",
@@ -62,34 +68,37 @@
62
68
  "schema/ValidatingConfiguration.md"
63
69
  ],
64
70
  "dependencies": {
65
- "globby": "14.0.0",
66
- "jsonc-parser": "3.2.0",
67
- "markdownlint": "0.33.0",
68
- "markdownlint-cli2-formatter-default": "0.0.4",
69
- "micromatch": "4.0.5",
70
- "yaml": "2.3.4"
71
+ "globby": "14.0.2",
72
+ "js-yaml": "4.1.0",
73
+ "jsonc-parser": "3.3.1",
74
+ "markdownlint": "0.35.0",
75
+ "markdownlint-cli2-formatter-default": "0.0.5",
76
+ "micromatch": "4.0.8"
71
77
  },
72
78
  "devDependencies": {
79
+ "@eslint/js": "9.9.1",
73
80
  "@iktakahiro/markdown-it-katex": "4.0.1",
74
- "ajv": "8.12.0",
75
- "ava": "6.0.1",
76
- "c8": "9.1.0",
77
- "cpy": "11.0.0",
81
+ "@stylistic/eslint-plugin": "2.7.2",
82
+ "ajv": "8.17.1",
83
+ "ava": "6.1.3",
84
+ "c8": "10.1.2",
85
+ "cpy": "11.1.0",
78
86
  "cpy-cli": "5.0.0",
79
87
  "del": "7.1.0",
80
- "eslint": "8.56.0",
81
- "eslint-plugin-n": "16.6.2",
82
- "eslint-plugin-unicorn": "50.0.1",
83
- "execa": "8.0.1",
88
+ "eslint": "9.9.1",
89
+ "eslint-plugin-jsdoc": "50.2.2",
90
+ "eslint-plugin-n": "17.10.2",
91
+ "eslint-plugin-unicorn": "55.0.0",
92
+ "execa": "9.3.1",
84
93
  "markdown-it-emoji": "3.0.0",
85
94
  "markdown-it-for-inline": "2.0.1",
86
- "markdownlint-cli2-formatter-codequality": "0.0.4",
87
- "markdownlint-cli2-formatter-json": "0.0.7",
88
- "markdownlint-cli2-formatter-junit": "0.0.8",
89
- "markdownlint-cli2-formatter-pretty": "0.0.5",
90
- "markdownlint-cli2-formatter-sarif": "0.0.1",
91
- "markdownlint-cli2-formatter-summarize": "0.0.6",
92
- "markdownlint-rule-titlecase": "0.1.0",
95
+ "markdownlint-cli2-formatter-codequality": "0.0.5",
96
+ "markdownlint-cli2-formatter-json": "0.0.8",
97
+ "markdownlint-cli2-formatter-junit": "0.0.12",
98
+ "markdownlint-cli2-formatter-pretty": "0.0.7",
99
+ "markdownlint-cli2-formatter-sarif": "0.0.2",
100
+ "markdownlint-cli2-formatter-summarize": "0.0.7",
101
+ "markdownlint-rule-extended-ascii": "0.1.0",
93
102
  "npm-run-all": "4.1.5"
94
103
  },
95
104
  "keywords": [
@@ -0,0 +1,24 @@
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const { parse, printParseErrorCode } = require("jsonc-parser");
6
+
7
+ /**
8
+ * Parses a JSONC string, returning the corresponding object.
9
+ * @param {string} text String to parse as JSONC.
10
+ * @returns {object} Corresponding object.
11
+ */
12
+ const jsoncParse = (text) => {
13
+ const errors = [];
14
+ const result = parse(text, errors, { "allowTrailingComma": true });
15
+ if (errors.length > 0) {
16
+ const aggregate = errors.map(
17
+ (error) => `${printParseErrorCode(error.error)} (offset ${error.offset}, length ${error.length})`
18
+ ).join(", ");
19
+ throw new Error(`Unable to parse JSONC content, ${aggregate}`);
20
+ }
21
+ return result;
22
+ };
23
+
24
+ module.exports = jsoncParse;
@@ -0,0 +1,16 @@
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const jsoncParse = require("./jsonc-parse");
6
+ const yamlParse = require("./yaml-parse");
7
+
8
+ /**
9
+ * Array of parser objects ordered by priority.
10
+ */
11
+ const parsers = [
12
+ jsoncParse,
13
+ yamlParse
14
+ ];
15
+
16
+ module.exports = parsers;
@@ -0,0 +1,14 @@
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const yaml = require("js-yaml");
6
+
7
+ /**
8
+ * Parses a YAML string, returning the corresponding object.
9
+ * @param {string} text String to parse as YAML.
10
+ * @returns {object} Corresponding object.
11
+ */
12
+ const yamlParse = (text) => yaml.load(text);
13
+
14
+ module.exports = yamlParse;
@@ -4,10 +4,10 @@
4
4
 
5
5
  /**
6
6
  * Wrapper for calling Node's require.resolve/require with an additional path.
7
- * @param {Object} req Node's require implementation (or equivalent).
8
- * @param {String} id Package identifier to require.
9
- * @param {String[]} dirs Directories to include when resolving paths.
10
- * @returns {Object} Exported module content.
7
+ * @param {object} req Node's require implementation (or equivalent).
8
+ * @param {string} id Package identifier to require.
9
+ * @param {string[]} dirs Directories to include when resolving paths.
10
+ * @returns {object} Exported module content.
11
11
  */
12
12
  const resolveAndRequire = (req, id, dirs) => {
13
13
  const resolvePaths = req.resolve.paths ? req.resolve.paths("") : [];
@@ -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.12.1/schema/markdownlint-cli2-config-schema.json",
3
+ "$id": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.14.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.12.1/schema/markdownlint-cli2-config-schema.json"
10
+ "default": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.14.0/schema/markdownlint-cli2-config-schema.json"
11
11
  },
12
12
  "config": {
13
- "description": "markdownlint configuration schema : https://github.com/DavidAnson/markdownlint/blob/v0.33.0/schema/.markdownlint.jsonc",
14
- "$ref": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.33.0/schema/markdownlint-config-schema.json",
13
+ "description": "markdownlint configuration schema : https://github.com/DavidAnson/markdownlint/blob/v0.35.0/schema/.markdownlint.jsonc",
14
+ "$ref": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.35.0/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.12.1/README.md#markdownlint-cli2jsonc",
18
+ "description": "Module names or paths of custom rules to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
19
19
  "type": "array",
20
20
  "default": [],
21
21
  "items": {
@@ -25,18 +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.12.1/README.md#markdownlint-cli2jsonc",
28
+ "description": "Whether to enable fixing of linting errors reported by rules that emit fix information : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.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.12.1/README.md#markdownlint-cli2jsonc",
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.14.0/README.md#markdownlint-cli2jsonc",
34
34
  "type": "string",
35
35
  "minLength": 1,
36
36
  "default": ""
37
37
  },
38
+ "gitignore": {
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.14.0/README.md#markdownlint-cli2jsonc",
40
+ "type": [
41
+ "boolean",
42
+ "string"
43
+ ],
44
+ "default": false
45
+ },
38
46
  "globs": {
39
- "description": "Glob expressions to include when linting (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
47
+ "description": "Glob expressions to include when linting (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
40
48
  "type": "array",
41
49
  "default": [],
42
50
  "items": {
@@ -46,7 +54,7 @@
46
54
  }
47
55
  },
48
56
  "ignores": {
49
- "description": "Glob expressions to ignore when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
57
+ "description": "Glob expressions to ignore when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
50
58
  "type": "array",
51
59
  "default": [],
52
60
  "items": {
@@ -56,7 +64,7 @@
56
64
  }
57
65
  },
58
66
  "markdownItPlugins": {
59
- "description": "markdown-it plugins to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
67
+ "description": "markdown-it plugins to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
60
68
  "type": "array",
61
69
  "default": [],
62
70
  "items": {
@@ -76,7 +84,7 @@
76
84
  }
77
85
  },
78
86
  "modulePaths": {
79
- "description": "Additional paths to resolve module locations from : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
87
+ "description": "Additional paths to resolve module locations from : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
80
88
  "type": "array",
81
89
  "default": [],
82
90
  "items": {
@@ -85,18 +93,23 @@
85
93
  "minLength": 1
86
94
  }
87
95
  },
96
+ "noBanner": {
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.14.0/README.md#markdownlint-cli2jsonc",
98
+ "type": "boolean",
99
+ "default": false
100
+ },
88
101
  "noInlineConfig": {
89
- "description": "Whether to disable support of HTML comments within Markdown content : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
102
+ "description": "Whether to disable support of HTML comments within Markdown content : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
90
103
  "type": "boolean",
91
104
  "default": false
92
105
  },
93
106
  "noProgress": {
94
- "description": "Whether to disable the display of progress on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
107
+ "description": "Whether to disable the display of progress on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.14.0/README.md#markdownlint-cli2jsonc",
95
108
  "type": "boolean",
96
109
  "default": false
97
110
  },
98
111
  "outputFormatters": {
99
- "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.12.1/README.md#markdownlint-cli2jsonc",
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.14.0/README.md#markdownlint-cli2jsonc",
100
113
  "type": "array",
101
114
  "default": [],
102
115
  "items": {
@@ -116,7 +129,7 @@
116
129
  }
117
130
  },
118
131
  "showFound": {
119
- "description": "Whether to show the list of found files on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.12.1/README.md#markdownlint-cli2jsonc",
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.14.0/README.md#markdownlint-cli2jsonc",
120
133
  "type": "boolean",
121
134
  "default": false
122
135
  }