wikilint 2.39.1 → 2.41.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.
Files changed (48) hide show
  1. package/README.md +2 -2
  2. package/config/.schema.json +5 -0
  3. package/config/default.json +11 -2
  4. package/config/enwiki.json +91 -89
  5. package/config/jawiki.json +168 -158
  6. package/config/llwiki.json +2 -1
  7. package/config/minimum.json +3 -81
  8. package/config/moegirl.json +2 -1
  9. package/config/zhwiki.json +128 -126
  10. package/data/signatures.json +1 -1
  11. package/dist/base.d.mts +9 -9
  12. package/dist/base.d.ts +9 -9
  13. package/dist/base.js +1 -0
  14. package/dist/base.mjs +1 -0
  15. package/dist/bin/cli.js +1 -1
  16. package/dist/bin/config.js +11 -10
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +5 -1
  19. package/dist/lib/lintConfig.js +42 -23
  20. package/dist/lib/lsp.js +6 -12
  21. package/dist/lib/node.js +4 -1
  22. package/dist/lib/text.js +5 -2
  23. package/dist/lib/title.js +6 -5
  24. package/dist/parser/commentAndExt.js +2 -1
  25. package/dist/src/attribute.d.ts +4 -1
  26. package/dist/src/attribute.js +3 -2
  27. package/dist/src/attributes.js +29 -5
  28. package/dist/src/heading.js +8 -3
  29. package/dist/src/link/base.d.ts +1 -1
  30. package/dist/src/link/base.js +10 -4
  31. package/dist/src/link/file.js +2 -2
  32. package/dist/src/link/galleryImage.js +0 -1
  33. package/dist/src/magicLink.js +20 -16
  34. package/dist/src/multiLine/gallery.d.ts +5 -3
  35. package/dist/src/multiLine/gallery.js +6 -3
  36. package/dist/src/nowiki/base.d.ts +1 -1
  37. package/dist/src/parameter.js +3 -1
  38. package/dist/src/tagPair/ext.js +11 -5
  39. package/dist/src/tagPair/index.d.ts +1 -1
  40. package/dist/src/transclude.d.ts +6 -1
  41. package/dist/src/transclude.js +18 -15
  42. package/dist/util/constants.js +2 -1
  43. package/dist/util/sharable.js +2 -0
  44. package/dist/util/sharable.mjs +3 -1
  45. package/i18n/en.json +1 -0
  46. package/i18n/zh-hans.json +1 -0
  47. package/i18n/zh-hant.json +1 -0
  48. package/package.json +15 -27
@@ -106,11 +106,17 @@ let ExtToken = (() => {
106
106
  case 'seo':
107
107
  case 'langconvert':
108
108
  case 'phonos':
109
- if (lcName === 'poem') {
110
- newConfig.excludes.push('heading');
111
- }
112
- else if (lcName === 'tab') {
113
- newConfig.ext = newConfig.ext.filter(e => e !== 'tabs');
109
+ switch (lcName) {
110
+ case 'poem':
111
+ newConfig.excludes.push('heading');
112
+ break;
113
+ case 'langconvert':
114
+ newConfig.excludes.push('list');
115
+ break;
116
+ case 'tab':
117
+ newConfig.ext = newConfig.ext.filter(e => e !== 'tabs');
118
+ break;
119
+ // No default
114
120
  }
115
121
  innerToken = new index_2.Token(inner, newConfig, accum);
116
122
  break;
@@ -10,7 +10,7 @@ export declare abstract class TagPairToken extends Token {
10
10
  #private;
11
11
  readonly name: string;
12
12
  closed: boolean;
13
- abstract get type(): 'ext' | 'include' | 'translate';
13
+ abstract get type(): 'ext' | 'translate' | 'include';
14
14
  readonly childNodes: readonly [AstNodes, AstNodes];
15
15
  abstract get firstChild(): AstNodes;
16
16
  abstract get lastChild(): AstNodes;
@@ -13,7 +13,12 @@ export declare abstract class TranscludeToken extends Token {
13
13
  #private;
14
14
  readonly modifier: string;
15
15
  readonly name: string;
16
- readonly childNodes: readonly [AtomToken | SyntaxToken, ...ParameterToken[]] | readonly [SyntaxToken, AtomToken, AtomToken, ...ParameterToken[]];
16
+ readonly childNodes: readonly [
17
+ SyntaxToken,
18
+ AtomToken,
19
+ AtomToken,
20
+ ...ParameterToken[]
21
+ ] | readonly [AtomToken | SyntaxToken, ...ParameterToken[]];
17
22
  abstract get firstChild(): AtomToken | SyntaxToken;
18
23
  abstract get lastChild(): AtomToken | SyntaxToken | ParameterToken;
19
24
  get type(): 'template' | 'magic-word';
@@ -174,7 +174,9 @@ let TranscludeToken = (() => {
174
174
  let i = 1;
175
175
  for (let j = 0; j < parts.length; j++) {
176
176
  const part = parts[j];
177
- if (!(templateLike || this.name === 'switch' && j > 0 || this.name === 'tag' && j > 1)) {
177
+ if (!(templateLike
178
+ || this.name === 'switch' && j > 0
179
+ || this.name === 'tag' && j > 1)) {
178
180
  part[0] = part.join('=');
179
181
  part.length = 1;
180
182
  }
@@ -212,11 +214,15 @@ let TranscludeToken = (() => {
212
214
  * 是否是模板或模块
213
215
  */
214
216
  isTemplate() {
215
- return this.type === 'template' || this.name === 'invoke';
217
+ return this.type === 'template'
218
+ || this.name === 'invoke';
216
219
  }
217
220
  /** 获取模板或模块名 */
218
221
  #getTitle() {
219
- const isTemplate = this.type === 'template', title = this.normalizeTitle((isTemplate ? '' : 'Module:') + (0, string_1.removeComment)(this.childNodes[isTemplate ? 0 : 1].text()), 10, { temporary: true, ...!isTemplate && { page: '' } });
222
+ const isTemplate = this.type === 'template', title = this.normalizeTitle((isTemplate ? '' : 'Module:')
223
+ + (0, string_1.removeComment)(this.childNodes[isTemplate ?
224
+ 0
225
+ : 1].text()), 10, { temporary: true, ...!isTemplate && { page: '' } });
220
226
  return title;
221
227
  }
222
228
  /** @private */
@@ -244,14 +250,15 @@ let TranscludeToken = (() => {
244
250
  }
245
251
  /** @private */
246
252
  text() {
247
- const { childNodes, length, firstChild, modifier, type, name } = this;
248
- return type === 'magic-word' && name === 'vardefine'
249
- ? ''
250
- : `{{${modifier}${type === 'magic-word'
251
- ? firstChild.text()
252
- + (length === 1 ? '' : this.#colon)
253
- + (0, string_1.text)(childNodes.slice(1), '|')
254
- : super.text('|')}}}`;
253
+ const { childNodes, length, firstChild, modifier, type, name, } = this;
254
+ if (type === 'magic-word' && name === 'vardefine') {
255
+ return '';
256
+ }
257
+ return `{{${modifier}${type === 'magic-word'
258
+ ? firstChild.text()
259
+ + (length === 1 ? '' : this.#colon)
260
+ + (0, string_1.text)(childNodes.slice(1), '|')
261
+ : super.text('|')}}}`;
255
262
  }
256
263
  /** @private */
257
264
  getAttribute(key) {
@@ -320,10 +327,8 @@ let TranscludeToken = (() => {
320
327
  }
321
328
  }
322
329
  #handleAnonArgChange(addedToken, append) {
323
- /* eslint-disable @stylistic/operator-linebreak */
324
330
  this.#anonCount +=
325
331
  1;
326
- /* eslint-enable @stylistic/operator-linebreak */
327
332
  let i;
328
333
  // eslint-disable-next-line prefer-const
329
334
  i = this.#anonCount - 1;
@@ -361,9 +366,7 @@ let TranscludeToken = (() => {
361
366
  args = this.#args.get(keyStr);
362
367
  }
363
368
  else {
364
- /* eslint-disable @stylistic/function-paren-newline */
365
369
  args = new Set();
366
- /* eslint-enable @stylistic/function-paren-newline */
367
370
  this.#args.set(keyStr, args);
368
371
  }
369
372
  return args;
@@ -8,8 +8,9 @@ var BuildMethod;
8
8
  BuildMethod[BuildMethod["Text"] = 1] = "Text";
9
9
  })(BuildMethod || (exports.BuildMethod = BuildMethod = {}));
10
10
  exports.enMsg = (() => {
11
+ LSP: return require(
11
12
  // eslint-disable-next-line n/no-missing-require
12
- LSP: return require('../../i18n/en.json');
13
+ '../../i18n/en.json');
13
14
  })();
14
15
  exports.galleryParams = new Set(['alt', 'link', 'lang', 'page', 'caption']);
15
16
  exports.extensions = new Set(['tiff', 'tif', 'png', 'gif', 'jpg', 'jpeg', 'webp', 'xcf', 'pdf', 'svg', 'djvu']);
@@ -88,6 +88,8 @@ exports.htmlAttrs = (() => ({
88
88
  categorytree: blockAttrs,
89
89
  combooption: blockAttrs,
90
90
  img: new Set(['alt', 'src', 'width', 'height', 'loading', 'srcset']),
91
+ /* NOT FOR BROWSER ONLY */
92
+ a: new Set(['href', 'rel', 'rev']),
91
93
  }))();
92
94
  exports.extAttrs = (() => ({
93
95
  pre: new Set(['format']),
@@ -85,7 +85,9 @@ const htmlAttrs = /* @__PURE__ */ (() => ({
85
85
  poem: blockAttrs,
86
86
  categorytree: blockAttrs,
87
87
  combooption: blockAttrs,
88
- img: /* @__PURE__ */ new Set(["alt", "src", "width", "height", "loading", "srcset"])
88
+ img: /* @__PURE__ */ new Set(["alt", "src", "width", "height", "loading", "srcset"]),
89
+ /* NOT FOR BROWSER ONLY */
90
+ a: /* @__PURE__ */ new Set(["href", "rel", "rev"])
89
91
  }))();
90
92
  const extAttrs = /* @__PURE__ */ (() => ({
91
93
  pre: /* @__PURE__ */ new Set(["format"]),
package/i18n/en.json CHANGED
@@ -67,6 +67,7 @@
67
67
  "redirect-like": "redirect-like syntax in a list item",
68
68
  "ref-in-link": "<ref> in an internal or external link",
69
69
  "remove": null,
70
+ "required-attribute": "required $1 attribute is missing",
70
71
  "template-in-link": "template in an internal link target",
71
72
  "unbalanced-in-section-header": "unbalanced $1 in a section header",
72
73
  "unclosed": "unclosed $1",
package/i18n/zh-hans.json CHANGED
@@ -67,6 +67,7 @@
67
67
  "redirect-like": "列表项中的疑似重定向语法",
68
68
  "ref-in-link": "内部或外部链接中的<ref>",
69
69
  "remove": "移除",
70
+ "required-attribute": "缺少必需的$1属性",
70
71
  "template-in-link": "内部链接目标中的模板",
71
72
  "unbalanced-in-section-header": "章节标题中未成对的$1",
72
73
  "unclosed": "未闭合的$1",
package/i18n/zh-hant.json CHANGED
@@ -67,6 +67,7 @@
67
67
  "redirect-like": "列表項中的疑似重新導向語法",
68
68
  "ref-in-link": "內部或外部連結裡的<ref>",
69
69
  "remove": "移除",
70
+ "required-attribute": "缺少必需的$1屬性",
70
71
  "template-in-link": "內部連結目標中的模板",
71
72
  "unbalanced-in-section-header": "章節標題裡的$1未成對",
72
73
  "unclosed": "有未關閉的$1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikilint",
3
- "version": "2.39.1",
3
+ "version": "2.41.0",
4
4
  "description": "A Node.js linter for MediaWiki markup",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -18,7 +18,7 @@
18
18
  "/errors/README",
19
19
  "/config/",
20
20
  "!/config/mediawikiwiki.json",
21
- "!/config/testwiki.json",
21
+ "!/config/github.json",
22
22
  "/data/",
23
23
  "/i18n/",
24
24
  "/coverage/badge.svg",
@@ -45,7 +45,7 @@
45
45
  "build:define": "bash sed.sh -i \"s/pkg = \\$PKG/pkg = $(npm pkg get name)/; s/version = \\$VERSION/version = $(npm pkg get version)/\" dist/bin/config.js",
46
46
  "build": "npm run build:core",
47
47
  "diff": "bash diff.sh",
48
- "diff:stat": "f() { git diff --stat --ignore-all-space --color=always $1 $2 -- . | grep '\\.ts'; }; f",
48
+ "diff:stat": "f() { git diff --stat -w --color=always $1 $2 -- . | grep '\\.ts'; }; f",
49
49
  "lint:ts": "tsc --noEmit && eslint --cache .",
50
50
  "lint:json": "v8r -s config/.schema.json config/*.json && v8r -s data/.schema.json data/*.json && mocha dist/test/json.js",
51
51
  "lint:md": "markdownlint-cli2 '*.md'",
@@ -74,53 +74,41 @@
74
74
  ]
75
75
  },
76
76
  "dependencies": {
77
- "@bhsd/cm-util": "^1.0.0",
78
- "@bhsd/common": "^2.0.0",
79
- "@bhsd/stylelint-util": "^1.0.2",
77
+ "@bhsd/cm-util": "^2.0.1",
78
+ "@bhsd/common": "^2.2.1",
79
+ "@bhsd/stylelint-util": "^1.0.3",
80
80
  "binary-search": "^1.3.6",
81
81
  "vscode-languageserver-types": "^3.17.5"
82
82
  },
83
83
  "optionalDependencies": {
84
- "color-name": "^2.0.0",
84
+ "color-name": "~2.0.2",
85
85
  "entities": "^8.0.0",
86
86
  "mathoid-texvcjs": "^0.6.0",
87
- "stylelint": "^17.9.0",
87
+ "stylelint": "^17.12.0",
88
88
  "vscode-css-languageservice": "^6.3.10",
89
89
  "vscode-html-languageservice": "^5.6.2",
90
90
  "vscode-json-languageservice": "^5.7.2"
91
91
  },
92
92
  "devDependencies": {
93
- "@bhsd/code-standard": "^2.2.0",
94
- "@bhsd/nodejs": "^1.0.0",
95
- "@bhsd/test-util": "^1.1.0",
96
- "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
97
- "@stylistic/eslint-plugin": "^5.10.0",
93
+ "@bhsd/code-standard": "^2.5.1",
94
+ "@bhsd/nodejs": "^1.0.1",
95
+ "@bhsd/test-util": "^1.3.1",
98
96
  "@types/color-name": "^2.0.0",
99
97
  "@types/color-rgba": "^2.1.3",
100
98
  "@types/mocha": "^10.0.10",
101
- "@types/node": "^24.11.0",
102
- "@typescript-eslint/eslint-plugin": "^8.59.0",
103
- "@typescript-eslint/parser": "^8.59.0",
99
+ "@types/node": "^25.9.0",
100
+ "@typescript-eslint/parser": "^8.59.4",
104
101
  "c8": "^11.0.0",
105
102
  "color-rgba": "^3.0.0",
106
103
  "diff2html-cli": "^5.2.15",
107
104
  "esbuild": "^0.28.0",
108
- "eslint": "^10.2.1",
109
- "eslint-plugin-jsdoc": "^62.9.0",
110
- "eslint-plugin-jsonc": "^3.1.2",
111
- "eslint-plugin-n": "^17.24.0",
112
- "eslint-plugin-promise": "^7.2.1",
113
- "eslint-plugin-regexp": "^3.1.0",
114
- "eslint-plugin-unicorn": "^64.0.0",
105
+ "eslint": "^10.4.0",
115
106
  "markdownlint-cli2": "^0.22.1",
116
107
  "mocha": "^11.7.5",
117
108
  "typescript": "^6.0.3",
118
- "v8r": "^6.0.0",
109
+ "v8r": "^6.1.0",
119
110
  "vscode-languageserver-textdocument": "^1.0.12"
120
111
  },
121
- "overrides": {
122
- "eslint": "^10.2.1"
123
- },
124
112
  "engines": {
125
113
  "node": "^20.19.0 || ^22.13.0 || >=24.11.0"
126
114
  }