wikilint 2.34.0 → 2.35.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.
@@ -41,6 +41,7 @@
41
41
  "templatedata",
42
42
  "timeline",
43
43
  "page-collection",
44
+ "wish",
44
45
  "img"
45
46
  ],
46
47
  "html": [
@@ -77,7 +77,7 @@ const mw = {
77
77
  },
78
78
  },
79
79
  };
80
- const pkg = "wikilint", version = "2.34.0";
80
+ const pkg = "wikilint", version = "2.35.0";
81
81
  let mwConfig;
82
82
  /**
83
83
  * Get the parser configuration for a Wikimedia Foundation project.
@@ -122,7 +122,7 @@ exports.default = async (site, url, user, force, internal) => {
122
122
  siprop: 'general|magicwords|functionhooks|namespaces|namespacealiases',
123
123
  format: 'json',
124
124
  formatversion: '2',
125
- }, { query: { general: { articlepath, variants }, magicwords, namespaces, namespacealiases, functionhooks, }, } = await (await fetch(`${url}/api.php?${new URLSearchParams(params).toString()}`, headers)).json();
125
+ }, { query: { general: { articlepath, variants, langconversion }, magicwords, namespaces, namespacealiases, functionhooks, }, } = await (await fetch(`${url}/api.php?${new URLSearchParams(params).toString()}`, headers)).json();
126
126
  try {
127
127
  eval(m); // eslint-disable-line no-eval
128
128
  }
@@ -140,7 +140,7 @@ exports.default = async (site, url, user, force, internal) => {
140
140
  ]), config = {
141
141
  ...(0, cm_util_1.getParserConfig)(require(path_1.default.join(dir, 'minimum')), mwConfig),
142
142
  ...(0, cm_util_1.getKeywords)(magicwords),
143
- variants: (0, cm_util_1.getVariants)(variants),
143
+ variants: langconversion ? (0, cm_util_1.getVariants)(variants) : [],
144
144
  namespaces: Object.fromEntries(ns),
145
145
  nsid: Object.fromEntries([
146
146
  ...ns.map(([id, canonical]) => [canonical.toLowerCase(), Number(id)]),
@@ -23,7 +23,7 @@ const parseMagicLinks = (wikitext, config, accum) => {
23
23
  let url = lead ? m.slice(lead.length) : m;
24
24
  if (p1) {
25
25
  let trail = '';
26
- const m2 = /&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(url);
26
+ const m2 = /&(?:[lg]t|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(url);
27
27
  if (m2) {
28
28
  trail = url.slice(m2.index);
29
29
  url = url.slice(0, m2.index);
@@ -14,7 +14,7 @@ const index_2 = require("./index");
14
14
  const atom_1 = require("./atom");
15
15
  /* NOT FOR BROWSER ONLY */
16
16
  const document_1 = require("../lib/document");
17
- const insecureStyle = /expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|src|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u, evil = /(?:^|\s|\*\/)(?:javascript|vbscript)(?:\W|$)/iu, complexTypes = new Set(['ext', 'arg', 'magic-word', 'template']), urlAttrs = new Set([
17
+ const insecureStyle = /expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|src|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u, evil = /(?:^|\s|\*\/)(?:java|vb)script(?:\W|$)/iu, complexTypes = new Set(['ext', 'arg', 'magic-word', 'template']), urlAttrs = new Set([
18
18
  'about',
19
19
  'property',
20
20
  'resource',
@@ -63,7 +63,7 @@ class NowikiToken extends base_1.NowikiBaseToken {
63
63
  if (name === 'templatedata' && (sSyntax
64
64
  || sDuplicate)) {
65
65
  // browser版本使用`lintJSONNative()`
66
- return (0, common_1.lintJSON)(innerText).map(({ message, position, line, column,
66
+ return (0, common_1.lintJSON)(innerText).map(({ message, from, to = from, line, endLine = line, column, endColumn = column,
67
67
  /* NOT FOR BROWSER ONLY */
68
68
  severity, }) => {
69
69
  s =
@@ -75,17 +75,17 @@ class NowikiToken extends base_1.NowikiBaseToken {
75
75
  if (!s) {
76
76
  return false;
77
77
  }
78
- const rect = new rect_1.BoundingRect(this, start), startIndex = start + position, startLine = rect.top + line - 1, startCol = (line > 1 ? 0 : rect.left) + column - 1;
78
+ const rect = new rect_1.BoundingRect(this, start);
79
79
  return {
80
80
  rule,
81
81
  message,
82
82
  severity: s,
83
- startIndex,
84
- endIndex: startIndex,
85
- startLine,
86
- endLine: startLine,
87
- startCol,
88
- endCol: startCol,
83
+ startIndex: start + from,
84
+ endIndex: start + to,
85
+ startLine: rect.top + line - 1,
86
+ endLine: rect.top + endLine - 1,
87
+ startCol: (line > 1 ? 0 : rect.left) + column - 1,
88
+ endCol: (endLine > 1 ? 0 : rect.left) + endColumn - 1,
89
89
  };
90
90
  }).filter((e) => e !== false);
91
91
  }
@@ -74,7 +74,7 @@ let NoincludeToken = (() => {
74
74
  LINT: {
75
75
  const { lintConfig } = index_1.default, rule = 'no-ignored', s = lintConfig.getSeverity(rule, 'include');
76
76
  if (s) {
77
- const { innerText } = this, mt = /^<(noinclude|includeonly|onlyinclude)\s+(?:[^\s>/]|\/(?!>))[^>]*>$/iu.exec(innerText);
77
+ const { innerText } = this, mt = /^<(includeonly|(?:no|only)include)\s+(?:[^\s>/]|\/(?!>))[^>]*>$/iu.exec(innerText);
78
78
  if (mt) {
79
79
  const e = (0, lint_1.generateForSelf)(this, { start }, rule, 'useless-attribute', s), { computeEditInfo } = lintConfig, before = mt[1].length + 1, after = innerText.endsWith('/>') ? 2 : 1;
80
80
  e.startIndex += before;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikilint",
3
- "version": "2.34.0",
3
+ "version": "2.35.0",
4
4
  "description": "A Node.js linter for MediaWiki markup",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -72,8 +72,8 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@bhsd/cm-util": "^0.1.0",
75
- "@bhsd/common": "^1.2.0",
76
- "@bhsd/stylelint-util": "^0.1.0",
75
+ "@bhsd/common": "^1.3.0",
76
+ "@bhsd/stylelint-util": "^1.0.1",
77
77
  "binary-search": "^1.3.6",
78
78
  "vscode-languageserver-types": "^3.17.5"
79
79
  },
@@ -82,7 +82,7 @@
82
82
  "entities": "^7.0.0",
83
83
  "mathoid-texvcjs": "^0.6.0",
84
84
  "minimatch": "^10.1.1",
85
- "stylelint": "^16.26.1",
85
+ "stylelint": "^17.0.0",
86
86
  "vscode-css-languageservice": "^6.3.8",
87
87
  "vscode-html-languageservice": "^5.6.0",
88
88
  "vscode-json-languageservice": "^5.6.3"
@@ -90,7 +90,7 @@
90
90
  "devDependencies": {
91
91
  "@bhsd/code-standard": "^1.3.2",
92
92
  "@bhsd/nodejs": "^0.1.0",
93
- "@bhsd/test-util": "^0.2.1",
93
+ "@bhsd/test-util": "^0.3.0",
94
94
  "@stylistic/eslint-plugin": "^5.5.0",
95
95
  "@types/color-name": "^2.0.0",
96
96
  "@types/color-rgba": "^2.1.3",
@@ -117,6 +117,6 @@
117
117
  "vscode-languageserver-textdocument": "^1.0.12"
118
118
  },
119
119
  "engines": {
120
- "node": ">=18.17.0"
120
+ "node": ">=20.19.5"
121
121
  }
122
122
  }