@electron/lint-roller 2.1.0 → 2.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.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const { addError, filterTokens } = require('markdownlint/helpers');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
names: ['EMD004', 'no-newline-in-links'],
|
|
5
|
+
description: 'Newlines inside link text',
|
|
6
|
+
tags: ['newline', 'links'],
|
|
7
|
+
parser: 'markdownit',
|
|
8
|
+
function: function EMD004(params, onError) {
|
|
9
|
+
filterTokens(params, 'inline', (token) => {
|
|
10
|
+
const { children } = token;
|
|
11
|
+
let { lineNumber } = token;
|
|
12
|
+
let inLink = false;
|
|
13
|
+
for (const child of children) {
|
|
14
|
+
const { type } = child;
|
|
15
|
+
if (type === 'link_open') {
|
|
16
|
+
inLink = true;
|
|
17
|
+
} else if (type === 'link_close') {
|
|
18
|
+
inLink = false;
|
|
19
|
+
} else if (type === 'softbreak') {
|
|
20
|
+
if (inLink) {
|
|
21
|
+
addError(onError, lineNumber);
|
|
22
|
+
break;
|
|
23
|
+
} else {
|
|
24
|
+
lineNumber++;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electron/lint-roller",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Markdown linting helpers for Electron org repos",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
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
|
-
"test": "yarn run build &&
|
|
35
|
+
"test": "yarn run build && vitest run --reporter=verbose"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"@electron-internal/eslint-config": "^1.0.1",
|
|
49
49
|
"@types/balanced-match": "^1.0.3",
|
|
50
50
|
"@types/glob": "^8.1.0",
|
|
51
|
-
"@types/jest": "^29.5.8",
|
|
52
51
|
"@types/markdown-it": "^13.0.6",
|
|
53
52
|
"@types/minimist": "^1.2.5",
|
|
54
53
|
"@types/node": "20.1.2",
|
|
@@ -56,10 +55,9 @@
|
|
|
56
55
|
"eslint": "^8.54.0",
|
|
57
56
|
"eslint-config-prettier": "^9.1.0",
|
|
58
57
|
"eslint-plugin-node": "^11.1.0",
|
|
59
|
-
"jest": "^29.7.0",
|
|
60
58
|
"prettier": "^3.2.5",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
59
|
+
"typescript": "^5.4.5",
|
|
60
|
+
"vitest": "^1.5.3"
|
|
63
61
|
},
|
|
64
62
|
"dependencies": {
|
|
65
63
|
"@dsanders11/vscode-markdown-languageservice": "^0.3.0",
|