diff --git a/convert-ignores.cjs b/convert-ignores.cjs index 63e4f8f..c598b58 100644 --- a/convert-ignores.cjs +++ b/convert-ignores.cjs @@ -11,7 +11,7 @@ const picomatch = require("picomatch/posix"); */ function convertIgnores (ignores) { return ignores.map( - (ignore) => picomatch(ignore, {"dot": true}) + (ignore) => picomatch(ignore, { "dot": true }) ); } diff --git a/eslint.config.mjs b/eslint.config.mjs index ba90e2c..f1b3b5f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -50,7 +50,7 @@ export default [ "no-tabs": "off", "no-ternary": "off", "no-undefined": "off", - "no-use-before-define": [ "error", {"functions": false} ], + "no-use-before-define": [ "error", { "functions": false } ], "one-var": "off", "operator-linebreak": [ "error", "after" ], "padded-blocks": "off", @@ -61,11 +61,10 @@ export default [ "sort-imports": "off", "sort-keys": "off", - "n/no-missing-require": [ "error", {"allowModules": [ "vscode" ]} ], + "n/no-missing-require": [ "error", { "allowModules": [ "vscode" ] } ], "@stylistic/array-bracket-spacing": [ "error", "always" ], - "@stylistic/indent": [ "error", "tab", {"ObjectExpression": "first"} ], - "@stylistic/object-curly-spacing": [ "error", "never" ], + "@stylistic/indent": [ "error", "tab", { "ObjectExpression": "first" } ], "@stylistic/operator-linebreak": [ "error", "after" ], "@stylistic/space-before-function-paren": [ "error", "always" ], diff --git a/extension.js b/extension.js index 43726b1..c091c35 100644 --- a/extension.js +++ b/extension.js @@ -6,11 +6,11 @@ const vscode = require("vscode"); const os = require("node:os"); const path = require("node:path"); -const {promisify} = require("node:util"); -const {"main": markdownlintCli2} = require("markdownlint-cli2"); -const {readConfig} = require("markdownlint-cli2/markdownlint").promises; +const { promisify } = require("node:util"); +const { "main": markdownlintCli2 } = require("markdownlint-cli2"); +const { readConfig } = require("markdownlint-cli2/markdownlint").promises; // eslint-disable-next-line unicorn/no-keyword-prefix -const {applyFix, applyFixes, expandTildePath, newLineRe} = require("markdownlint-cli2/markdownlint/helpers"); +const { applyFix, applyFixes, expandTildePath, newLineRe } = require("markdownlint-cli2/markdownlint/helpers"); // Constants const extensionDisplayName = "markdownlint"; @@ -161,7 +161,7 @@ class FsWrapper { posixPathSegment = posixPathSegment.replace(firstSegmentRe, "/"); } // Return consistently-formatted Uri with specified path - return this.fwFolderUri.with({"path": posixPathSegment}); + return this.fwFolderUri.with({ "path": posixPathSegment }); } // Implements fs.access via vscode.workspace.fs @@ -568,7 +568,7 @@ function lintWorkspace (logString) { // Runs the lintWorkspace task to lint all Markdown files in the workspace function lintWorkspaceViaTask () { - return vscode.tasks.fetchTasks({"type": extensionDisplayName}) + return vscode.tasks.fetchTasks({ "type": extensionDisplayName }) .then((tasks) => { const lintWorkspaceTask = tasks.find((task) => task.name === lintAllTaskName); return lintWorkspaceTask ? @@ -592,7 +592,7 @@ function lint (document) { // Lint task = markdownlintWrapper(document) .then((results) => { - const {activeTextEditor} = vscode.window; + const { activeTextEditor } = vscode.window; for (const result of results) { // Create Diagnostics const lineNumber = result.lineNumber; @@ -733,7 +733,7 @@ function fixLine (lineIndex, fixInfo) { if (editor && fixInfo) { const document = editor.document; const lineNumber = fixInfo.lineNumber || (lineIndex + 1); - const {text, range} = document.lineAt(lineNumber - 1); + const { text, range } = document.lineAt(lineNumber - 1); const fixedText = applyFix(text, fixInfo, "\n"); return editor.edit((editBuilder) => { if (typeof fixedText === "string") { @@ -743,11 +743,11 @@ function fixLine (lineIndex, fixInfo) { if (lineNumber === 1) { if (document.lineCount > 1) { const nextLine = document.lineAt(range.end.line + 1); - deleteRange = range.with({"end": nextLine.range.start}); + deleteRange = range.with({ "end": nextLine.range.start }); } } else { const previousLine = document.lineAt(range.start.line - 1); - deleteRange = range.with({"start": previousLine.range.end}); + deleteRange = range.with({ "start": previousLine.range.end }); } editBuilder.delete(deleteRange); } @@ -798,7 +798,7 @@ function formatDocument (document, range) { return markdownlintWrapper(document) .then((errors) => { const rangeErrors = errors.filter((error) => { - const {fixInfo} = error; + const { fixInfo } = error; if (fixInfo) { // eslint-disable-next-line unicorn/consistent-destructuring const line = error.lineNumber - 1; @@ -838,7 +838,7 @@ function openConfigFile () { } else { // File does not exist, create one const fileUri = vscode.Uri.joinPath(workspaceFolderUri, markdownlintJson); - const untitledFileUri = fileUri.with({"scheme": schemeUntitled}); + const untitledFileUri = fileUri.with({ "scheme": schemeUntitled }); vscode.window.showTextDocument(untitledFileUri).then( (editor) => { editor.edit((editBuilder) => { @@ -1066,7 +1066,7 @@ function activate (context) { ); // Register CodeActionsProvider - const documentSelector = {"language": markdownLanguageId}; + const documentSelector = { "language": markdownLanguageId }; const codeActionProvider = { provideCodeActions }; @@ -1100,7 +1100,7 @@ function activate (context) { () => Promise.resolve(new LintWorkspacePseudoterminal()) ); const lintWorkspaceTask = new vscode.Task( - {"type": extensionDisplayName}, + { "type": extensionDisplayName }, vscode.TaskScope.Workspace, lintAllTaskName, extensionDisplayName, diff --git a/test-ui/index.cjs b/test-ui/index.cjs index a91962b..670bdf9 100644 --- a/test-ui/index.cjs +++ b/test-ui/index.cjs @@ -3,7 +3,7 @@ // This must be CommonJS or the VS Code host fails with: // Error [ERR_REQUIRE_ESM]: require() of ES Module .../index.mjs not supported. -const {tests} = require("./tests.cjs"); +const { tests } = require("./tests.cjs"); function run () { return tests.reduce((previous, current) => previous.then(() => { @@ -13,4 +13,4 @@ function run () { }), Promise.resolve()); } -module.exports = {run}; +module.exports = { run }; diff --git a/test-ui/tests.cjs b/test-ui/tests.cjs index f2608cc..2484af1 100644 --- a/test-ui/tests.cjs +++ b/test-ui/tests.cjs @@ -309,4 +309,4 @@ if (vscode.workspace.workspaceFolders) { ); } -module.exports = {tests}; +module.exports = { tests }; diff --git a/webpack.config.js b/webpack.config.js index fbb5df0..9e10ba9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -27,7 +27,7 @@ const baseConfig = { "optimization": { // "minimize": false, // "moduleIds": "named", - "minimizer": [ new TerserPlugin({"extractComments": false}) ] + "minimizer": [ new TerserPlugin({ "extractComments": false }) ] }, "externals": { "vscode": "commonjs vscode"