lint-wiki-dumps 0.3.0 → 0.3.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 (2) hide show
  1. package/package.json +3 -3
  2. package/server.js +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-wiki-dumps",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Lint Wikipedia dumps",
5
5
  "keywords": [
6
6
  "lint",
@@ -37,11 +37,11 @@
37
37
  "@bhsd/common": "^0.9.3",
38
38
  "chalk": "^4.1.2",
39
39
  "unbzip2-stream": "^1.4.3",
40
- "wikilint": "^2.20.0",
40
+ "wikilint": "^2.20.1",
41
41
  "xml-stream": "^0.4.5"
42
42
  },
43
43
  "optionalDependencies": {
44
- "vscode-css-languageservice": "^6.3.2"
44
+ "vscode-css-languageservice": "^6.3.4"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@stylistic/eslint-plugin": "^3.1.0",
package/server.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const http_1 = require("http");
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const wikilint_1 = __importDefault(require("wikilint"));
9
10
  const util_1 = require("./util");
10
11
  const port = parseInt(process.env['PORT'] || '8000'), headers = {
11
12
  'content-type': 'application/json',
@@ -39,7 +40,15 @@ let busy = false;
39
40
  if (code === 200) {
40
41
  const { source, content_model: contentModel, latest: { timestamp } } = await response.json();
41
42
  if (contentModel === 'wikitext') {
42
- const errors = (0, util_1.lint)(source), hash = `${(0, util_1.getHash)(lang, title)}.js`, filepath = path_1.default.join('reports', 'data', hash);
43
+ wikilint_1.default.config = `${lang}wiki`;
44
+ const errors = (0, util_1.lint)(source)
45
+ .map(({ rule, startLine, startCol, message, excerpt }) => [
46
+ rule,
47
+ startLine + 1,
48
+ startCol + 1,
49
+ message,
50
+ excerpt,
51
+ ]), hash = `${(0, util_1.getHash)(lang, title)}.js`, filepath = path_1.default.join('reports', 'data', hash);
43
52
  console.log(`Remaining errors in ${hash}: ${errors.length}`);
44
53
  (0, util_1.write)(filepath, errors);
45
54
  obj.status = 'success';