wikilint 2.18.1 → 2.18.3

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/README.md +2 -2
  2. package/bin/cli.js +1 -1
  3. package/bin/config.js +2 -2
  4. package/config/.schema.json +13 -0
  5. package/config/default.json +460 -4
  6. package/config/enwiki.json +111 -0
  7. package/config/jawiki.json +954 -0
  8. package/config/llwiki.json +117 -0
  9. package/config/minimum.json +10 -0
  10. package/config/moegirl.json +104 -0
  11. package/config/zhwiki.json +109 -0
  12. package/dist/base.d.mts +3 -0
  13. package/dist/base.d.ts +3 -0
  14. package/dist/base.js +1 -0
  15. package/dist/base.mjs +2 -1
  16. package/dist/bin/config.js +82 -59
  17. package/dist/index.d.ts +3 -1
  18. package/dist/index.js +41 -29
  19. package/dist/lib/document.d.ts +6 -6
  20. package/dist/lib/document.js +43 -36
  21. package/dist/lib/lsp.d.ts +1 -0
  22. package/dist/lib/lsp.js +83 -55
  23. package/dist/lib/title.d.ts +18 -4
  24. package/dist/lib/title.js +12 -4
  25. package/dist/parser/braces.js +29 -15
  26. package/dist/parser/commentAndExt.js +5 -16
  27. package/dist/parser/links.js +1 -1
  28. package/dist/parser/redirect.js +1 -3
  29. package/dist/src/converter.js +1 -1
  30. package/dist/src/gallery.js +1 -1
  31. package/dist/src/heading.js +3 -3
  32. package/dist/src/imageParameter.js +9 -9
  33. package/dist/src/imagemap.js +3 -2
  34. package/dist/src/index.d.ts +1 -1
  35. package/dist/src/index.js +7 -5
  36. package/dist/src/link/base.js +1 -1
  37. package/dist/src/link/file.d.ts +2 -0
  38. package/dist/src/link/file.js +15 -13
  39. package/dist/src/link/galleryImage.js +1 -1
  40. package/dist/src/link/redirectTarget.js +1 -2
  41. package/dist/src/magicLink.js +1 -1
  42. package/dist/src/nested.js +5 -5
  43. package/dist/src/nowiki/index.js +3 -2
  44. package/dist/src/redirect.js +1 -2
  45. package/dist/src/syntax.d.ts +4 -2
  46. package/dist/src/syntax.js +4 -2
  47. package/dist/src/table/base.js +1 -1
  48. package/dist/src/table/index.js +2 -5
  49. package/dist/src/table/trBase.js +3 -1
  50. package/dist/src/transclude.js +23 -12
  51. package/dist/util/debug.js +11 -1
  52. package/dist/util/lint.js +31 -30
  53. package/dist/util/string.js +3 -4
  54. package/package.json +2 -3
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # WikiLint
8
8
 
9
- This is a minimal version of [WikiParser-Node](https://www.npmjs.com/package/wikiparser-node) customized for [eslint-plugin-wikitext](https://www.npmjs.com/package/eslint-plugin-wikitext).
9
+ This is a minimal version of [WikiParser-Node](https://www.npmjs.com/package/wikiparser-node). The [WikiParser Language Server](https://marketplace.visualstudio.com/items?itemName=Bhsd.vscode-extension-wikiparser) VSCode extension is written based on this package.
10
10
 
11
11
  You can also directly lint Wikitext articles in the command line using this package:
12
12
 
@@ -34,7 +34,7 @@ npx wikilint --config zhwiki --include --lang zh-hans *.wiki
34
34
 
35
35
  ## Configuration
36
36
 
37
- For MediaWiki sites hosted by the Wikimedia Foundation, such as different language editions of Wikipedia, you can use the following command to obtain the parser configuration:
37
+ For MediaWiki sites with the [CodeMirror extension](https://mediawiki.org/wiki/Extension:CodeMirror) installed, such as different language editions of Wikipedia and other [Wikimedia Foundation-hosted sites](https://meta.wikimedia.org/wiki/Special:SiteMatrix), you can use the following command to obtain the parser configuration:
38
38
 
39
39
  ```sh
40
40
  npx getParserConfig <site> <script path> [force]
package/bin/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- require('../dist/bin/cli.js');
3
+ require('../dist/bin/cli.js'); // eslint-disable-line n/no-missing-require
package/bin/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  const /** @type {import('./config.ts').default} */ fetchConfig = require('../dist/bin/config.js').default;
4
- const [,, site, url, force, old] = process.argv;
5
- fetchConfig(site, url, force, old);
4
+ const [,, site, url, force] = process.argv;
5
+ fetchConfig(site, url, force);
@@ -47,6 +47,18 @@
47
47
  },
48
48
  "additionalProperties": false
49
49
  },
50
+ "functionHook": {
51
+ "description": "canonical magic words as parser functions",
52
+ "type": "array",
53
+ "items": {
54
+ "type": "string",
55
+ "pattern": "^[^#A-Z]+$"
56
+ },
57
+ "contains": {
58
+ "const": "msgnw"
59
+ },
60
+ "minItems": 1
61
+ },
50
62
  "variable": {
51
63
  "description": "canonical magic words as variables",
52
64
  "type": "array",
@@ -237,6 +249,7 @@
237
249
  "html",
238
250
  "namespaces",
239
251
  "nsid",
252
+ "functionHook",
240
253
  "variable",
241
254
  "parserFunction",
242
255
  "doubleUnderscore",