@electron/lint-roller 1.13.0 → 2.1.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 +6 -6
- package/configs/markdownlint.json +8 -5
- package/dist/bin/lint-markdown-links.js +1 -6
- package/dist/bin/lint-markdown-links.js.map +1 -1
- package/dist/bin/lint-markdown-standard.js +1 -1
- package/dist/bin/lint-markdown-standard.js.map +1 -1
- package/dist/bin/lint-markdown-ts-check.js +35 -73
- package/dist/bin/lint-markdown-ts-check.js.map +1 -1
- package/dist/bin/markdownlint-cli-wrapper.js +1 -1
- package/dist/bin/markdownlint-cli-wrapper.js.map +1 -1
- package/dist/lib/helpers.d.ts +8 -0
- package/dist/lib/helpers.js +15 -1
- package/dist/lib/helpers.js.map +1 -1
- package/lib/helpers.ts +24 -0
- package/markdownlint-rules/emd002.js +2428 -437
- package/markdownlint-rules/emd002.mjs +17 -5
- package/markdownlint-rules/emd003.js +2425 -437
- package/markdownlint-rules/emd003.mjs +14 -5
- package/markdownlint-rules/index.js +4 -0
- package/package.json +19 -18
- package/markdownlint-rules/emd001.js +0 -26
|
@@ -4,7 +4,8 @@ import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
|
4
4
|
import { visit } from 'unist-util-visit';
|
|
5
5
|
|
|
6
6
|
export const names = ['EMD003', 'no-curly-braces'];
|
|
7
|
-
export const description =
|
|
7
|
+
export const description =
|
|
8
|
+
'No unescaped opening curly braces in text (does not play nice with MDX)';
|
|
8
9
|
export const tags = ['braces'];
|
|
9
10
|
|
|
10
11
|
const UNESCAPED_REGEX = /(?<!\\){/g;
|
|
@@ -31,16 +32,24 @@ function EMD003(params, onError) {
|
|
|
31
32
|
tree,
|
|
32
33
|
(node) => node.type === 'text',
|
|
33
34
|
(node) => {
|
|
34
|
-
const rawContent = childToken.line.slice(
|
|
35
|
+
const rawContent = childToken.line.slice(
|
|
36
|
+
node.position.start.offset,
|
|
37
|
+
node.position.end.offset,
|
|
38
|
+
);
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
const matches = rawContent.matchAll(UNESCAPED_REGEX);
|
|
41
|
+
|
|
42
|
+
for (const match of matches) {
|
|
43
|
+
addError(onError, childToken.lineNumber, 'Unescaped opening curly brace', undefined, [
|
|
44
|
+
node.position.start.offset + 1 + match.index,
|
|
45
|
+
1,
|
|
46
|
+
]);
|
|
38
47
|
}
|
|
39
48
|
},
|
|
40
49
|
);
|
|
41
50
|
}
|
|
42
51
|
}
|
|
43
52
|
});
|
|
44
|
-
}
|
|
53
|
+
}
|
|
45
54
|
|
|
46
55
|
export { EMD003 as function };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electron/lint-roller",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Markdown linting helpers for Electron org repos",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=
|
|
6
|
+
"node": ">=18.0.0"
|
|
7
7
|
},
|
|
8
8
|
"bin": {
|
|
9
9
|
"electron-markdownlint": "./dist/bin/markdownlint-cli-wrapper.js",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"lint-roller-markdown-links": "./dist/bin/lint-markdown-links.js",
|
|
11
|
+
"lint-roller-markdown-standard": "./dist/bin/lint-markdown-standard.js",
|
|
12
|
+
"lint-roller-markdown-ts-check": "./dist/bin/lint-markdown-ts-check.js"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"configs",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc && yarn run build:emd002 && yarn run build:emd003",
|
|
25
|
-
"build:emd002": "esbuild --platform=node --target=
|
|
26
|
-
"build:emd003": "esbuild --platform=node --target=
|
|
25
|
+
"build:emd002": "esbuild --platform=node --target=node18 --format=cjs --bundle --outfile=markdownlint-rules/emd002.js markdownlint-rules/emd002.mjs",
|
|
26
|
+
"build:emd003": "esbuild --platform=node --target=node18 --format=cjs --bundle --outfile=markdownlint-rules/emd003.js markdownlint-rules/emd003.mjs",
|
|
27
27
|
"prepublishOnly": "yarn run build",
|
|
28
|
-
"lint:eslint": "eslint \"{bin,lib,markdownlint-rules,tests}/**/*.{js,ts}\"",
|
|
29
|
-
"lint:eslint:fix": "eslint --fix \"{bin,lib,markdownlint-rules,tests}/**/*.{js,ts}\"",
|
|
28
|
+
"lint:eslint": "eslint \"{bin,lib,markdownlint-rules,tests}/**/*.{js,mjs,ts}\"",
|
|
29
|
+
"lint:eslint:fix": "eslint --fix \"{bin,lib,markdownlint-rules,tests}/**/*.{js,mjs,ts}\"",
|
|
30
30
|
"lint:markdown": "yarn run build && node ./dist/bin/markdownlint-cli-wrapper.js \"*.md\" && node ./dist/bin/lint-markdown-links.js \"*.md\"",
|
|
31
|
-
"lint:prettier": "prettier --check \"{bin,lib,markdownlint-rules,tests}/**/*.{js,ts}\"",
|
|
32
|
-
"lint:prettier:fix": "prettier --write \"{bin,lib,markdownlint-rules,tests}/**/*.{js,ts}\"",
|
|
31
|
+
"lint:prettier": "prettier --check \"{bin,lib,markdownlint-rules,tests}/**/*.{js,mjs,ts}\"",
|
|
32
|
+
"lint:prettier:fix": "prettier --write \"{bin,lib,markdownlint-rules,tests}/**/*.{js,mjs,ts}\"",
|
|
33
33
|
"lint": "yarn run lint:prettier && yarn run lint:markdown",
|
|
34
34
|
"lint:fix": "yarn run lint:eslint:fix && yarn run lint:prettier:fix",
|
|
35
35
|
"test": "yarn run build && jest"
|
|
@@ -52,25 +52,23 @@
|
|
|
52
52
|
"@types/markdown-it": "^13.0.6",
|
|
53
53
|
"@types/minimist": "^1.2.5",
|
|
54
54
|
"@types/node": "20.1.2",
|
|
55
|
-
"
|
|
56
|
-
"esbuild": "^0.20.1",
|
|
55
|
+
"esbuild": "^0.21.0",
|
|
57
56
|
"eslint": "^8.54.0",
|
|
58
|
-
"eslint-config-prettier": "^9.
|
|
57
|
+
"eslint-config-prettier": "^9.1.0",
|
|
59
58
|
"eslint-plugin-node": "^11.1.0",
|
|
60
59
|
"jest": "^29.7.0",
|
|
61
|
-
"prettier": "^3.
|
|
60
|
+
"prettier": "^3.2.5",
|
|
62
61
|
"ts-jest": "^29.1.1",
|
|
63
|
-
"typescript": "^5.
|
|
62
|
+
"typescript": "^5.4.5"
|
|
64
63
|
},
|
|
65
64
|
"dependencies": {
|
|
66
65
|
"@dsanders11/vscode-markdown-languageservice": "^0.3.0",
|
|
67
66
|
"balanced-match": "^2.0.0",
|
|
68
67
|
"glob": "^8.1.0",
|
|
69
68
|
"markdown-it": "^13.0.1",
|
|
70
|
-
"markdownlint-cli": "^0.
|
|
69
|
+
"markdownlint-cli": "^0.40.0",
|
|
71
70
|
"mdast-util-from-markdown": "^1.3.0",
|
|
72
71
|
"minimist": "^1.2.8",
|
|
73
|
-
"node-fetch": "^2.6.9",
|
|
74
72
|
"rimraf": "^4.4.1",
|
|
75
73
|
"standard": "^17.0.0",
|
|
76
74
|
"unist-util-visit": "^4.1.2",
|
|
@@ -85,5 +83,8 @@
|
|
|
85
83
|
"typescript": {
|
|
86
84
|
"optional": true
|
|
87
85
|
}
|
|
86
|
+
},
|
|
87
|
+
"resolutions": {
|
|
88
|
+
"jackspeak": "2.1.1"
|
|
88
89
|
}
|
|
89
90
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const { addError, getLineMetadata, getReferenceLinkImageData } = require('markdownlint/helpers');
|
|
2
|
-
|
|
3
|
-
// These are used by GitHub's "alert" extension to Markdown
|
|
4
|
-
// https://github.com/orgs/community/discussions/16925
|
|
5
|
-
const ALERT_KEYWORDS = ['!note', '!tip', '!important', '!warning', '!caution'];
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
names: ['EMD001', 'no-shortcut-reference-links'],
|
|
9
|
-
description: 'Disallow shortcut reference links (those with no link label)',
|
|
10
|
-
tags: ['images', 'links'],
|
|
11
|
-
function: function EMD001(params, onError) {
|
|
12
|
-
const lineMetadata = getLineMetadata(params);
|
|
13
|
-
const { shortcuts } = getReferenceLinkImageData(lineMetadata);
|
|
14
|
-
for (const [shortcut, occurrences] of shortcuts) {
|
|
15
|
-
for (const [lineNumber] of occurrences) {
|
|
16
|
-
if (!ALERT_KEYWORDS.includes(shortcut)) {
|
|
17
|
-
addError(
|
|
18
|
-
onError,
|
|
19
|
-
lineNumber + 1, // human-friendly line numbers (1-based)
|
|
20
|
-
`Disallowed shortcut reference link: "${shortcut}"`,
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
};
|