wikiparser-node 1.24.1 → 1.25.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.
Files changed (58) hide show
  1. package/README.md +9 -4
  2. package/bundle/bundle-es8.min.js +24 -23
  3. package/bundle/bundle-lsp.min.js +28 -27
  4. package/bundle/bundle.min.js +25 -25
  5. package/dist/addon/token.js +1 -1
  6. package/dist/base.d.mts +2 -1
  7. package/dist/base.d.ts +2 -1
  8. package/dist/bin/config.js +1 -1
  9. package/dist/index.d.ts +4 -3
  10. package/dist/index.js +85 -55
  11. package/dist/lib/element.js +33 -29
  12. package/dist/lib/text.js +174 -171
  13. package/dist/mixin/hidden.js +1 -1
  14. package/dist/mixin/noEscape.js +9 -7
  15. package/dist/parser/links.js +10 -4
  16. package/dist/src/arg.js +39 -33
  17. package/dist/src/attribute.js +52 -38
  18. package/dist/src/attributes.js +54 -51
  19. package/dist/src/commented.js +2 -1
  20. package/dist/src/converterFlags.js +20 -18
  21. package/dist/src/converterRule.js +6 -3
  22. package/dist/src/extLink.js +6 -4
  23. package/dist/src/gallery.js +48 -42
  24. package/dist/src/heading.js +65 -61
  25. package/dist/src/html.js +75 -71
  26. package/dist/src/imageParameter.js +17 -15
  27. package/dist/src/imagemap.js +20 -18
  28. package/dist/src/index.js +100 -99
  29. package/dist/src/link/base.js +38 -33
  30. package/dist/src/link/category.js +11 -6
  31. package/dist/src/link/file.js +87 -76
  32. package/dist/src/link/galleryImage.js +8 -6
  33. package/dist/src/link/index.js +8 -6
  34. package/dist/src/link/redirectTarget.js +10 -8
  35. package/dist/src/magicLink.js +22 -20
  36. package/dist/src/nested.js +29 -27
  37. package/dist/src/nowiki/comment.js +11 -9
  38. package/dist/src/nowiki/index.js +9 -7
  39. package/dist/src/nowiki/listBase.js +8 -5
  40. package/dist/src/nowiki/quote.js +29 -25
  41. package/dist/src/paramTag/index.js +24 -22
  42. package/dist/src/parameter.js +29 -23
  43. package/dist/src/pre.js +1 -1
  44. package/dist/src/redirect.js +5 -3
  45. package/dist/src/syntax.js +1 -1
  46. package/dist/src/table/index.js +35 -31
  47. package/dist/src/table/td.js +24 -19
  48. package/dist/src/table/trBase.js +13 -11
  49. package/dist/src/tagPair/ext.js +13 -10
  50. package/dist/src/tagPair/include.js +13 -11
  51. package/dist/src/transclude.js +39 -37
  52. package/dist/util/constants.js +3 -1
  53. package/dist/util/lint.js +12 -9
  54. package/extensions/dist/base.js +4 -1
  55. package/i18n/en.json +77 -0
  56. package/i18n/zh-hans.json +71 -56
  57. package/i18n/zh-hant.json +71 -56
  58. package/package.json +2 -2
@@ -156,78 +156,80 @@ let HeadingToken = (() => {
156
156
  }
157
157
  /** @private */
158
158
  lint(start = this.getAbsoluteIndex(), re) {
159
- const errors = super.lint(start, re), { firstChild, level } = this, innerStr = firstChild.toString(), unbalancedStart = innerStr.startsWith('='), unbalanced = unbalancedStart || innerStr.endsWith('='), rect = new rect_1.BoundingRect(this, start), s = this.inHtmlAttrs(), rules = ['h1', 'unbalanced-header', 'format-leakage'], severities = rules.map(rule => index_1.default.lintConfig.getSeverity(rule, 'apostrophe'));
160
- if (severities[0] && this.level === 1) {
161
- const e = (0, lint_1.generateForChild)(firstChild, rect, rules[0], '<h1>', severities[0]);
162
- if (!unbalanced) {
163
- e.suggestions = [(0, lint_1.fixBy)(e, 'h2', `=${innerStr}=`)];
164
- }
165
- errors.push(e);
166
- }
167
- if (severities[1] && unbalanced) {
168
- const msg = index_1.default.msg('unbalanced $1 in a section header', '"="'), e = (0, lint_1.generateForChild)(firstChild, rect, rules[1], msg, severities[1]);
169
- if (innerStr === '=') {
170
- //
171
- }
172
- else if (unbalancedStart) {
173
- const [extra] = /^=+/u.exec(innerStr), newLevel = level + extra.length;
174
- e.suggestions = [{ desc: `h${level}`, range: [e.startIndex, e.startIndex + extra.length], text: '' }];
175
- if (newLevel < 7) {
176
- e.suggestions.push({ desc: `h${newLevel}`, range: [e.endIndex, e.endIndex], text: extra });
159
+ LINT: { // eslint-disable-line no-unused-labels
160
+ const errors = super.lint(start, re), { firstChild, level } = this, innerStr = firstChild.toString(), unbalancedStart = innerStr.startsWith('='), unbalanced = unbalancedStart || innerStr.endsWith('='), rect = new rect_1.BoundingRect(this, start), s = this.inHtmlAttrs(), rules = ['h1', 'unbalanced-header', 'format-leakage'], severities = rules.map(rule => index_1.default.lintConfig.getSeverity(rule, 'apostrophe'));
161
+ if (severities[0] && this.level === 1) {
162
+ const e = (0, lint_1.generateForChild)(firstChild, rect, rules[0], '<h1>', severities[0]);
163
+ if (!unbalanced) {
164
+ e.suggestions = [(0, lint_1.fixBy)(e, 'h2', `=${innerStr}=`)];
177
165
  }
166
+ errors.push(e);
178
167
  }
179
- else {
180
- const extra = /[^=](=+)$/u.exec(innerStr)[1], newLevel = level + extra.length;
181
- e.suggestions = [{ desc: `h${level}`, range: [e.endIndex - extra.length, e.endIndex], text: '' }];
182
- if (newLevel < 7) {
183
- e.suggestions.push({ desc: `h${newLevel}`, range: [e.startIndex, e.startIndex], text: extra });
184
- }
185
- }
186
- errors.push(e);
187
- }
188
- if (s) {
189
- const rule = 'parsing-order', severity = index_1.default.lintConfig.getSeverity(rule, s === 2 ? 'heading' : 'templateInTable');
190
- if (severity) {
191
- errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'section header in HTML tag attributes', severity));
192
- }
193
- }
194
- if (severities[2]) {
195
- const rootStr = this.getRootNode().toString(), quotes = firstChild.childNodes.filter((0, debug_1.isToken)('quote')), boldQuotes = quotes.filter(({ bold }) => bold), italicQuotes = quotes.filter(({ italic }) => italic);
196
- if (boldQuotes.length % 2) {
197
- const e = (0, lint_1.generateForChild)(boldQuotes[boldQuotes.length - 1], {
198
- ...rect, // eslint-disable-line @typescript-eslint/no-misused-spread
199
- start: start + level,
200
- left: rect.left + level,
201
- }, rules[2], index_1.default.msg('unbalanced $1 in a section header', 'bold apostrophes'), severities[2]), end = start + level + innerStr.length, remove = (0, lint_1.fixByRemove)(e);
202
- if (rootStr.slice(e.endIndex, end).trim()) {
203
- e.suggestions = [
204
- remove,
205
- (0, lint_1.fixByClose)(end, `'''`),
206
- ];
168
+ if (severities[1] && unbalanced) {
169
+ const msg = index_1.default.msg('unbalanced-in-section-header', '"="'), e = (0, lint_1.generateForChild)(firstChild, rect, rules[1], msg, severities[1]);
170
+ if (innerStr === '=') {
171
+ //
207
172
  }
208
- else if (boldQuotes.length === 1 && italicQuotes.length === 0) {
209
- e.fix = remove;
173
+ else if (unbalancedStart) {
174
+ const [extra] = /^=+/u.exec(innerStr), newLevel = level + extra.length;
175
+ e.suggestions = [{ desc: `h${level}`, range: [e.startIndex, e.startIndex + extra.length], text: '' }];
176
+ if (newLevel < 7) {
177
+ e.suggestions.push({ desc: `h${newLevel}`, range: [e.endIndex, e.endIndex], text: extra });
178
+ }
210
179
  }
211
180
  else {
212
- e.suggestions = [remove];
181
+ const extra = /[^=](=+)$/u.exec(innerStr)[1], newLevel = level + extra.length;
182
+ e.suggestions = [{ desc: `h${level}`, range: [e.endIndex - extra.length, e.endIndex], text: '' }];
183
+ if (newLevel < 7) {
184
+ e.suggestions.push({ desc: `h${newLevel}`, range: [e.startIndex, e.startIndex], text: extra });
185
+ }
213
186
  }
214
187
  errors.push(e);
215
188
  }
216
- if (italicQuotes.length % 2) {
217
- const e = (0, lint_1.generateForChild)(italicQuotes[italicQuotes.length - 1], { start: start + level }, rules[2], index_1.default.msg('unbalanced $1 in a section header', 'italic apostrophes'), severities[2]), end = start + level + innerStr.length;
218
- if (rootStr.slice(e.endIndex, end).trim()) {
219
- e.suggestions = [(0, lint_1.fixByClose)(end, `''`)];
189
+ if (s) {
190
+ const rule = 'parsing-order', severity = index_1.default.lintConfig.getSeverity(rule, s === 2 ? 'heading' : 'templateInTable');
191
+ if (severity) {
192
+ errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'header-in-html', severity));
220
193
  }
221
- else if (italicQuotes.length === 1 && boldQuotes.length === 0) {
222
- e.fix = (0, lint_1.fixByRemove)(e);
194
+ }
195
+ if (severities[2]) {
196
+ const rootStr = this.getRootNode().toString(), quotes = firstChild.childNodes.filter((0, debug_1.isToken)('quote')), boldQuotes = quotes.filter(({ bold }) => bold), italicQuotes = quotes.filter(({ italic }) => italic);
197
+ if (boldQuotes.length % 2) {
198
+ const e = (0, lint_1.generateForChild)(boldQuotes[boldQuotes.length - 1], {
199
+ ...rect, // eslint-disable-line @typescript-eslint/no-misused-spread
200
+ start: start + level,
201
+ left: rect.left + level,
202
+ }, rules[2], index_1.default.msg('unbalanced-in-section-header', 'bold-apostrophes'), severities[2]), end = start + level + innerStr.length, remove = (0, lint_1.fixByRemove)(e);
203
+ if (rootStr.slice(e.endIndex, end).trim()) {
204
+ e.suggestions = [
205
+ remove,
206
+ (0, lint_1.fixByClose)(end, `'''`),
207
+ ];
208
+ }
209
+ else if (boldQuotes.length === 1 && italicQuotes.length === 0) {
210
+ e.fix = remove;
211
+ }
212
+ else {
213
+ e.suggestions = [remove];
214
+ }
215
+ errors.push(e);
223
216
  }
224
- else {
225
- e.suggestions = [(0, lint_1.fixByRemove)(e)];
217
+ if (italicQuotes.length % 2) {
218
+ const e = (0, lint_1.generateForChild)(italicQuotes[italicQuotes.length - 1], { start: start + level }, rules[2], index_1.default.msg('unbalanced-in-section-header', 'italic-apostrophes'), severities[2]), end = start + level + innerStr.length;
219
+ if (rootStr.slice(e.endIndex, end).trim()) {
220
+ e.suggestions = [(0, lint_1.fixByClose)(end, `''`)];
221
+ }
222
+ else if (italicQuotes.length === 1 && boldQuotes.length === 0) {
223
+ e.fix = (0, lint_1.fixByRemove)(e);
224
+ }
225
+ else {
226
+ e.suggestions = [(0, lint_1.fixByRemove)(e)];
227
+ }
228
+ errors.push(e);
226
229
  }
227
- errors.push(e);
228
230
  }
231
+ return errors;
229
232
  }
230
- return errors;
231
233
  }
232
234
  /** @private */
233
235
  print() {
@@ -237,8 +239,10 @@ let HeadingToken = (() => {
237
239
  /** @private */
238
240
  json(_, start = this.getAbsoluteIndex()) {
239
241
  const json = super.json(undefined, start);
240
- json['level'] = this.level;
241
- return json;
242
+ LSP: { // eslint-disable-line no-unused-labels
243
+ json['level'] = this.level;
244
+ return json;
245
+ }
242
246
  }
243
247
  /* NOT FOR BROWSER */
244
248
  cloneNode() {
package/dist/src/html.js CHANGED
@@ -192,88 +192,90 @@ let HtmlToken = (() => {
192
192
  }
193
193
  /** @private */
194
194
  lint(start = this.getAbsoluteIndex(), re) {
195
- const errors = super.lint(start, re), { name, parentNode, closing, selfClosing } = this, rect = new rect_1.BoundingRect(this, start), severity = this.inTableAttrs();
196
- let rule = 'h1', s = index_1.default.lintConfig.getSeverity(rule, 'html');
197
- if (s && name === 'h1' && !closing) {
198
- const e = (0, lint_1.generateForSelf)(this, rect, rule, '<h1>', s);
199
- e.suggestions = [{ desc: 'h2', range: [start + 2, start + 3], text: '2' }];
200
- errors.push(e);
201
- }
202
- rule = 'parsing-order';
203
- s = severity && index_1.default.lintConfig.getSeverity(rule, severity === 2 ? 'html' : 'templateInTable');
204
- if (s) {
205
- const e = (0, lint_1.generateForSelf)(this, rect, rule, 'HTML tag in table attributes', s);
206
- if (severity === 2) {
207
- e.suggestions = [(0, lint_1.fixByRemove)(e)];
195
+ LINT: { // eslint-disable-line no-unused-labels
196
+ const errors = super.lint(start, re), { name, parentNode, closing, selfClosing } = this, rect = new rect_1.BoundingRect(this, start), severity = this.inTableAttrs();
197
+ let rule = 'h1', s = index_1.default.lintConfig.getSeverity(rule, 'html');
198
+ if (s && name === 'h1' && !closing) {
199
+ const e = (0, lint_1.generateForSelf)(this, rect, rule, '<h1>', s);
200
+ e.suggestions = [{ desc: 'h2', range: [start + 2, start + 3], text: '2' }];
201
+ errors.push(e);
208
202
  }
209
- errors.push(e);
210
- }
211
- rule = 'obsolete-tag';
212
- s = index_1.default.lintConfig.getSeverity(rule, name);
213
- if (s && obsoleteTags.has(name)) {
214
- errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'obsolete HTML tag', s));
215
- }
216
- rule = 'bold-header';
217
- s = index_1.default.lintConfig.getSeverity(rule, name);
218
- if (s && (name === 'b' || name === 'strong')
219
- && this.closest('heading-title,ext')?.type === 'heading-title') {
220
- const e = (0, lint_1.generateForSelf)(this, rect, rule, 'bold in section header', s);
221
- e.suggestions = [(0, lint_1.fixByRemove)(e)];
222
- errors.push(e);
223
- }
224
- const { html: [, flexibleTags, voidTags] } = this.getAttribute('config'), isVoid = voidTags.includes(name), isFlexible = flexibleTags.includes(name), isNormal = !isVoid && !isFlexible;
225
- rule = 'unmatched-tag';
226
- if (closing && (selfClosing || isVoid) || selfClosing && isNormal) {
227
- s = index_1.default.lintConfig.getSeverity(rule, closing ? 'both' : 'selfClosing');
203
+ rule = 'parsing-order';
204
+ s = severity && index_1.default.lintConfig.getSeverity(rule, severity === 2 ? 'html' : 'templateInTable');
228
205
  if (s) {
229
- const e = (0, lint_1.generateForSelf)(this, rect, rule, closing ? 'tag that is both closing and self-closing' : 'invalid self-closing tag', s), open = (0, lint_1.fixByOpen)(start), noSelfClosing = {
230
- desc: 'no self-closing',
231
- range: [e.endIndex - 2, e.endIndex - 1],
232
- text: '',
233
- };
234
- if (isFlexible) {
235
- e.suggestions = [open, noSelfClosing];
236
- }
237
- else if (closing) {
238
- e.fix = isVoid ? open : noSelfClosing;
239
- }
240
- else {
241
- e.suggestions = [
242
- noSelfClosing,
243
- (0, lint_1.fixByClose)(e.endIndex, `></${name}>`, -2),
244
- ];
206
+ const e = (0, lint_1.generateForSelf)(this, rect, rule, 'html-in-table', s);
207
+ if (severity === 2) {
208
+ e.suggestions = [(0, lint_1.fixByRemove)(e)];
245
209
  }
246
210
  errors.push(e);
247
211
  }
248
- }
249
- else if (!this.findMatchingTag()) {
250
- const error = (0, lint_1.generateForSelf)(this, rect, rule, closing ? 'unmatched closing tag' : 'unclosed tag'), ancestor = this.closest('magic-word');
251
- if (ancestor && magicWords.has(ancestor.name)) {
252
- s = index_1.default.lintConfig.getSeverity(rule, 'conditional');
212
+ rule = 'obsolete-tag';
213
+ s = index_1.default.lintConfig.getSeverity(rule, name);
214
+ if (s && obsoleteTags.has(name)) {
215
+ errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'obsolete-tag', s));
253
216
  }
254
- else if (closing) {
255
- s = index_1.default.lintConfig.getSeverity(rule, 'closing');
256
- error.suggestions = [(0, lint_1.fixByRemove)(error)];
217
+ rule = 'bold-header';
218
+ s = index_1.default.lintConfig.getSeverity(rule, name);
219
+ if (s && (name === 'b' || name === 'strong')
220
+ && this.closest('heading-title,ext')?.type === 'heading-title') {
221
+ const e = (0, lint_1.generateForSelf)(this, rect, rule, 'bold-in-header', s);
222
+ e.suggestions = [(0, lint_1.fixByRemove)(e)];
223
+ errors.push(e);
257
224
  }
258
- else {
259
- s = index_1.default.lintConfig.getSeverity(rule, 'opening');
260
- const childNodes = parentNode?.childNodes;
261
- if (formattingTags.has(name)) {
262
- if (childNodes?.slice(0, childNodes.indexOf(this)).some(tag => tag.type === 'html' && tag.name === name && !tag.findMatchingTag())) {
263
- error.suggestions = [(0, lint_1.fixByClose)(start + 1, '/')];
225
+ const { html: [, flexibleTags, voidTags] } = this.getAttribute('config'), isVoid = voidTags.includes(name), isFlexible = flexibleTags.includes(name), isNormal = !isVoid && !isFlexible;
226
+ rule = 'unmatched-tag';
227
+ if (closing && (selfClosing || isVoid) || selfClosing && isNormal) {
228
+ s = index_1.default.lintConfig.getSeverity(rule, closing ? 'both' : 'selfClosing');
229
+ if (s) {
230
+ const e = (0, lint_1.generateForSelf)(this, rect, rule, closing ? 'closing-and-self-closing' : 'invalid-self-closing', s), open = (0, lint_1.fixByOpen)(start), noSelfClosing = {
231
+ desc: index_1.default.msg('no-self-closing'),
232
+ range: [e.endIndex - 2, e.endIndex - 1],
233
+ text: '',
234
+ };
235
+ if (isFlexible) {
236
+ e.suggestions = [open, noSelfClosing];
237
+ }
238
+ else if (closing) {
239
+ e.fix = isVoid ? open : noSelfClosing;
264
240
  }
265
- if (this.closest('heading-title')) {
266
- error.rule = 'format-leakage';
267
- s = index_1.default.lintConfig.getSeverity('format-leakage', name);
241
+ else {
242
+ e.suggestions = [
243
+ noSelfClosing,
244
+ (0, lint_1.fixByClose)(e.endIndex, `></${name}>`, -2),
245
+ ];
268
246
  }
247
+ errors.push(e);
269
248
  }
270
249
  }
271
- if (s) {
272
- error.severity = s;
273
- errors.push(error);
250
+ else if (!this.findMatchingTag()) {
251
+ const error = (0, lint_1.generateForSelf)(this, rect, rule, closing ? 'unmatched-closing' : 'unclosed-tag'), ancestor = this.closest('magic-word');
252
+ if (ancestor && magicWords.has(ancestor.name)) {
253
+ s = index_1.default.lintConfig.getSeverity(rule, 'conditional');
254
+ }
255
+ else if (closing) {
256
+ s = index_1.default.lintConfig.getSeverity(rule, 'closing');
257
+ error.suggestions = [(0, lint_1.fixByRemove)(error)];
258
+ }
259
+ else {
260
+ s = index_1.default.lintConfig.getSeverity(rule, 'opening');
261
+ const childNodes = parentNode?.childNodes;
262
+ if (formattingTags.has(name)) {
263
+ if (childNodes?.slice(0, childNodes.indexOf(this)).some(tag => tag.type === 'html' && tag.name === name && !tag.findMatchingTag())) {
264
+ error.suggestions = [(0, lint_1.fixByClose)(start + 1, '/')];
265
+ }
266
+ if (this.closest('heading-title')) {
267
+ error.rule = 'format-leakage';
268
+ s = index_1.default.lintConfig.getSeverity('format-leakage', name);
269
+ }
270
+ }
271
+ }
272
+ if (s) {
273
+ error.severity = s;
274
+ errors.push(error);
275
+ }
274
276
  }
277
+ return errors;
275
278
  }
276
- return errors;
277
279
  }
278
280
  /**
279
281
  * Find the matching tag
@@ -331,8 +333,10 @@ let HtmlToken = (() => {
331
333
  /** @private */
332
334
  json(_, start = this.getAbsoluteIndex()) {
333
335
  const json = super.json(undefined, start);
334
- Object.assign(json, { closing: this.closing, selfClosing: this.#selfClosing });
335
- return json;
336
+ LSP: { // eslint-disable-line no-unused-labels
337
+ Object.assign(json, { closing: this.closing, selfClosing: this.#selfClosing });
338
+ return json;
339
+ }
336
340
  }
337
341
  /* NOT FOR BROWSER */
338
342
  cloneNode() {
@@ -196,24 +196,26 @@ class ImageParameterToken extends index_2.Token {
196
196
  }
197
197
  /** @private */
198
198
  lint(start = this.getAbsoluteIndex(), re) {
199
- const errors = super.lint(start, re), { link, name } = this;
200
- if (name === 'invalid') {
201
- const rule = 'invalid-gallery', s = index_1.default.lintConfig.getSeverity(rule, 'parameter');
202
- if (s) {
203
- const e = (0, lint_1.generateForSelf)(this, { start }, rule, 'invalid image parameter', s);
204
- e.fix = (0, lint_1.fixByRemove)(e, -1);
205
- errors.push(e);
199
+ LINT: { // eslint-disable-line no-unused-labels
200
+ const errors = super.lint(start, re), { link, name } = this;
201
+ if (name === 'invalid') {
202
+ const rule = 'invalid-gallery', s = index_1.default.lintConfig.getSeverity(rule, 'parameter');
203
+ if (s) {
204
+ const e = (0, lint_1.generateForSelf)(this, { start }, rule, 'invalid-image-parameter', s);
205
+ e.fix = (0, lint_1.fixByRemove)(e, -1);
206
+ errors.push(e);
207
+ }
206
208
  }
207
- }
208
- else if (typeof link === 'object' && link.encoded) {
209
- const rule = 'url-encoding', s = index_1.default.lintConfig.getSeverity(rule, 'file');
210
- if (s) {
211
- const e = (0, lint_1.generateForSelf)(this, { start }, rule, 'unnecessary URL encoding in an internal link', s);
212
- e.fix = (0, lint_1.fixByDecode)(e, this);
213
- errors.push(e);
209
+ else if (typeof link === 'object' && link.encoded) {
210
+ const rule = 'url-encoding', s = index_1.default.lintConfig.getSeverity(rule, 'file');
211
+ if (s) {
212
+ const e = (0, lint_1.generateForSelf)(this, { start }, rule, 'unnecessary-encoding', s);
213
+ e.fix = (0, lint_1.fixByDecode)(e, this);
214
+ errors.push(e);
215
+ }
214
216
  }
217
+ return errors;
215
218
  }
216
- return errors;
217
219
  }
218
220
  /** 是否是不可变参数 */
219
221
  #isVoid() {
@@ -148,26 +148,28 @@ let ImagemapToken = (() => {
148
148
  }
149
149
  /** @private */
150
150
  lint(start = this.getAbsoluteIndex(), re) {
151
- const errors = super.lint(start, re), rect = new rect_1.BoundingRect(this, start), { childNodes, image } = this, rule = 'invalid-imagemap', s = index_1.default.lintConfig.getSeverity(rule, image ? 'link' : 'image');
152
- if (s) {
153
- if (image) {
154
- errors.push(...childNodes.filter(child => {
155
- const str = child.toString().trim();
156
- return child.is('noinclude') && str && !str.startsWith('#');
157
- }).map(child => {
158
- const e = (0, lint_1.generateForChild)(child, rect, rule, 'invalid link in <imagemap>', s);
159
- e.suggestions = [
160
- (0, lint_1.fixByRemove)(e, -1),
161
- (0, lint_1.fixBy)(e, 'comment', '# '),
162
- ];
163
- return e;
164
- }));
165
- }
166
- else {
167
- errors.push((0, lint_1.generateForSelf)(this, rect, rule, '<imagemap> without an image', s));
151
+ LINT: { // eslint-disable-line no-unused-labels
152
+ const errors = super.lint(start, re), rect = new rect_1.BoundingRect(this, start), { childNodes, image } = this, rule = 'invalid-imagemap', s = index_1.default.lintConfig.getSeverity(rule, image ? 'link' : 'image');
153
+ if (s) {
154
+ if (image) {
155
+ errors.push(...childNodes.filter(child => {
156
+ const str = child.toString().trim();
157
+ return child.is('noinclude') && str && !str.startsWith('#');
158
+ }).map(child => {
159
+ const e = (0, lint_1.generateForChild)(child, rect, rule, 'invalid-imagemap-link', s);
160
+ e.suggestions = [
161
+ (0, lint_1.fixByRemove)(e, -1),
162
+ (0, lint_1.fixBy)(e, 'comment', '# '),
163
+ ];
164
+ return e;
165
+ }));
166
+ }
167
+ else {
168
+ errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'imagemap-without-image', s));
169
+ }
168
170
  }
171
+ return errors;
169
172
  }
170
- return errors;
171
173
  }
172
174
  /* PRINT ONLY */
173
175
  /** @private */