wikilint 2.1.5 → 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.
Files changed (54) hide show
  1. package/dist/base.d.ts +19 -18
  2. package/dist/index.js +1 -1
  3. package/dist/internal.d.ts +2 -2
  4. package/dist/lib/element.d.ts +3 -3
  5. package/dist/lib/element.js +1 -1
  6. package/dist/lib/node.d.ts +7 -7
  7. package/dist/lib/node.js +1 -3
  8. package/dist/lib/text.d.ts +2 -2
  9. package/dist/lib/title.d.ts +1 -1
  10. package/dist/parser/links.js +1 -1
  11. package/dist/parser/table.js +6 -4
  12. package/dist/src/arg.d.ts +2 -2
  13. package/dist/src/attribute.d.ts +4 -4
  14. package/dist/src/attribute.js +1 -1
  15. package/dist/src/attributes.d.ts +5 -4
  16. package/dist/src/attributes.js +7 -3
  17. package/dist/src/converter.d.ts +2 -2
  18. package/dist/src/converterFlags.d.ts +2 -2
  19. package/dist/src/converterRule.d.ts +1 -1
  20. package/dist/src/extLink.d.ts +1 -1
  21. package/dist/src/gallery.d.ts +6 -6
  22. package/dist/src/gallery.js +6 -8
  23. package/dist/src/heading.d.ts +2 -2
  24. package/dist/src/html.d.ts +2 -2
  25. package/dist/src/html.js +2 -3
  26. package/dist/src/imageParameter.d.ts +1 -1
  27. package/dist/src/imageParameter.js +1 -2
  28. package/dist/src/imagemap.d.ts +2 -2
  29. package/dist/src/imagemap.js +1 -1
  30. package/dist/src/imagemapLink.d.ts +2 -2
  31. package/dist/src/index.d.ts +1 -1
  32. package/dist/src/index.js +1 -2
  33. package/dist/src/link/base.d.ts +1 -1
  34. package/dist/src/link/file.d.ts +6 -6
  35. package/dist/src/link/index.d.ts +1 -1
  36. package/dist/src/magicLink.d.ts +1 -1
  37. package/dist/src/nested.d.ts +3 -3
  38. package/dist/src/nowiki/base.d.ts +1 -1
  39. package/dist/src/nowiki/index.d.ts +1 -1
  40. package/dist/src/paramTag/index.d.ts +2 -2
  41. package/dist/src/parameter.d.ts +2 -2
  42. package/dist/src/pre.d.ts +2 -2
  43. package/dist/src/table/base.d.ts +1 -1
  44. package/dist/src/table/index.d.ts +1 -1
  45. package/dist/src/table/td.d.ts +4 -3
  46. package/dist/src/table/tr.d.ts +1 -1
  47. package/dist/src/table/trBase.d.ts +5 -5
  48. package/dist/src/table/trBase.js +7 -3
  49. package/dist/src/tagPair/ext.d.ts +1 -1
  50. package/dist/src/tagPair/include.d.ts +1 -1
  51. package/dist/src/tagPair/index.d.ts +2 -2
  52. package/dist/src/transclude.d.ts +6 -6
  53. package/dist/src/transclude.js +1 -1
  54. package/package.json +4 -4
package/dist/base.d.ts CHANGED
@@ -1,29 +1,30 @@
1
1
  export interface Config {
2
2
  ext: string[];
3
- html: [string[], string[], string[]];
4
- namespaces: Record<string, string>;
5
- nsid: Record<string, number>;
6
- parserFunction: [Record<string, string>, string[], string[], string[]];
7
- doubleUnderscore: [string[], string[]];
8
- protocol: string;
9
- img: Record<string, string>;
10
- variants: string[];
11
- excludes?: string[];
3
+ readonly html: [string[], string[], string[]];
4
+ readonly namespaces: Record<string, string>;
5
+ readonly nsid: Record<string, number>;
6
+ readonly parserFunction: [Record<string, string>, string[], string[], string[]];
7
+ readonly doubleUnderscore: [string[], string[]];
8
+ readonly protocol: string;
9
+ readonly img: Record<string, string>;
10
+ readonly variants: string[];
11
+ readonly excludes?: string[];
12
12
  }
13
+ export type Severity = 'error' | 'warning';
13
14
  export interface LintError {
14
- message: string;
15
- severity: 'error' | 'warning';
16
- startIndex: number;
17
- endIndex: number;
18
- startLine: number;
19
- startCol: number;
20
- endLine: number;
21
- endCol: number;
15
+ readonly message: string;
16
+ readonly severity: Severity;
17
+ readonly startIndex: number;
18
+ readonly endIndex: number;
19
+ readonly startLine: number;
20
+ readonly startCol: number;
21
+ readonly endLine: number;
22
+ readonly endCol: number;
22
23
  }
23
24
  /** 类似Node */
24
25
  export interface AstNode {
25
26
  type: string;
26
- childNodes: AstNode[];
27
+ readonly childNodes: AstNode[];
27
28
  /** Linter */
28
29
  lint(): LintError[];
29
30
  }
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ const Parser = {
36
36
  this.i18n = rootRequire(this.i18n, 'i18n/');
37
37
  return this.msg(msg, arg);
38
38
  }
39
- return (this.i18n?.[msg] ?? msg).replace('$1', arg);
39
+ return msg && (this.i18n?.[msg] ?? msg).replace('$1', this.msg(arg));
40
40
  },
41
41
  /** @implements */
42
42
  normalizeTitle(title, defaultNs = 0, include = false, config = Parser.getConfig(), halfParsed = false, decode = false, selfLink = false) {
@@ -18,12 +18,12 @@ export type * from './src/heading';
18
18
  export type * from './src/html';
19
19
  export type { TdToken } from './src/table/td';
20
20
  export type * from './src/table/tr';
21
- export type * from './src/table/index';
21
+ export type { TableToken } from './src/table/index';
22
22
  export type * from './src/nowiki/hr';
23
23
  export type * from './src/nowiki/doubleUnderscore';
24
24
  export type * from './src/link/index';
25
25
  export type * from './src/link/category';
26
- export type * from './src/imageParameter';
26
+ export type { ImageParameterToken } from './src/imageParameter';
27
27
  export type * from './src/link/file';
28
28
  export type * from './src/link/galleryImage';
29
29
  export type * from './src/nowiki/quote';
@@ -3,8 +3,8 @@ import type { LintError } from '../base';
3
3
  import type { AstNodes, Token } from '../internal';
4
4
  /** 类似HTMLElement */
5
5
  export declare abstract class AstElement extends AstNode {
6
- name?: string;
7
- data: undefined;
6
+ readonly name?: string;
7
+ readonly data: undefined;
8
8
  /** 子节点总数 */
9
9
  get length(): number;
10
10
  /**
@@ -29,7 +29,7 @@ export declare abstract class AstElement extends AstNode {
29
29
  * 最近的祖先节点
30
30
  * @param selector 选择器
31
31
  */
32
- closest(selector: string): Token | undefined;
32
+ closest<T extends Token>(selector: string): T | undefined;
33
33
  /**
34
34
  * 在末尾批量插入子节点
35
35
  * @param elements 插入节点
@@ -77,7 +77,7 @@ class AstElement extends node_1.AstNode {
77
77
  let { parentNode } = this, condition;
78
78
  const types = new Set(selector.split(',').map(str => str.trim()));
79
79
  // eslint-disable-next-line prefer-const
80
- condition = /** @implements */ ({ type }) => types.has(type);
80
+ condition = /** @implements */ (token) => types.has(token.type);
81
81
  while (parentNode) {
82
82
  if (condition(parentNode)) {
83
83
  return parentNode;
@@ -1,18 +1,18 @@
1
1
  import type { LintError, AstNode as AstNodeBase } from '../base';
2
2
  import type { AstText, Token } from '../internal';
3
+ import type { TokenTypes } from '../util/constants';
3
4
  export type AstNodes = AstText | Token;
4
- export type TokenTypes = 'root' | 'plain' | 'onlyinclude' | 'noinclude' | 'include' | 'comment' | 'ext' | 'ext-attrs' | 'ext-attr-dirty' | 'ext-attr' | 'attr-key' | 'attr-value' | 'ext-inner' | 'arg' | 'arg-name' | 'arg-default' | 'hidden' | 'magic-word' | 'magic-word-name' | 'invoke-function' | 'invoke-module' | 'template' | 'template-name' | 'parameter' | 'parameter-key' | 'parameter-value' | 'heading' | 'heading-title' | 'heading-trail' | 'html' | 'html-attrs' | 'html-attr-dirty' | 'html-attr' | 'table' | 'tr' | 'td' | 'table-syntax' | 'table-attrs' | 'table-attr-dirty' | 'table-attr' | 'table-inter' | 'td-inner' | 'hr' | 'double-underscore' | 'link' | 'link-target' | 'link-text' | 'category' | 'file' | 'gallery-image' | 'imagemap-image' | 'image-parameter' | 'quote' | 'ext-link' | 'ext-link-text' | 'ext-link-url' | 'free-ext-link' | 'list' | 'dd' | 'converter' | 'converter-flags' | 'converter-flag' | 'converter-rule' | 'converter-rule-variant' | 'converter-rule-to' | 'converter-rule-from' | 'param-line' | 'imagemap-link';
5
5
  export interface Dimension {
6
- height: number;
7
- width: number;
6
+ readonly height: number;
7
+ readonly width: number;
8
8
  }
9
9
  export interface Position {
10
- top: number;
11
- left: number;
10
+ readonly top: number;
11
+ readonly left: number;
12
12
  }
13
13
  export interface CaretPosition {
14
- offsetNode: AstNodes;
15
- offset: number;
14
+ readonly offsetNode: AstNodes;
15
+ readonly offset: number;
16
16
  }
17
17
  /** 类似Node */
18
18
  export declare abstract class AstNode implements AstNodeBase {
package/dist/lib/node.js CHANGED
@@ -41,7 +41,6 @@ class AstNode {
41
41
  return 0;
42
42
  }
43
43
  return key in this
44
- // @ts-expect-error noImplicitAny
45
44
  ? String(this[key])
46
45
  : undefined;
47
46
  }
@@ -51,8 +50,7 @@ class AstNode {
51
50
  this.#parentNode = value;
52
51
  }
53
52
  else {
54
- // @ts-expect-error noImplicitAny
55
- this[key] = value;
53
+ this[key] = value; // eslint-disable-line @typescript-eslint/no-explicit-any
56
54
  }
57
55
  }
58
56
  /** 获取根节点 */
@@ -4,8 +4,8 @@ import type { LintError } from '../base';
4
4
  export declare class AstText extends AstNode {
5
5
  #private;
6
6
  readonly type = "text";
7
- name: undefined;
8
- data: string;
7
+ readonly name: undefined;
8
+ readonly data: string;
9
9
  /** @param text 包含文本 */
10
10
  constructor(text: string);
11
11
  /** 可见部分 */
@@ -1,7 +1,7 @@
1
1
  import * as Parser from '../index';
2
2
  /** MediaWiki页面标题对象 */
3
3
  export declare class Title {
4
- valid: boolean;
4
+ readonly valid: boolean;
5
5
  ns: number;
6
6
  fragment: string | undefined;
7
7
  /**
@@ -13,7 +13,7 @@ const category_1 = require("../src/link/category");
13
13
  */
14
14
  const parseLinks = (wikitext, config = Parser.getConfig(), accum = []) => {
15
15
  const { parseQuotes } = require('./quotes');
16
- const regex = /^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su, regexImg = /^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su, regexExt = new RegExp(`^\\s*(?:${config.protocol})`, 'iu'), bits = wikitext.split('[[');
16
+ const regex = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su, regexImg = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su, regexExt = new RegExp(`^\\s*(?:${config.protocol})`, 'iu'), bits = wikitext.split('[[');
17
17
  let s = bits.shift();
18
18
  for (let i = 0; i < bits.length; i++) {
19
19
  let mightBeImg = false, link, delimiter, text, after;
@@ -7,6 +7,8 @@ const index_2 = require("../src/table/index");
7
7
  const tr_1 = require("../src/table/tr");
8
8
  const td_1 = require("../src/table/td");
9
9
  const dd_1 = require("../src/nowiki/dd");
10
+ /** @ignore */
11
+ const isTr = (token) => token.lastChild.constructor !== index_1.Token;
10
12
  /**
11
13
  * 解析表格,注意`tr`和`td`包含开头的换行
12
14
  * @param {Token & {firstChild: AstText}} root 根节点
@@ -29,15 +31,15 @@ const parseTable = ({ firstChild: { data }, type, name }, config = Parser.getCon
29
31
  return;
30
32
  }
31
33
  const { lastChild } = top;
32
- if (lastChild.constructor === index_1.Token) {
33
- lastChild.setText(String(lastChild) + str);
34
- }
35
- else {
34
+ if (isTr(top)) {
36
35
  const token = new index_1.Token(str, config, accum);
37
36
  token.type = 'table-inter';
38
37
  token.setAttribute('stage', 3);
39
38
  top.insertAt(token);
40
39
  }
40
+ else {
41
+ lastChild.setText(String(lastChild) + str);
42
+ }
41
43
  };
42
44
  for (const outLine of lines) {
43
45
  let top = stack.pop();
package/dist/src/arg.d.ts CHANGED
@@ -9,13 +9,13 @@ import type { LintError } from '../base';
9
9
  */
10
10
  export declare class ArgToken extends Token {
11
11
  readonly type = "arg";
12
- childNodes: [AtomToken] | [AtomToken, Token, ...HiddenToken[]];
12
+ readonly childNodes: [AtomToken] | [AtomToken, Token, ...HiddenToken[]];
13
13
  abstract get firstChild(): AtomToken;
14
14
  abstract get lastChild(): Token;
15
15
  /** 预设值 */
16
16
  get default(): string | false;
17
17
  /** @param parts 以'|'分隔的各部分 */
18
- constructor(parts: string[], config?: Parser.Config, accum?: Token[]);
18
+ constructor(parts: readonly string[], config?: Parser.Config, accum?: Token[]);
19
19
  /** @override */
20
20
  text(): string;
21
21
  /** @override */
@@ -11,9 +11,9 @@ export type AttributeTypes = 'ext-attr' | 'html-attr' | 'table-attr';
11
11
  export declare class AttributeToken extends Token {
12
12
  #private;
13
13
  type: AttributeTypes;
14
- name: string;
15
- tag: string;
16
- childNodes: [AtomToken, Token];
14
+ readonly name: string;
15
+ readonly tag: string;
16
+ readonly childNodes: [AtomToken, Token];
17
17
  abstract get firstChild(): AtomToken;
18
18
  abstract get lastChild(): Token;
19
19
  abstract get parentNode(): AttributesToken | undefined;
@@ -29,7 +29,7 @@ export declare class AttributeToken extends Token {
29
29
  * @param value 属性值
30
30
  * @param quotes 引号
31
31
  */
32
- constructor(type: AttributeTypes, tag: string, key: string, equal?: string, value?: string, quotes?: [string?, string?], config?: Parser.Config, accum?: Token[]);
32
+ constructor(type: AttributeTypes, tag: string, key: string, equal?: string, value?: string, quotes?: readonly [string?, string?], config?: Parser.Config, accum?: Token[]);
33
33
  /** @override */
34
34
  text(): string;
35
35
  /** @override */
@@ -165,7 +165,7 @@ class AttributeToken extends index_1.Token {
165
165
  this.type = type;
166
166
  this.append(keyToken, valueToken);
167
167
  this.#equal = equal;
168
- this.#quotes = quotes;
168
+ this.#quotes = [...quotes];
169
169
  this.tag = tag;
170
170
  this.setAttribute('name', (0, string_1.removeComment)(key).trim().toLowerCase());
171
171
  }
@@ -4,15 +4,16 @@ import { AtomToken } from './atom';
4
4
  import { AttributeToken } from './attribute';
5
5
  import type { LintError } from '../base';
6
6
  import type { ExtToken, HtmlToken, TdToken, TrToken, TableToken } from '../internal';
7
- declare type AttributesTypes = 'ext-attrs' | 'html-attrs' | 'table-attrs';
7
+ import type { AttributeTypes } from './attribute';
8
+ declare type AttributesTypes = `${AttributeTypes}s`;
8
9
  /**
9
10
  * 扩展和HTML标签属性
10
11
  * @classdesc `{childNodes: ...AtomToken|AttributeToken}`
11
12
  */
12
13
  export declare class AttributesToken extends Token {
13
14
  type: AttributesTypes;
14
- name: string;
15
- childNodes: (AtomToken | AttributeToken)[];
15
+ readonly name: string;
16
+ readonly childNodes: (AtomToken | AttributeToken)[];
16
17
  abstract get firstChild(): AtomToken | AttributeToken | undefined;
17
18
  abstract get lastChild(): AtomToken | AttributeToken | undefined;
18
19
  abstract get parentNode(): ExtToken | HtmlToken | TableToken | TrToken | TdToken | undefined;
@@ -26,7 +27,7 @@ export declare class AttributesToken extends Token {
26
27
  * 所有指定属性名的AttributeToken
27
28
  * @param key 属性名
28
29
  */
29
- getAttrTokens(key?: string): AttributeToken[];
30
+ getAttrTokens(key?: string): readonly AttributeToken[];
30
31
  /**
31
32
  * 指定属性名的最后一个AttributeToken
32
33
  * @param key 属性名
@@ -7,6 +7,10 @@ const Parser = require("../index");
7
7
  const index_1 = require("./index");
8
8
  const atom_1 = require("./atom");
9
9
  const attribute_1 = require("./attribute");
10
+ /** @ignore */
11
+ const toAttributeType = (type) => type.slice(0, -1);
12
+ /** @ignore */
13
+ const toDirty = (type) => `${toAttributeType(type)}-dirty`;
10
14
  /**
11
15
  * 扩展和HTML标签属性
12
16
  * @classdesc `{childNodes: ...AtomToken|AttributeToken}`
@@ -32,7 +36,7 @@ class AttributesToken extends index_1.Token {
32
36
  let out = '', mt = regex.exec(attr), lastIndex = 0;
33
37
  const insertDirty = /** 插入无效属性 */ () => {
34
38
  if (out) {
35
- super.insertAt(new atom_1.AtomToken(out, `${type.slice(0, -1)}-dirty`, config, accum));
39
+ super.insertAt(new atom_1.AtomToken(out, toDirty(type), config, accum, {}));
36
40
  out = '';
37
41
  }
38
42
  };
@@ -40,7 +44,7 @@ class AttributesToken extends index_1.Token {
40
44
  const { index, 0: full, 1: key, 2: equal, 3: quoteStart, 4: quoted, 5: quoteEnd, 6: unquoted } = mt;
41
45
  out += attr.slice(lastIndex, index);
42
46
  if (/^(?:[\w:]|\0\d+[t!~{}+-]\x7F)(?:[\w:.-]|\0\d+[t!~{}+-]\x7F)*$/u.test((0, string_1.removeComment)(key).trim())) {
43
- const value = quoted ?? unquoted, quotes = [quoteStart, quoteEnd], token = new attribute_1.AttributeToken(type.slice(0, -1), name, key, equal, value, quotes, config, accum);
47
+ const value = quoted ?? unquoted, quotes = [quoteStart, quoteEnd], token = new attribute_1.AttributeToken(toAttributeType(type), name, key, equal, value, quotes, config, accum);
44
48
  insertDirty();
45
49
  super.insertAt(token);
46
50
  }
@@ -66,7 +70,7 @@ class AttributesToken extends index_1.Token {
66
70
  * @param key 属性名
67
71
  */
68
72
  getAttrTokens(key) {
69
- return this.childNodes.filter(child => child instanceof attribute_1.AttributeToken && (!key || child.name === key.toLowerCase().trim()));
73
+ return this.childNodes.filter((child) => child instanceof attribute_1.AttributeToken && (!key || child.name === key.toLowerCase().trim()));
70
74
  }
71
75
  /**
72
76
  * 指定属性名的最后一个AttributeToken
@@ -13,13 +13,13 @@ declare const ConverterToken_base: (abstract new (...args: any[]) => {
13
13
  */
14
14
  export declare class ConverterToken extends ConverterToken_base {
15
15
  readonly type = "converter";
16
- childNodes: [ConverterFlagsToken, ...ConverterRuleToken[]];
16
+ readonly childNodes: [ConverterFlagsToken, ...ConverterRuleToken[]];
17
17
  abstract get lastChild(): ConverterFlagsToken | ConverterRuleToken;
18
18
  /**
19
19
  * @param flags 转换类型标记
20
20
  * @param rules 转换规则
21
21
  */
22
- constructor(flags: string[], rules: [string, ...string[]], config?: Parser.Config, accum?: Token[]);
22
+ constructor(flags: readonly string[], rules: readonly [string, ...string[]], config?: Parser.Config, accum?: Token[]);
23
23
  /** @override */
24
24
  text(): string;
25
25
  }
@@ -10,14 +10,14 @@ import type { ConverterToken, ConverterRuleToken } from '../internal';
10
10
  export declare class ConverterFlagsToken extends Token {
11
11
  #private;
12
12
  readonly type = "converter-flags";
13
- childNodes: AtomToken[];
13
+ readonly childNodes: AtomToken[];
14
14
  abstract get firstChild(): AtomToken | undefined;
15
15
  abstract get lastChild(): AtomToken | undefined;
16
16
  abstract get parentNode(): ConverterToken | undefined;
17
17
  abstract get previousSibling(): undefined;
18
18
  abstract get nextSibling(): ConverterRuleToken | undefined;
19
19
  /** @param flags 转换类型标记 */
20
- constructor(flags: string[], config?: Parser.Config, accum?: Token[]);
20
+ constructor(flags: readonly string[], config?: Parser.Config, accum?: Token[]);
21
21
  /** @override */
22
22
  text(): string;
23
23
  /** 获取未知的转换类型标记 */
@@ -8,7 +8,7 @@ import type { ConverterToken, ConverterFlagsToken } from '../internal';
8
8
  */
9
9
  export declare class ConverterRuleToken extends Token {
10
10
  readonly type = "converter-rule";
11
- childNodes: [AtomToken] | [AtomToken, AtomToken] | [AtomToken, AtomToken, AtomToken];
11
+ readonly childNodes: [AtomToken] | [AtomToken, AtomToken] | [AtomToken, AtomToken, AtomToken];
12
12
  abstract get firstChild(): AtomToken;
13
13
  abstract get lastChild(): AtomToken;
14
14
  abstract get parentNode(): ConverterToken | undefined;
@@ -13,7 +13,7 @@ declare const ExtLinkToken_base: (abstract new (...args: any[]) => {
13
13
  export declare class ExtLinkToken extends ExtLinkToken_base {
14
14
  #private;
15
15
  readonly type = "ext-link";
16
- childNodes: [MagicLinkToken] | [MagicLinkToken, Token];
16
+ readonly childNodes: [MagicLinkToken] | [MagicLinkToken, Token];
17
17
  abstract get lastChild(): Token;
18
18
  /**
19
19
  * @param url 网址
@@ -1,20 +1,20 @@
1
1
  import * as Parser from '../index';
2
2
  import { Token } from './index';
3
3
  import { GalleryImageToken } from './link/galleryImage';
4
- import { HiddenToken } from './hidden';
4
+ import { NoincludeToken } from './nowiki/noinclude';
5
5
  import type { LintError } from '../base';
6
6
  import type { AstText, AttributesToken, ExtToken } from '../internal';
7
7
  /**
8
8
  * gallery标签
9
- * @classdesc `{childNodes: ...(GalleryImageToken|HiddenToken|AstText)}`
9
+ * @classdesc `{childNodes: ...(GalleryImageToken|NoincludeToken|AstText)}`
10
10
  */
11
11
  export declare class GalleryToken extends Token {
12
12
  #private;
13
13
  readonly type = "ext-inner";
14
- name: 'gallery';
15
- childNodes: (GalleryImageToken | HiddenToken | AstText)[];
16
- abstract get firstChild(): GalleryImageToken | HiddenToken | AstText | undefined;
17
- abstract get lastChild(): GalleryImageToken | HiddenToken | AstText | undefined;
14
+ readonly name: 'gallery';
15
+ readonly childNodes: (GalleryImageToken | NoincludeToken | AstText)[];
16
+ abstract get firstChild(): GalleryImageToken | NoincludeToken | AstText | undefined;
17
+ abstract get lastChild(): GalleryImageToken | NoincludeToken | AstText | undefined;
18
18
  abstract get nextSibling(): undefined;
19
19
  abstract get previousSibling(): AttributesToken;
20
20
  abstract get parentNode(): ExtToken | undefined;
@@ -4,10 +4,10 @@ exports.GalleryToken = void 0;
4
4
  const Parser = require("../index");
5
5
  const index_1 = require("./index");
6
6
  const galleryImage_1 = require("./link/galleryImage");
7
- const hidden_1 = require("./hidden");
7
+ const noinclude_1 = require("./nowiki/noinclude");
8
8
  /**
9
9
  * gallery标签
10
- * @classdesc `{childNodes: ...(GalleryImageToken|HiddenToken|AstText)}`
10
+ * @classdesc `{childNodes: ...(GalleryImageToken|NoincludeToken|AstText)}`
11
11
  */
12
12
  class GalleryToken extends index_1.Token {
13
13
  type = 'ext-inner';
@@ -17,9 +17,7 @@ class GalleryToken extends index_1.Token {
17
17
  for (const line of inner?.split('\n') ?? []) {
18
18
  const matches = /^([^|]+)(?:\|(.*))?/u.exec(line);
19
19
  if (!matches) {
20
- super.insertAt((line.trim()
21
- ? new hidden_1.HiddenToken(line, config, [], {})
22
- : line));
20
+ super.insertAt((line.trim() ? new noinclude_1.NoincludeToken(line, config) : line));
23
21
  continue;
24
22
  }
25
23
  const [, file, alt] = matches;
@@ -27,7 +25,7 @@ class GalleryToken extends index_1.Token {
27
25
  super.insertAt(new galleryImage_1.GalleryImageToken('gallery', file, alt, config, accum));
28
26
  }
29
27
  else {
30
- super.insertAt(new hidden_1.HiddenToken(line, config, [], {}));
28
+ super.insertAt(new noinclude_1.NoincludeToken(line, config));
31
29
  }
32
30
  }
33
31
  }
@@ -55,7 +53,7 @@ class GalleryToken extends index_1.Token {
55
53
  const { top, left } = this.getRootNode().posFromIndex(start), errors = [];
56
54
  for (let i = 0; i < this.length; i++) {
57
55
  const child = this.childNodes[i], str = String(child), { length } = str, trimmed = str.trim(), startLine = top + i, startCol = i ? 0 : left;
58
- if (child.type === 'hidden' && trimmed && !/^<!--.*-->$/u.test(trimmed)) {
56
+ if (child.type === 'noinclude' && trimmed && !/^<!--.*-->$/u.test(trimmed)) {
59
57
  errors.push({
60
58
  message: Parser.msg('invalid content in <$1>', 'gallery'),
61
59
  severity: 'error',
@@ -67,7 +65,7 @@ class GalleryToken extends index_1.Token {
67
65
  endCol: startCol + length,
68
66
  });
69
67
  }
70
- else if (child.type !== 'hidden' && child.type !== 'text') {
68
+ else if (child.type !== 'noinclude' && child.type !== 'text') {
71
69
  errors.push(...child.lint(start));
72
70
  }
73
71
  start += length + 1;
@@ -9,7 +9,7 @@ import type { LintError } from '../base';
9
9
  export declare class HeadingToken extends Token {
10
10
  #private;
11
11
  readonly type = "heading";
12
- childNodes: [Token, SyntaxToken];
12
+ readonly childNodes: [Token, SyntaxToken];
13
13
  abstract get firstChild(): Token;
14
14
  abstract get lastChild(): SyntaxToken;
15
15
  /** 标题层级 */
@@ -18,7 +18,7 @@ export declare class HeadingToken extends Token {
18
18
  * @param level 标题层级
19
19
  * @param input 标题文字
20
20
  */
21
- constructor(level: number, input: [string?, string?], config?: Parser.Config, accum?: Token[]);
21
+ constructor(level: number, input: readonly [string?, string?], config?: Parser.Config, accum?: Token[]);
22
22
  /** @override */
23
23
  text(): string;
24
24
  /** @override */
@@ -9,8 +9,8 @@ import type { AttributesToken } from '../internal';
9
9
  export declare class HtmlToken extends Token {
10
10
  #private;
11
11
  readonly type = "html";
12
- name: string;
13
- childNodes: [AttributesToken];
12
+ readonly name: string;
13
+ readonly childNodes: [AttributesToken];
14
14
  abstract get firstChild(): AttributesToken;
15
15
  abstract get lastChild(): AttributesToken;
16
16
  /** 是否是闭合标签 */
package/dist/src/html.js CHANGED
@@ -105,9 +105,8 @@ class HtmlToken extends index_1.Token {
105
105
  else if (!parentNode) {
106
106
  return undefined;
107
107
  }
108
- const { childNodes } = parentNode, i = childNodes.indexOf(this), siblings = closing
109
- ? childNodes.slice(0, i).reverse().filter(({ type, name }) => type === 'html' && name === tagName)
110
- : childNodes.slice(i + 1).filter(({ type, name }) => type === 'html' && name === tagName);
108
+ const { childNodes } = parentNode, i = childNodes.indexOf(this), siblings = (closing ? childNodes.slice(0, i).reverse() : childNodes.slice(i + 1))
109
+ .filter((child) => child.type === 'html' && child.name === tagName);
111
110
  let imbalance = closing ? -1 : 1;
112
111
  for (const token of siblings) {
113
112
  if (token.#closing) {
@@ -8,7 +8,7 @@ export declare const galleryParams: Set<string>;
8
8
  export declare class ImageParameterToken extends Token {
9
9
  #private;
10
10
  readonly type = "image-parameter";
11
- name: string;
11
+ readonly name: string;
12
12
  abstract get parentNode(): FileToken | undefined;
13
13
  abstract get nextSibling(): this | undefined;
14
14
  abstract get previousSibling(): AtomToken | this;
@@ -34,8 +34,7 @@ function validate(key, val, config = Parser.getConfig(), halfParsed = false) {
34
34
  case 'manualthumb':
35
35
  return true;
36
36
  default:
37
- // @ts-expect-error isNaN
38
- return !isNaN(value);
37
+ return !Number.isNaN(Number(value));
39
38
  }
40
39
  }
41
40
  /** 图片参数 */
@@ -11,8 +11,8 @@ import type { AstText, AttributesToken, ExtToken } from '../internal';
11
11
  */
12
12
  export declare class ImagemapToken extends Token {
13
13
  readonly type = "ext-inner";
14
- name: 'imagemap';
15
- childNodes: (GalleryImageToken | NoincludeToken | ImagemapLinkToken | AstText)[];
14
+ readonly name: 'imagemap';
15
+ readonly childNodes: (GalleryImageToken | NoincludeToken | ImagemapLinkToken | AstText)[];
16
16
  abstract get firstChild(): NoincludeToken | GalleryImageToken | undefined;
17
17
  abstract get lastChild(): GalleryImageToken | NoincludeToken | ImagemapLinkToken | AstText | undefined;
18
18
  abstract get nextSibling(): undefined;
@@ -15,7 +15,7 @@ class ImagemapToken extends index_1.Token {
15
15
  type = 'ext-inner';
16
16
  /** 图片 */
17
17
  get image() {
18
- return this.childNodes.find(({ type }) => type === 'imagemap-image');
18
+ return this.childNodes.find((child) => child.type === 'imagemap-image');
19
19
  }
20
20
  /** @param inner 标签内部wikitext */
21
21
  constructor(inner, config = Parser.getConfig(), accum = []) {
@@ -10,7 +10,7 @@ import type { AstText, ImagemapToken } from '../internal';
10
10
  */
11
11
  export declare class ImagemapLinkToken extends Token {
12
12
  readonly type = "imagemap-link";
13
- childNodes: [AstText, LinkToken | ExtLinkToken, NoincludeToken];
13
+ readonly childNodes: [AstText, LinkToken | ExtLinkToken, NoincludeToken];
14
14
  abstract get firstChild(): AstText;
15
15
  abstract get lastChild(): NoincludeToken;
16
16
  abstract get parentNode(): ImagemapToken | undefined;
@@ -19,5 +19,5 @@ export declare class ImagemapLinkToken extends Token {
19
19
  * @param linkStuff 内外链接
20
20
  * @param post 链接后的文本
21
21
  */
22
- constructor(pre: string, linkStuff: [string, string | undefined, string | undefined] | [string, string | undefined], post: string, config?: Parser.Config, accum?: Token[]);
22
+ constructor(pre: string, linkStuff: readonly [string, string | undefined, string | undefined] | readonly [string, string | undefined], post: string, config?: Parser.Config, accum?: Token[]);
23
23
  }
@@ -3,7 +3,7 @@ import { AstElement } from '../lib/element';
3
3
  import { AstText } from '../lib/text';
4
4
  import type { Title } from '../lib/title';
5
5
  import type { AstNodes } from '../internal';
6
- import type { TokenTypes } from '../lib/node';
6
+ import type { TokenTypes } from '../util/constants';
7
7
  /**
8
8
  * 所有节点的基类
9
9
  * @classdesc `{childNodes: ...(AstText|Token)}`
package/dist/src/index.js CHANGED
@@ -123,9 +123,8 @@ class Token extends element_1.AstElement {
123
123
  const nodes = str.split(/[\0\x7F]/u).map((s, i) => {
124
124
  if (i % 2 === 0) {
125
125
  return new text_1.AstText(s);
126
- // @ts-expect-error isNaN
127
126
  }
128
- else if (isNaN(s.at(-1))) {
127
+ else if (Number.isNaN(Number(s.at(-1)))) {
129
128
  return this.#accum[Number(s.slice(0, -1))];
130
129
  }
131
130
  throw new Error(`解析错误!未正确标记的 Token:${s}`);
@@ -10,7 +10,7 @@ import type { Title } from '../../lib/title';
10
10
  export declare abstract class LinkBaseToken extends Token {
11
11
  #private;
12
12
  type: 'link' | 'category' | 'file' | 'gallery-image' | 'imagemap-image';
13
- childNodes: [AtomToken, ...Token[]];
13
+ readonly childNodes: [AtomToken, ...Token[]];
14
14
  abstract get firstChild(): AtomToken;
15
15
  abstract get lastChild(): Token;
16
16
  /**
@@ -10,7 +10,7 @@ import type { Token, AtomToken } from '../../internal';
10
10
  export declare class FileToken extends LinkBaseToken {
11
11
  #private;
12
12
  readonly type: 'file' | 'gallery-image' | 'imagemap-image';
13
- childNodes: [AtomToken, ...ImageParameterToken[]];
13
+ readonly childNodes: [AtomToken, ...ImageParameterToken[]];
14
14
  abstract get lastChild(): AtomToken | ImageParameterToken;
15
15
  /**
16
16
  * @param link 文件名
@@ -21,16 +21,16 @@ export declare class FileToken extends LinkBaseToken {
21
21
  /** @override */
22
22
  lint(start?: number): LintError[];
23
23
  /** 获取所有图片参数节点 */
24
- getAllArgs(): ImageParameterToken[];
24
+ getAllArgs(): readonly ImageParameterToken[];
25
25
  /**
26
26
  * 获取指定图片参数
27
27
  * @param key 参数名
28
28
  */
29
- getArgs(key: string): ImageParameterToken[];
29
+ getArgs(key: string): readonly ImageParameterToken[];
30
30
  /** 获取图片框架属性参数节点 */
31
- getFrameArgs(): ImageParameterToken[];
31
+ getFrameArgs(): readonly ImageParameterToken[];
32
32
  /** 获取图片水平对齐参数节点 */
33
- getHorizAlignArgs(): ImageParameterToken[];
33
+ getHorizAlignArgs(): readonly ImageParameterToken[];
34
34
  /** 获取图片垂直对齐参数节点 */
35
- getVertAlignArgs(): ImageParameterToken[];
35
+ getVertAlignArgs(): readonly ImageParameterToken[];
36
36
  }
@@ -6,5 +6,5 @@ import type { Token, AtomToken } from '../../internal';
6
6
  */
7
7
  export declare class LinkToken extends LinkBaseToken {
8
8
  readonly type = "link";
9
- childNodes: [AtomToken] | [AtomToken, Token];
9
+ readonly childNodes: [AtomToken] | [AtomToken, Token];
10
10
  }
@@ -8,7 +8,7 @@ import type { AstText, CommentToken, IncludeToken, NoincludeToken, TranscludeTok
8
8
  */
9
9
  export declare class MagicLinkToken extends Token {
10
10
  type: 'free-ext-link' | 'ext-link-url';
11
- childNodes: (AstText | CommentToken | IncludeToken | NoincludeToken | TranscludeToken)[];
11
+ readonly childNodes: (AstText | CommentToken | IncludeToken | NoincludeToken | TranscludeToken)[];
12
12
  abstract get firstChild(): AstText | TranscludeToken;
13
13
  abstract get lastChild(): AstText | CommentToken | IncludeToken | NoincludeToken | TranscludeToken;
14
14
  /**
@@ -11,8 +11,8 @@ import type { AttributesToken } from './attributes';
11
11
  */
12
12
  export declare class NestedToken extends Token {
13
13
  readonly type = "ext-inner";
14
- name: string;
15
- childNodes: (ExtToken | NoincludeToken | CommentToken)[];
14
+ readonly name: string;
15
+ readonly childNodes: (ExtToken | NoincludeToken | CommentToken)[];
16
16
  abstract get firstChild(): ExtToken | NoincludeToken | CommentToken | undefined;
17
17
  abstract get lastChild(): ExtToken | NoincludeToken | CommentToken | undefined;
18
18
  abstract get nextSibling(): undefined;
@@ -22,7 +22,7 @@ export declare class NestedToken extends Token {
22
22
  * @param regex 内层正则
23
23
  * @param tags 内层标签名
24
24
  */
25
- constructor(wikitext: string | undefined, regex: RegExp, tags: string[], config?: Parser.Config, accum?: Token[]);
25
+ constructor(wikitext: string | undefined, regex: RegExp, tags: readonly string[], config?: Parser.Config, accum?: Token[]);
26
26
  /** @override */
27
27
  lint(start?: number): LintError[];
28
28
  }
@@ -8,7 +8,7 @@ declare type NowikiTypes = 'ext-inner' | 'comment' | 'dd' | 'double-underscore'
8
8
  */
9
9
  export declare abstract class NowikiBaseToken extends Token {
10
10
  type: NowikiTypes;
11
- childNodes: [AstText];
11
+ readonly childNodes: [AstText];
12
12
  abstract get firstChild(): AstText;
13
13
  abstract get lastChild(): AstText;
14
14
  /** 纯文本部分 */
@@ -4,7 +4,7 @@ import type { AttributesToken, ExtToken } from '../../internal';
4
4
  /** 扩展标签内的纯文字Token */
5
5
  export declare class NowikiToken extends NowikiBaseToken {
6
6
  readonly type = "ext-inner";
7
- name: string;
7
+ readonly name: string;
8
8
  abstract get nextSibling(): undefined;
9
9
  abstract get previousSibling(): AttributesToken;
10
10
  abstract get parentNode(): ExtToken | undefined;
@@ -9,8 +9,8 @@ import type { AttributesToken, ExtToken } from '../../internal';
9
9
  */
10
10
  export declare class ParamTagToken extends Token {
11
11
  readonly type = "ext-inner";
12
- name: string;
13
- childNodes: AtomToken[];
12
+ readonly name: string;
13
+ readonly childNodes: AtomToken[];
14
14
  abstract get firstChild(): AtomToken | undefined;
15
15
  abstract get lastChild(): AtomToken | undefined;
16
16
  abstract get nextSibling(): undefined;
@@ -8,8 +8,8 @@ import type { AtomToken, SyntaxToken, TranscludeToken } from '../internal';
8
8
  */
9
9
  export declare class ParameterToken extends Token {
10
10
  readonly type = "parameter";
11
- name: string;
12
- childNodes: [Token, Token];
11
+ readonly name: string;
12
+ readonly childNodes: [Token, Token];
13
13
  abstract get firstChild(): Token;
14
14
  abstract get lastChild(): Token;
15
15
  abstract get parentNode(): TranscludeToken | undefined;
package/dist/src/pre.d.ts CHANGED
@@ -8,8 +8,8 @@ import type { AstText, AttributesToken, ExtToken, ConverterToken } from '../inte
8
8
  */
9
9
  export declare class PreToken extends Token {
10
10
  readonly type = "ext-inner";
11
- name: 'pre';
12
- childNodes: (AstText | NoincludeToken | ConverterToken)[];
11
+ readonly name: 'pre';
12
+ readonly childNodes: (AstText | NoincludeToken | ConverterToken)[];
13
13
  abstract get firstChild(): AstText | NoincludeToken | ConverterToken | undefined;
14
14
  abstract get lastChild(): AstText | NoincludeToken | ConverterToken | undefined;
15
15
  abstract get nextSibling(): undefined;
@@ -8,7 +8,7 @@ import { AttributesToken } from '../attributes';
8
8
  */
9
9
  export declare abstract class TableBaseToken extends Token {
10
10
  type: 'table' | 'tr' | 'td';
11
- childNodes: [SyntaxToken, AttributesToken, ...Token[]];
11
+ readonly childNodes: [SyntaxToken, AttributesToken, ...Token[]];
12
12
  abstract get firstChild(): SyntaxToken;
13
13
  abstract get lastChild(): Token;
14
14
  /**
@@ -9,7 +9,7 @@ import type { AttributesToken, TdToken, TrToken, Token } from '../../internal';
9
9
  */
10
10
  export declare class TableToken extends TrBaseToken {
11
11
  readonly type = "table";
12
- childNodes: [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
12
+ readonly childNodes: [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
13
13
  abstract get lastChild(): AttributesToken | TdToken | TrToken | SyntaxToken;
14
14
  /** 表格是否闭合 */
15
15
  get closed(): boolean;
@@ -4,10 +4,11 @@ import { TableBaseToken } from './base';
4
4
  import type { LintError } from '../../base';
5
5
  import type { SyntaxToken, AttributesToken, TrToken, TableToken } from '../../internal';
6
6
  export type TdSubtypes = 'td' | 'th' | 'caption';
7
- export type TdAttrs = Record<string, string | true> & {
7
+ export interface TdSpanAttrs {
8
8
  rowspan?: number;
9
9
  colspan?: number;
10
- };
10
+ }
11
+ export type TdAttrs = Record<string, string | true> & TdSpanAttrs;
11
12
  /**
12
13
  * `<td>`、`<th>`和`<caption>`
13
14
  * @classdesc `{childNodes: [SyntaxToken, AttributesToken, Token]}`
@@ -15,7 +16,7 @@ export type TdAttrs = Record<string, string | true> & {
15
16
  export declare class TdToken extends TableBaseToken {
16
17
  #private;
17
18
  readonly type = "td";
18
- childNodes: [SyntaxToken, AttributesToken, Token];
19
+ readonly childNodes: [SyntaxToken, AttributesToken, Token];
19
20
  abstract get parentNode(): TrToken | TableToken | undefined;
20
21
  abstract get nextSibling(): this | TrToken | SyntaxToken | undefined;
21
22
  abstract get previousSibling(): Token | undefined;
@@ -7,7 +7,7 @@ import type { Token, TdToken, TableToken, SyntaxToken, AttributesToken } from '.
7
7
  */
8
8
  export declare class TrToken extends TrBaseToken {
9
9
  readonly type = "tr";
10
- childNodes: [SyntaxToken, AttributesToken, ...TdToken[]];
10
+ readonly childNodes: [SyntaxToken, AttributesToken, ...TdToken[]];
11
11
  abstract get lastChild(): AttributesToken | TdToken;
12
12
  abstract get parentNode(): TableToken | undefined;
13
13
  abstract get nextSibling(): this | SyntaxToken | undefined;
@@ -1,11 +1,11 @@
1
1
  import { TableBaseToken } from './base';
2
2
  import type { LintError } from '../../base';
3
3
  export interface TableCoords {
4
- row: number;
5
- column: number;
6
- x?: undefined;
7
- y?: undefined;
8
- start?: boolean;
4
+ readonly row: number;
5
+ readonly column: number;
6
+ readonly x?: undefined;
7
+ readonly y?: undefined;
8
+ readonly start?: boolean;
9
9
  }
10
10
  /** 表格行或表格 */
11
11
  export declare abstract class TrBaseToken extends TableBaseToken {
@@ -11,12 +11,16 @@ class TrBaseToken extends base_1.TableBaseToken {
11
11
  if (!inter) {
12
12
  return errors;
13
13
  }
14
- const first = inter.childNodes.find(child => child.text().trim()), tdPattern = /^\s*(?:!|\{\{\s*![!-]?\s*\}\})/u;
14
+ const first = inter.childNodes.find(child => child.text().trim()), tdPattern = /^\s*(?:!|\{\{\s*![!-]?\s*\}\})/u,
15
+ /** @ignore */
16
+ isArg = (token) => token.type === 'arg',
17
+ /** @ignore */
18
+ isTransclude = (token) => token.type === 'magic-word';
15
19
  if (!first || tdPattern.test(String(first))
16
- || first.type === 'arg' && tdPattern.test(first.default || '')) {
20
+ || isArg(first) && tdPattern.test(first.default || '')) {
17
21
  return errors;
18
22
  }
19
- else if (first.type === 'magic-word') {
23
+ else if (isTransclude(first)) {
20
24
  try {
21
25
  if (first.getPossibleValues().every(token => tdPattern.test(token.text()))) {
22
26
  return errors;
@@ -9,7 +9,7 @@ import type { LintError } from '../../base';
9
9
  */
10
10
  export declare class ExtToken extends TagPairToken {
11
11
  readonly type = "ext";
12
- childNodes: [AttributesToken, Token];
12
+ readonly childNodes: [AttributesToken, Token];
13
13
  abstract get firstChild(): AttributesToken;
14
14
  abstract get lastChild(): Token;
15
15
  /**
@@ -13,7 +13,7 @@ declare const IncludeToken_base: ((abstract new (...args: any[]) => {
13
13
  */
14
14
  export declare class IncludeToken extends IncludeToken_base {
15
15
  readonly type = "include";
16
- childNodes: [AstText, AstText];
16
+ readonly childNodes: [AstText, AstText];
17
17
  abstract get firstChild(): AstText;
18
18
  abstract get lastChild(): AstText;
19
19
  /**
@@ -5,8 +5,8 @@ import type { AstNodes } from '../../lib/node';
5
5
  export declare abstract class TagPairToken extends Token {
6
6
  #private;
7
7
  type: 'ext' | 'include';
8
- name: string;
9
- childNodes: [AstNodes, AstNodes];
8
+ readonly name: string;
9
+ readonly childNodes: [AstNodes, AstNodes];
10
10
  abstract get firstChild(): AstNodes;
11
11
  abstract get lastChild(): AstNodes;
12
12
  /** 是否闭合 */
@@ -11,8 +11,8 @@ import type { LintError } from '../base';
11
11
  export declare class TranscludeToken extends Token {
12
12
  #private;
13
13
  type: 'template' | 'magic-word';
14
- modifier: string;
15
- childNodes: [AtomToken | SyntaxToken, ...ParameterToken[]] | [SyntaxToken, AtomToken, AtomToken, ...ParameterToken[]];
14
+ readonly modifier = "";
15
+ readonly childNodes: [AtomToken | SyntaxToken, ...ParameterToken[]] | [SyntaxToken, AtomToken, AtomToken, ...ParameterToken[]];
16
16
  abstract get firstChild(): AtomToken | SyntaxToken;
17
17
  abstract get lastChild(): AtomToken | SyntaxToken | ParameterToken;
18
18
  /**
@@ -39,9 +39,9 @@ export declare class TranscludeToken extends Token {
39
39
  */
40
40
  insertAt<T extends ParameterToken>(token: T, i?: number): T;
41
41
  /** 获取所有参数 */
42
- getAllArgs(): ParameterToken[];
42
+ getAllArgs(): readonly ParameterToken[];
43
43
  /** 获取所有匿名参数 */
44
- getAnonArgs(): ParameterToken[];
44
+ getAnonArgs(): readonly ParameterToken[];
45
45
  /**
46
46
  * 获取指定参数
47
47
  * @param key 参数名
@@ -53,10 +53,10 @@ export declare class TranscludeToken extends Token {
53
53
  * 获取重名参数
54
54
  * @throws `Error` 仅用于模板
55
55
  */
56
- getDuplicatedArgs(): [string, ParameterToken[]][];
56
+ getDuplicatedArgs(): readonly [string, ParameterToken[]][];
57
57
  /**
58
58
  * 对特定魔术字获取可能的取值
59
59
  * @throws `Error` 不是可接受的魔术字
60
60
  */
61
- getPossibleValues(): Token[];
61
+ getPossibleValues(): readonly Token[];
62
62
  }
@@ -207,7 +207,7 @@ class TranscludeToken extends index_1.Token {
207
207
  }
208
208
  /** 获取所有参数 */
209
209
  getAllArgs() {
210
- return this.childNodes.filter(child => child.type === 'parameter');
210
+ return this.childNodes.filter((child) => child.type === 'parameter');
211
211
  }
212
212
  /** 获取所有匿名参数 */
213
213
  getAnonArgs() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikilint",
3
- "version": "2.1.5",
3
+ "version": "2.2.0",
4
4
  "description": "A Node.js linter for MediaWiki markup",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -47,14 +47,14 @@
47
47
  "@typescript-eslint/eslint-plugin": "^6.12.0",
48
48
  "@typescript-eslint/parser": "^6.12.0",
49
49
  "ajv-cli": "^5.0.0",
50
- "eslint": "^8.53.0",
50
+ "eslint": "^8.56.0",
51
51
  "eslint-plugin-eslint-comments": "^3.2.0",
52
- "eslint-plugin-jsdoc": "^46.8.2",
52
+ "eslint-plugin-jsdoc": "^47.0.2",
53
53
  "eslint-plugin-json-es": "^1.5.7",
54
54
  "eslint-plugin-n": "^16.3.1",
55
55
  "eslint-plugin-promise": "^6.1.1",
56
56
  "eslint-plugin-regexp": "^2.1.1",
57
- "eslint-plugin-unicorn": "^49.0.0",
57
+ "eslint-plugin-unicorn": "^50.0.1",
58
58
  "typescript": "^5.1.6"
59
59
  },
60
60
  "engines": {