wikilint 2.37.1 → 2.38.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/dist/base.d.mts +1 -1
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -0
- package/dist/base.mjs +1 -0
- package/dist/bin/config.js +1 -1
- package/dist/lib/lintConfig.js +2 -0
- package/dist/lib/lsp.js +11 -4
- package/dist/lib/title.js +1 -0
- package/dist/src/link/base.js +1 -0
- package/dist/src/link/file.js +12 -0
- package/dist/src/nowiki/index.js +1 -0
- package/dist/src/table/base.d.ts +5 -0
- package/dist/src/table/base.js +3 -2
- package/dist/src/transclude.js +1 -0
- package/dist/util/sharable.js +1 -1
- package/dist/util/sharable.mjs +2 -2
- package/i18n/en.json +1 -0
- package/i18n/zh-hans.json +1 -0
- package/i18n/zh-hant.json +1 -0
- package/package.json +5 -5
package/dist/base.d.mts
CHANGED
|
@@ -44,7 +44,7 @@ export declare const stages: {
|
|
|
44
44
|
converter: number;
|
|
45
45
|
};
|
|
46
46
|
export type Stage = keyof typeof stages;
|
|
47
|
-
export declare const rules: readonly ["arg-in-ext", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
|
|
47
|
+
export declare const rules: readonly ["arg-in-ext", "blank-alt", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
|
|
48
48
|
export declare namespace LintError {
|
|
49
49
|
type Severity = 'error' | 'warning';
|
|
50
50
|
type Rule = typeof rules[number];
|
package/dist/base.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare const stages: {
|
|
|
44
44
|
converter: number;
|
|
45
45
|
};
|
|
46
46
|
export type Stage = keyof typeof stages;
|
|
47
|
-
export declare const rules: readonly ["arg-in-ext", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
|
|
47
|
+
export declare const rules: readonly ["arg-in-ext", "blank-alt", "bold-header", "format-leakage", "fostered-content", "h1", "illegal-attr", "insecure-style", "invalid-gallery", "invalid-imagemap", "invalid-invoke", "invalid-isbn", "invalid-json", "invalid-url", "lonely-apos", "lonely-bracket", "lonely-http", "nested-link", "no-arg", "no-duplicate", "no-ignored", "obsolete-attr", "obsolete-tag", "parsing-order", "pipe-like", "syntax-like", "table-layout", "tag-like", "unbalanced-header", "unclosed-comment", "unclosed-quote", "unclosed-table", "unescaped", "unknown-page", "unmatched-tag", "unterminated-url", "url-encoding", "var-anchor", "void-ext", "invalid-css", "invalid-math"];
|
|
48
48
|
export declare namespace LintError {
|
|
49
49
|
type Severity = 'error' | 'warning';
|
|
50
50
|
type Rule = typeof rules[number];
|
package/dist/base.js
CHANGED
package/dist/base.mjs
CHANGED
package/dist/bin/config.js
CHANGED
|
@@ -39,7 +39,7 @@ const filterGadget = (id) => {
|
|
|
39
39
|
const n = Number(id);
|
|
40
40
|
return n < 2300 || n > 2303; // Gadget, Gadget talk, Gadget definition, Gadget definition talk
|
|
41
41
|
};
|
|
42
|
-
const pkg = "wikilint", version = "2.
|
|
42
|
+
const pkg = "wikilint", version = "2.38.0";
|
|
43
43
|
/**
|
|
44
44
|
* Get the parser configuration for a Wikimedia Foundation project.
|
|
45
45
|
* @param site site nickname
|
package/dist/lib/lintConfig.js
CHANGED
|
@@ -13,6 +13,7 @@ const dict = new Map([
|
|
|
13
13
|
]);
|
|
14
14
|
const defaultLintRuleConfig = {
|
|
15
15
|
'arg-in-ext': 1,
|
|
16
|
+
'blank-alt': 1,
|
|
16
17
|
'bold-header': [
|
|
17
18
|
1,
|
|
18
19
|
{
|
|
@@ -301,6 +302,7 @@ class LintRuleConfiguration {
|
|
|
301
302
|
}
|
|
302
303
|
/** 语法检查设置 */
|
|
303
304
|
class LintConfiguration {
|
|
305
|
+
// @ts-expect-error lazy initialization
|
|
304
306
|
#rules;
|
|
305
307
|
/** @implements */
|
|
306
308
|
get rules() {
|
package/dist/lib/lsp.js
CHANGED
|
@@ -347,13 +347,19 @@ const getSectionEnd = (section, lines, line) => {
|
|
|
347
347
|
/* NOT FOR BROWSER ONLY END */
|
|
348
348
|
/** VSCode-style language service */
|
|
349
349
|
class LanguageService {
|
|
350
|
+
// @ts-expect-error lazy initialization
|
|
350
351
|
#text;
|
|
352
|
+
// @ts-expect-error lazy initialization
|
|
351
353
|
#text2;
|
|
352
354
|
#running;
|
|
353
355
|
#running2;
|
|
356
|
+
// @ts-expect-error lazy initialization
|
|
354
357
|
#done;
|
|
358
|
+
// @ts-expect-error lazy initialization
|
|
355
359
|
#done2;
|
|
360
|
+
// @ts-expect-error lazy initialization
|
|
356
361
|
#config;
|
|
362
|
+
// @ts-expect-error lazy initialization
|
|
357
363
|
#include;
|
|
358
364
|
#completionConfig;
|
|
359
365
|
/** @since v1.17.1 */
|
|
@@ -364,6 +370,7 @@ class LanguageService {
|
|
|
364
370
|
data;
|
|
365
371
|
/* NOT FOR BROWSER ONLY */
|
|
366
372
|
/** @private */
|
|
373
|
+
// @ts-expect-error lazy initialization
|
|
367
374
|
lilypond;
|
|
368
375
|
#lilypondData;
|
|
369
376
|
#mathData;
|
|
@@ -623,10 +630,10 @@ class LanguageService {
|
|
|
623
630
|
else if (!isJa) {
|
|
624
631
|
name = name.slice(2, -2);
|
|
625
632
|
}
|
|
626
|
-
if (name
|
|
633
|
+
if (Object.hasOwn(iAlias, name)) {
|
|
627
634
|
name = iAlias[name];
|
|
628
635
|
}
|
|
629
|
-
else if (name
|
|
636
|
+
else if (Object.hasOwn(sAlias, name)) {
|
|
630
637
|
name = sAlias[name];
|
|
631
638
|
}
|
|
632
639
|
return this.#getBehaviorSwitch(name.toLowerCase());
|
|
@@ -661,10 +668,10 @@ class LanguageService {
|
|
|
661
668
|
if (!this.data) {
|
|
662
669
|
return undefined;
|
|
663
670
|
}
|
|
664
|
-
else if (name
|
|
671
|
+
else if (Object.hasOwn(insensitive, name)) {
|
|
665
672
|
name = insensitive[name];
|
|
666
673
|
}
|
|
667
|
-
else if (name
|
|
674
|
+
else if (Object.hasOwn(sensitive, name)) {
|
|
668
675
|
name = sensitive[name];
|
|
669
676
|
}
|
|
670
677
|
return this.#getParserFunction(name.toLowerCase());
|
package/dist/lib/title.js
CHANGED
package/dist/src/link/base.js
CHANGED
package/dist/src/link/file.js
CHANGED
|
@@ -119,6 +119,18 @@ class FileToken extends base_1.LinkBaseToken {
|
|
|
119
119
|
errors.push(e);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
rule = 'blank-alt';
|
|
123
|
+
s = lintConfig.getSeverity(rule);
|
|
124
|
+
if (s) {
|
|
125
|
+
const alt = this.getArg('alt');
|
|
126
|
+
if (alt?.getValue() === '') {
|
|
127
|
+
const e = (0, lint_1.generateForChild)(alt, rect, rule, 'blank-alt', s);
|
|
128
|
+
if (computeEditInfo || fix) {
|
|
129
|
+
e.fix = (0, lint_1.fixByRemove)(e, -1);
|
|
130
|
+
}
|
|
131
|
+
errors.push(e);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
122
134
|
if (args.length === keys.length
|
|
123
135
|
&& frameKeys.length < 2
|
|
124
136
|
&& horizAlignKeys.length < 2
|
package/dist/src/nowiki/index.js
CHANGED
|
@@ -112,6 +112,7 @@ class NowikiToken extends base_1.NowikiBaseToken {
|
|
|
112
112
|
}
|
|
113
113
|
const e = (0, lint_1.generateForSelf)(this, { start }, rule, 'chem-required', s);
|
|
114
114
|
if (result.status !== 'C') {
|
|
115
|
+
/** @todo native MathML supports more macros than texvcjs */
|
|
115
116
|
const { message, location } = result.error, [endIndex, endLine, endCol] = updateLocation(e, location.end, n);
|
|
116
117
|
[e.startIndex, e.startLine, e.startCol] = updateLocation(e, location.start, n);
|
|
117
118
|
Object.assign(e, { endIndex, endLine, endCol, message });
|
package/dist/src/table/base.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ import type { AttributesParentBase } from '../../mixin/attributesParent';
|
|
|
6
6
|
declare type TableTypes = 'table' | 'tr' | 'td';
|
|
7
7
|
export interface TableBaseToken extends AttributesParentBase {
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* 转义表格语法
|
|
11
|
+
* @param syntax 表格语法节点
|
|
12
|
+
*/
|
|
13
|
+
export declare const escapeTable: (syntax: SyntaxToken) => void;
|
|
9
14
|
/**
|
|
10
15
|
* table row that contains the newline at the beginning but not at the end
|
|
11
16
|
*
|
package/dist/src/table/base.js
CHANGED
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.TableBaseToken = void 0;
|
|
40
|
+
exports.TableBaseToken = exports.escapeTable = void 0;
|
|
41
41
|
const debug_1 = require("../../util/debug");
|
|
42
42
|
const attributesParent_1 = require("../../mixin/attributesParent");
|
|
43
43
|
const index_1 = __importDefault(require("../../index"));
|
|
@@ -56,6 +56,7 @@ const escapeTable = (syntax) => {
|
|
|
56
56
|
syntax.safeReplaceChildren(childNodes);
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
|
+
exports.escapeTable = escapeTable;
|
|
59
60
|
/**
|
|
60
61
|
* table row that contains the newline at the beginning but not at the end
|
|
61
62
|
*
|
|
@@ -93,7 +94,7 @@ let TableBaseToken = (() => {
|
|
|
93
94
|
escape() {
|
|
94
95
|
LSP: for (const child of this.childNodes) {
|
|
95
96
|
if (child instanceof syntax_1.SyntaxToken) {
|
|
96
|
-
escapeTable(child);
|
|
97
|
+
(0, exports.escapeTable)(child);
|
|
97
98
|
}
|
|
98
99
|
else {
|
|
99
100
|
child.escape();
|
package/dist/src/transclude.js
CHANGED
package/dist/util/sharable.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extParams = exports.obsoleteAttrs = exports.extAttrs = exports.htmlAttrs = exports.commonHtmlAttrs = void 0;
|
|
4
4
|
/* eslint-disable unicorn/no-unreadable-iife */
|
|
5
|
-
const blockAttrs = new Set(['align']), citeAttrs = new Set(['cite']), citeAndAttrs = new Set(['cite', 'datetime']), widthAttrs = new Set(['width']),
|
|
5
|
+
const blockAttrs = new Set(['align']), citeAttrs = new Set(['cite']), citeAndAttrs = new Set(['cite', 'datetime']), widthAttrs = new Set(['width']), trAttrs = new Set(['bgcolor', 'align', 'valign']), obsoleteTdAttrs = new Set([...trAttrs, 'axis', 'height', 'nowrap', 'width']), tdAttrs = new Set([...obsoleteTdAttrs, 'abbr', 'headers', 'scope', 'rowspan', 'colspan']), typeAttrs = new Set(['type']), obsoleteTableAttrs = new Set(['summary', 'align', 'bgcolor', 'cellpadding', 'cellspacing', 'frame', 'rules', 'width']), brAttrs = new Set(['clear']), chemAttrs = new Set(['id', 'qid', 'forcemathmode', 'type', 'display']), syntaxHighlightAttrs = new Set([
|
|
6
6
|
'enclose',
|
|
7
7
|
'inline',
|
|
8
8
|
'lang',
|
package/dist/util/sharable.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const blockAttrs = /* @__PURE__ */ new Set(["align"]), citeAttrs = /* @__PURE__ */ new Set(["cite"]), citeAndAttrs = /* @__PURE__ */ new Set(["cite", "datetime"]), widthAttrs = /* @__PURE__ */ new Set(["width"]),
|
|
1
|
+
const blockAttrs = /* @__PURE__ */ new Set(["align"]), citeAttrs = /* @__PURE__ */ new Set(["cite"]), citeAndAttrs = /* @__PURE__ */ new Set(["cite", "datetime"]), widthAttrs = /* @__PURE__ */ new Set(["width"]), trAttrs = /* @__PURE__ */ new Set(["bgcolor", "align", "valign"]), obsoleteTdAttrs = /* @__PURE__ */ new Set([...trAttrs, "axis", "height", "nowrap", "width"]), tdAttrs = /* @__PURE__ */ new Set([...obsoleteTdAttrs, "abbr", "headers", "scope", "rowspan", "colspan"]), typeAttrs = /* @__PURE__ */ new Set(["type"]), obsoleteTableAttrs = /* @__PURE__ */ new Set(
|
|
2
2
|
["summary", "align", "bgcolor", "cellpadding", "cellspacing", "frame", "rules", "width"]
|
|
3
|
-
), brAttrs = /* @__PURE__ */ new Set(["clear"]),
|
|
3
|
+
), brAttrs = /* @__PURE__ */ new Set(["clear"]), chemAttrs = /* @__PURE__ */ new Set(["id", "qid", "forcemathmode", "type", "display"]), syntaxHighlightAttrs = /* @__PURE__ */ new Set([
|
|
4
4
|
"enclose",
|
|
5
5
|
"inline",
|
|
6
6
|
"lang",
|
package/i18n/en.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"argument-in-ext": "template argument inside an extension tag",
|
|
3
3
|
"attributes-of-closing-tag": "attributes of a closing tag",
|
|
4
|
+
"blank-alt": "blank alt attribute",
|
|
4
5
|
"bold-apostrophes": "bold apostrophes",
|
|
5
6
|
"bold-in-header": "bold text in a section header",
|
|
6
7
|
"chem-required": "chem attribute required",
|
package/i18n/zh-hans.json
CHANGED
package/i18n/zh-hant.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikilint",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.0",
|
|
4
4
|
"description": "A Node.js linter for MediaWiki markup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -91,14 +91,14 @@
|
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@bhsd/code-standard": "^2.1.1",
|
|
93
93
|
"@bhsd/nodejs": "^1.0.0",
|
|
94
|
-
"@bhsd/test-util": "^0.
|
|
94
|
+
"@bhsd/test-util": "^1.0.0",
|
|
95
95
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
96
96
|
"@types/color-name": "^2.0.0",
|
|
97
97
|
"@types/color-rgba": "^2.1.3",
|
|
98
98
|
"@types/mocha": "^10.0.10",
|
|
99
99
|
"@types/node": "^24.11.0",
|
|
100
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
101
|
-
"@typescript-eslint/parser": "^8.
|
|
100
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
101
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
102
102
|
"c8": "^11.0.0",
|
|
103
103
|
"color-rgba": "^3.0.0",
|
|
104
104
|
"diff2html-cli": "^5.2.15",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
114
114
|
"markdownlint-cli2": "^0.21.0",
|
|
115
115
|
"mocha": "^11.7.5",
|
|
116
|
-
"typescript": "^
|
|
116
|
+
"typescript": "^6.0.2",
|
|
117
117
|
"v8r": "^6.0.0",
|
|
118
118
|
"vscode-languageserver-textdocument": "^1.0.12"
|
|
119
119
|
},
|