wikilint 2.38.0 → 2.38.1
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 +2 -1
- package/dist/base.d.ts +2 -1
- package/dist/bin/config.js +5 -4
- package/dist/index.js +2 -2
- package/dist/lib/lintConfig.js +4 -3
- package/dist/lib/lsp.d.ts +3 -1
- package/dist/lib/lsp.js +10 -12
- package/package.json +7 -7
package/dist/base.d.mts
CHANGED
|
@@ -124,7 +124,7 @@ export interface LanguageService {
|
|
|
124
124
|
*
|
|
125
125
|
* 销毁实例
|
|
126
126
|
*/
|
|
127
|
-
destroy(): void
|
|
127
|
+
destroy(): Promise<void>;
|
|
128
128
|
/**
|
|
129
129
|
* Provide color decorators
|
|
130
130
|
*
|
|
@@ -264,6 +264,7 @@ export interface LanguageService {
|
|
|
264
264
|
* @param user URI for wiki userpage or email address of the user / 维基用户页面地址或用户的电子邮件地址
|
|
265
265
|
*/
|
|
266
266
|
setTargetWikipedia(wiki: string, user: string): Promise<void>;
|
|
267
|
+
[Symbol.dispose](): void;
|
|
267
268
|
}
|
|
268
269
|
export type SeverityLevel = 0 | 1 | 2 | false | 'off' | 'warning' | 'error';
|
|
269
270
|
export type LintConfigValue = SeverityLevel | [SeverityLevel, Record<string, SeverityLevel>?];
|
package/dist/base.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export interface LanguageService {
|
|
|
124
124
|
*
|
|
125
125
|
* 销毁实例
|
|
126
126
|
*/
|
|
127
|
-
destroy(): void
|
|
127
|
+
destroy(): Promise<void>;
|
|
128
128
|
/**
|
|
129
129
|
* Provide color decorators
|
|
130
130
|
*
|
|
@@ -264,6 +264,7 @@ export interface LanguageService {
|
|
|
264
264
|
* @param user URI for wiki userpage or email address of the user / 维基用户页面地址或用户的电子邮件地址
|
|
265
265
|
*/
|
|
266
266
|
setTargetWikipedia(wiki: string, user: string): Promise<void>;
|
|
267
|
+
[Symbol.dispose](): void;
|
|
267
268
|
}
|
|
268
269
|
export type SeverityLevel = 0 | 1 | 2 | false | 'off' | 'warning' | 'error';
|
|
269
270
|
export type LintConfigValue = SeverityLevel | [SeverityLevel, Record<string, SeverityLevel>?];
|
package/dist/bin/config.js
CHANGED
|
@@ -16,7 +16,8 @@ const diff_1 = require("../util/diff");
|
|
|
16
16
|
* @param config.articlePath article path
|
|
17
17
|
*/
|
|
18
18
|
const arrToObj = ({ articlePath, ...obj }) => {
|
|
19
|
-
for (const
|
|
19
|
+
for (const k in obj) {
|
|
20
|
+
const v = obj[k];
|
|
20
21
|
if (Array.isArray(v) && v.every(x => typeof x === 'string')) {
|
|
21
22
|
Object.assign(obj, { [k]: Object.fromEntries(v.map(x => [x, true])) });
|
|
22
23
|
}
|
|
@@ -39,7 +40,7 @@ const filterGadget = (id) => {
|
|
|
39
40
|
const n = Number(id);
|
|
40
41
|
return n < 2300 || n > 2303; // Gadget, Gadget talk, Gadget definition, Gadget definition talk
|
|
41
42
|
};
|
|
42
|
-
const pkg = "wikilint", version = "2.38.
|
|
43
|
+
const pkg = "wikilint", version = "2.38.1";
|
|
43
44
|
/**
|
|
44
45
|
* Get the parser configuration for a Wikimedia Foundation project.
|
|
45
46
|
* @param site site nickname
|
|
@@ -147,9 +148,9 @@ exports.default = async (site, url, user, force, internal) => {
|
|
|
147
148
|
}
|
|
148
149
|
else {
|
|
149
150
|
const oldConfig = arrToObj(require(file)), newConfig = arrToObj(config);
|
|
150
|
-
for (const
|
|
151
|
+
for (const k in newConfig) {
|
|
151
152
|
try {
|
|
152
|
-
strict_1.default.deepStrictEqual(oldConfig[k],
|
|
153
|
+
strict_1.default.deepStrictEqual(oldConfig[k], newConfig[k]);
|
|
153
154
|
}
|
|
154
155
|
catch (e) {
|
|
155
156
|
if (e instanceof strict_1.default.AssertionError) {
|
package/dist/index.js
CHANGED
|
@@ -200,7 +200,7 @@ const Parser = {
|
|
|
200
200
|
catch (e) /* c8 ignore start */ {
|
|
201
201
|
if (e instanceof Error) {
|
|
202
202
|
const file = path_1.default.join(__dirname, '..', 'errors', new Date().toISOString()), stage = token.getAttribute('stage');
|
|
203
|
-
for (const k
|
|
203
|
+
for (const k in config) {
|
|
204
204
|
if (k.startsWith('regex') || config[k] instanceof Set) {
|
|
205
205
|
delete config[k];
|
|
206
206
|
}
|
|
@@ -263,7 +263,7 @@ const def = {
|
|
|
263
263
|
/* NOT FOR BROWSER ONLY */
|
|
264
264
|
'fetchConfig',
|
|
265
265
|
]);
|
|
266
|
-
for (const key
|
|
266
|
+
for (const key in Parser) {
|
|
267
267
|
if (!enumerable.has(key)) {
|
|
268
268
|
def[key] = { enumerable: false };
|
|
269
269
|
}
|
package/dist/lib/lintConfig.js
CHANGED
|
@@ -287,8 +287,8 @@ class LintRuleConfiguration {
|
|
|
287
287
|
if (!config) {
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
for (const
|
|
291
|
-
set(this, key,
|
|
290
|
+
for (const key in config) {
|
|
291
|
+
set(this, key, config[key]);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
/** @implements */
|
|
@@ -330,7 +330,8 @@ class LintConfiguration {
|
|
|
330
330
|
else {
|
|
331
331
|
const { rules: ruleConfig, ...other } = (config ?? {});
|
|
332
332
|
this.rules = ruleConfig;
|
|
333
|
-
for (const
|
|
333
|
+
for (const key in other) {
|
|
334
|
+
const value = other[key];
|
|
334
335
|
if (value !== undefined && Object.prototype.hasOwnProperty.call(defaultLintConfig, key)) {
|
|
335
336
|
this[key] = value;
|
|
336
337
|
}
|
package/dist/lib/lsp.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class LanguageService implements LanguageServiceBase {
|
|
|
16
16
|
/** @param uri 任务标识 */
|
|
17
17
|
constructor(uri: object);
|
|
18
18
|
/** @implements */
|
|
19
|
-
destroy(): void
|
|
19
|
+
destroy(): Promise<void>;
|
|
20
20
|
/**
|
|
21
21
|
* Provide color decorators
|
|
22
22
|
*
|
|
@@ -160,4 +160,6 @@ export declare class LanguageService implements LanguageServiceBase {
|
|
|
160
160
|
* @since v1.18.1
|
|
161
161
|
*/
|
|
162
162
|
setTargetWikipedia(wiki: string, user: string): Promise<void>;
|
|
163
|
+
/** @implements */
|
|
164
|
+
[Symbol.dispose](): void;
|
|
163
165
|
}
|
package/dist/lib/lsp.js
CHANGED
|
@@ -393,19 +393,12 @@ class LanguageService {
|
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
395
|
/** @implements */
|
|
396
|
-
destroy() {
|
|
396
|
+
async destroy() {
|
|
397
397
|
Object.setPrototypeOf(this, null);
|
|
398
398
|
/* NOT FOR BROWSER ONLY */
|
|
399
399
|
const dir = path_1.default.join(__dirname, 'lilypond');
|
|
400
400
|
if (fs_1.default.existsSync(dir)) {
|
|
401
|
-
|
|
402
|
-
(async () => {
|
|
403
|
-
try {
|
|
404
|
-
await fs_1.default.promises.unlink(path_1.default.join(dir, file));
|
|
405
|
-
}
|
|
406
|
-
catch { }
|
|
407
|
-
})();
|
|
408
|
-
}
|
|
401
|
+
await Promise.allSettled(fs_1.default.readdirSync(dir).map(file => fs_1.default.promises.unlink(path_1.default.join(dir, file))));
|
|
409
402
|
}
|
|
410
403
|
}
|
|
411
404
|
/** 检查解析设置有无更新 */
|
|
@@ -930,8 +923,9 @@ class LanguageService {
|
|
|
930
923
|
let lilypondDiagnostics = [];
|
|
931
924
|
if (this.lilypond) {
|
|
932
925
|
const tokens = root.querySelectorAll('ext#score').filter(token => {
|
|
933
|
-
const lang = token.getAttr('lang');
|
|
934
|
-
return (lang === undefined || lang === 'lilypond') &&
|
|
926
|
+
const lang = token.getAttr('lang'), { innerText } = token;
|
|
927
|
+
return (lang === undefined || lang === 'lilypond') && innerText?.trim()
|
|
928
|
+
&& !/[#$](?!@?\s*(?:'\s*)?(?:[#"]|-?\.?\d|[a-z_][-:\w]*(?![^)\]}\s])))/iu.test(innerText);
|
|
935
929
|
});
|
|
936
930
|
if (tokens.length > 0) {
|
|
937
931
|
const dir = path_1.default.join(__dirname, 'lilypond');
|
|
@@ -949,7 +943,7 @@ class LanguageService {
|
|
|
949
943
|
fs_1.default.writeFileSync(file, score);
|
|
950
944
|
try {
|
|
951
945
|
// eslint-disable-next-line @typescript-eslint/strict-void-return
|
|
952
|
-
await util_1.default.promisify(child_process_1.execFile)(this.lilypond, ['-s', '-o', dir, file]);
|
|
946
|
+
await util_1.default.promisify(child_process_1.execFile)(this.lilypond, ['-dno-print-pages', '-s', '-o', dir, file]);
|
|
953
947
|
scores.set(score, []);
|
|
954
948
|
}
|
|
955
949
|
catch (e) {
|
|
@@ -1609,5 +1603,9 @@ class LanguageService {
|
|
|
1609
1603
|
}
|
|
1610
1604
|
Object.assign(this.config, { articlePath: `${host}/wiki/` });
|
|
1611
1605
|
}
|
|
1606
|
+
/** @implements */
|
|
1607
|
+
[Symbol.dispose]() {
|
|
1608
|
+
void this.destroy();
|
|
1609
|
+
}
|
|
1612
1610
|
}
|
|
1613
1611
|
exports.LanguageService = LanguageService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikilint",
|
|
3
|
-
"version": "2.38.
|
|
3
|
+
"version": "2.38.1",
|
|
4
4
|
"description": "A Node.js linter for MediaWiki markup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -89,9 +89,10 @@
|
|
|
89
89
|
"vscode-json-languageservice": "^5.7.2"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@bhsd/code-standard": "^2.
|
|
92
|
+
"@bhsd/code-standard": "^2.2.0",
|
|
93
93
|
"@bhsd/nodejs": "^1.0.0",
|
|
94
94
|
"@bhsd/test-util": "^1.0.0",
|
|
95
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
95
96
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
96
97
|
"@types/color-name": "^2.0.0",
|
|
97
98
|
"@types/color-rgba": "^2.1.3",
|
|
@@ -102,15 +103,14 @@
|
|
|
102
103
|
"c8": "^11.0.0",
|
|
103
104
|
"color-rgba": "^3.0.0",
|
|
104
105
|
"diff2html-cli": "^5.2.15",
|
|
105
|
-
"esbuild": "^0.27.
|
|
106
|
-
"eslint": "^
|
|
107
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
106
|
+
"esbuild": "^0.27.7",
|
|
107
|
+
"eslint": "^10.2.0",
|
|
108
108
|
"eslint-plugin-jsdoc": "^62.7.1",
|
|
109
|
-
"eslint-plugin-jsonc": "^3.1.
|
|
109
|
+
"eslint-plugin-jsonc": "^3.1.2",
|
|
110
110
|
"eslint-plugin-n": "^17.24.0",
|
|
111
111
|
"eslint-plugin-promise": "^7.2.1",
|
|
112
112
|
"eslint-plugin-regexp": "^3.1.0",
|
|
113
|
-
"eslint-plugin-unicorn": "^
|
|
113
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
114
114
|
"markdownlint-cli2": "^0.21.0",
|
|
115
115
|
"mocha": "^11.7.5",
|
|
116
116
|
"typescript": "^6.0.2",
|