Skip to content

Commit 16f4f1d

Browse files
committed
Add *.mjs to lint script, address newly-reported issues.
1 parent cc4ce07 commit 16f4f1d

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

extension.mjs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// @ts-check
22

3-
"use strict";
4-
53
// Minimal imports (requires that may not be needed are inlined to reduce startup cost)
4+
// eslint-disable-next-line n/no-missing-import
65
import vscode from "vscode";
76
import os from "node:os";
87
import path from "node:path";
98
import { promisify } from "node:util";
109
import { "main" as markdownlintCli2 } from "markdownlint-cli2";
1110
import { applyFix, applyFixes } from "markdownlint-cli2/markdownlint";
1211
import { readConfig } from "markdownlint-cli2/markdownlint/promise";
13-
// eslint-disable-next-line unicorn/no-keyword-prefix
1412
import helpers from "markdownlint-cli2/markdownlint/helpers";
13+
// eslint-disable-next-line unicorn/no-keyword-prefix
1514
const { expandTildePath, newLineRe } = helpers;
1615
import parsers from "markdownlint-cli2/parsers";
1716

@@ -366,11 +365,11 @@ async function getConfig (fs, configuration, uri) {
366365
}
367366

368367
// Returns an array of args entries for the config path for the user/workspace
369-
function getConfigFileArgs (configuration) {
368+
function getConfigFileArguments (configuration) {
370369
const configFile = configuration.get(sectionConfigFile);
371370
/** @type {string[]} */
372-
const configFileArgs = (configFile?.length > 0) ? [ "--config", expandTildePath(configFile, os) ] : [];
373-
return configFileArgs;
371+
const configFileArguments = (configFile?.length > 0) ? [ "--config", expandTildePath(configFile, os) ] : [];
372+
return configFileArguments;
374373
}
375374

376375
// Returns custom rule configuration for user/workspace
@@ -437,7 +436,7 @@ async function markdownlintWrapper (document) {
437436
posixPath(workspaceFolderUri.fsPath);
438437
const argv = independentDocument ?
439438
[] :
440-
[ `:${name}`, ...getConfigFileArgs(configuration) ];
439+
[ `:${name}`, ...getConfigFileArguments(configuration) ];
441440
const contents = independentDocument ?
442441
"nonFileContents" :
443442
"fileContents";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"ci": "npm test && npm run test-ui",
2424
"compile": "webpack --mode production",
2525
"compile-debug": "webpack --mode none",
26-
"lint": "eslint --ignore-pattern bundle.js --ignore-pattern bundle.web.js *.js test-ui/*.cjs eslint.config.mjs && markdownlint-cli2 *.md",
26+
"lint": "eslint --ignore-pattern bundle.js --ignore-pattern bundle.web.js *.mjs *.js test-ui/*.cjs eslint.config.mjs && markdownlint-cli2 *.md",
2727
"schema": "cpy ./node_modules/markdownlint/schema/markdownlint-config-schema.json . --flat && cpy ./node_modules/markdownlint-cli2/schema/markdownlint-cli2-config-schema.json . --flat",
2828
"test": "node --test --experimental-test-coverage && npm run lint && npm run compile && npm run schema && git diff --exit-code",
2929
"test-ui": "node ./test-ui/run-tests.mjs",

stringify-error.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ const newlineRe = /\r\n?|\n/g;
77

88
/**
99
* Converts a string to an array of indented lines.
10-
* @param {String} str String to convert.
10+
* @param {String} string String to convert.
1111
* @returns {String[]} Array of indented lines.
1212
*/
13-
function toIndentedLines (str) {
14-
return str.split(newlineRe).map((s) => ` ${s}`);
13+
function toIndentedLines (string) {
14+
return string.split(newlineRe).map((line) => ` ${line}`);
1515
}
1616

1717
/**
@@ -34,13 +34,13 @@ function stringifyError (error) {
3434
result.push(` ${frame.trim()}`);
3535
}
3636
if (cause) {
37-
result.push("cause:")
38-
result.push(...toIndentedLines(stringifyError(cause)))
37+
result.push("cause:");
38+
result.push(...toIndentedLines(stringifyError(cause)));
3939
}
4040
if (errors.length > 0) {
41-
result.push("errors:")
42-
for (const err of errors) {
43-
result.push(...toIndentedLines(stringifyError(err)))
41+
result.push("errors:");
42+
for (const subError of errors) {
43+
result.push(...toIndentedLines(stringifyError(subError)));
4444
}
4545
}
4646
return result.join("\n");

0 commit comments

Comments
 (0)