diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8dc1c1..b51eee6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,9 +20,8 @@ jobs: strategy: matrix: node-version: - - '22.1' - - '20.10' - - '18.18' + - '22.4' + - '20.16' os: - macos-latest - ubuntu-latest diff --git a/.gitignore b/.gitignore index 4612385..de4d1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ dist node_modules -markdownlint-rules/emd002.js -markdownlint-rules/emd003.js diff --git a/bin/lint-markdown-api-history.ts b/bin/lint-markdown-api-history.ts index 80656bd..179a27d 100644 --- a/bin/lint-markdown-api-history.ts +++ b/bin/lint-markdown-api-history.ts @@ -2,19 +2,20 @@ import { access, constants, readFile } from 'node:fs/promises'; import { resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { parseArgs } from 'node:util'; import Ajv, { ValidateFunction } from 'ajv'; -import type { fromHtml as FromHtmlFunction } from 'hast-util-from-html'; -import type { HTML, Heading } from 'mdast'; -import type { fromMarkdown as FromMarkdownFunction } from 'mdast-util-from-markdown'; -import * as minimist from 'minimist'; -import type { Literal, Node } from 'unist'; -import type { visit as VisitFunction } from 'unist-util-visit'; +import { fromHtml } from 'hast-util-from-html'; +import { fromMarkdown } from 'mdast-util-from-markdown'; +import { visit } from 'unist-util-visit'; import { URI } from 'vscode-uri'; import { parseDocument, visit as yamlVisit } from 'yaml'; -import { dynamicImport } from '../lib/helpers'; -import { DocsWorkspace } from '../lib/markdown'; +import type { HTML, Heading } from 'mdast'; +import type { Literal, Node } from 'unist'; + +import { DocsWorkspace } from '../lib/markdown.js'; // ": " const possibleStringRegex = /^[ \S]+?: *?(\S[ \S]+?)$/gm; @@ -35,19 +36,19 @@ interface ApiHistory { interface Options { // Check if the API history block is preceded by a heading - checkPlacement: boolean; + checkPlacement?: boolean; // Check if the 'breaking-changes-header' heading id's in the API history block exist in the breaking changes file at this filepath - breakingChangesFile: string; + breakingChangesFile?: string; // Check if the API history block contains strings that might cause issues when parsing the YAML - checkStrings: boolean; + checkStrings?: boolean; // Check if the API history block contains descriptions that aren't surrounded by double quotation marks - checkDescriptions: boolean; + checkDescriptions?: boolean; // Check if the API history block contains comments - disallowComments: boolean; + disallowComments?: boolean; // Array of glob patterns to ignore when processing files - ignoreGlobs: string[]; + ignoreGlobs?: string[]; // Check if the API history block's YAML adheres to the JSON schema at this filepath - schema: string; + schema?: string; // TODO: Implement this when GH_TOKEN isn't needed to fetch PR release versions anymore // checkPullRequestLinks: boolean; @@ -65,12 +66,6 @@ function isHTML(node: Node): node is HTML { export async function findPossibleApiHistoryBlocks( content: string, ): Promise { - const { fromMarkdown } = (await dynamicImport('mdast-util-from-markdown')) as { - fromMarkdown: typeof FromMarkdownFunction; - }; - const { visit } = (await dynamicImport('unist-util-visit')) as { - visit: typeof VisitFunction; - }; const tree = fromMarkdown(content); const codeBlocks: PossibleHistoryBlock[] = []; @@ -119,13 +114,6 @@ async function main( let warningCounter = 0; try { - const { fromHtml } = (await dynamicImport('hast-util-from-html')) as { - fromHtml: typeof FromHtmlFunction; - }; - const { fromMarkdown } = (await dynamicImport('mdast-util-from-markdown')) as { - fromMarkdown: typeof FromMarkdownFunction; - }; - const workspace = new DocsWorkspace(workspaceRoot, globs, ignoreGlobs); let validateAgainstSchema: ValidateFunction | null = null; @@ -407,47 +395,71 @@ async function main( } function parseCommandLine() { - const showUsage = (arg?: string): boolean => { - if (!arg || arg.startsWith('-')) { - console.log( - 'Usage: lint-roller-markdown-api-history [--root ] ' + - ' [-h|--help]' + - ' [--check-placement] [--breaking-changes-file ] [--check-strings] [--check-descriptions] [--disallow-comments]' + - ' [--schema ]' + - ' [--ignore ] [--ignore-path ]', - ); - process.exit(1); - } - - return true; + const showUsage = (): never => { + console.log( + 'Usage: lint-roller-markdown-api-history [--root ] ' + + ' [-h|--help]' + + ' [--check-placement] [--breaking-changes-file ] [--check-strings] [--check-descriptions] [--disallow-comments]' + + ' [--schema ]' + + ' [--ignore ] [--ignore-path ]', + ); + process.exit(1); }; - const opts = minimist(process.argv.slice(2), { - boolean: [ - 'help', - 'check-placement', - 'check-strings', - 'check-descriptions', - 'disallow-comments', - ], - string: ['root', 'ignore', 'ignore-path', 'schema', 'breaking-changes-file'], - unknown: showUsage, - default: { - 'check-placement': true, - 'check-strings': true, - 'check-descriptions': true, - 'disallow-comments': true, - }, - }); + try { + const opts = parseArgs({ + allowNegative: true, + allowPositionals: true, + options: { + 'check-placement': { + type: 'boolean', + default: true, + }, + 'check-strings': { + type: 'boolean', + default: true, + }, + 'check-descriptions': { + type: 'boolean', + default: true, + }, + 'disallow-comments': { + type: 'boolean', + default: true, + }, + root: { + type: 'string', + }, + ignore: { + type: 'string', + multiple: true, + }, + 'ignore-path': { + type: 'string', + }, + schema: { + type: 'string', + }, + 'breaking-changes-file': { + type: 'string', + }, + help: { + type: 'boolean', + }, + }, + }); - if (opts.help || !opts._.length) showUsage(); + if (opts.values.help || !opts.positionals.length) return showUsage(); - return opts; + return opts; + } catch { + return showUsage(); + } } async function init() { try { - const opts = parseCommandLine(); + const { values: opts, positionals } = parseCommandLine(); if (!opts.root) { opts.root = '.'; @@ -477,7 +489,7 @@ async function init() { const { historyBlockCounter, documentCounter, errorCounter, warningCounter } = await main( resolve(process.cwd(), opts.root), - opts._, + positionals, { checkPlacement: opts['check-placement'], breakingChangesFile: opts['breaking-changes-file'], @@ -500,7 +512,7 @@ async function init() { } } -if (require.main === module) { +if (process.argv[1] === fileURLToPath(import.meta.url)) { init().catch((error) => { console.error(error); process.exit(1); diff --git a/bin/lint-markdown-links.ts b/bin/lint-markdown-links.ts index 444577f..b804357 100644 --- a/bin/lint-markdown-links.ts +++ b/bin/lint-markdown-links.ts @@ -2,6 +2,8 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { parseArgs } from 'node:util'; import { createLanguageService, @@ -10,11 +12,10 @@ import { ILogger, LogLevel, } from '@dsanders11/vscode-markdown-languageservice'; -import * as minimist from 'minimist'; import { CancellationTokenSource } from 'vscode-languageserver'; import { URI } from 'vscode-uri'; -import { DocsWorkspace, MarkdownLinkComputer, MarkdownParser } from '../lib/markdown'; +import { DocsWorkspace, MarkdownLinkComputer, MarkdownParser } from '../lib/markdown.js'; class NoOpLogger implements ILogger { readonly level = LogLevel.Off; @@ -144,31 +145,50 @@ async function main( } function parseCommandLine() { - const showUsage = (arg?: string): boolean => { - if (!arg || arg.startsWith('-')) { - console.log( - 'Usage: lint-roller-markdown-links [--root ] [-h|--help] [--fetch-external-links] ' + - '[--check-redirects] [--ignore ]', - ); - process.exit(1); - } - - return true; + const showUsage = (): never => { + console.log( + 'Usage: lint-roller-markdown-links [--root ] [-h|--help] [--fetch-external-links] ' + + '[--check-redirects] [--ignore ]', + ); + process.exit(1); }; - const opts = minimist(process.argv.slice(2), { - boolean: ['help', 'fetch-external-links', 'check-redirects'], - string: ['root', 'ignore', 'ignore-path'], - unknown: showUsage, - }); + try { + const opts = parseArgs({ + allowPositionals: true, + options: { + 'fetch-external-links': { + type: 'boolean', + }, + 'check-redirects': { + type: 'boolean', + }, + root: { + type: 'string', + }, + ignore: { + type: 'string', + multiple: true, + }, + 'ignore-path': { + type: 'string', + }, + help: { + type: 'boolean', + }, + }, + }); - if (opts.help || !opts._.length) showUsage(); + if (opts.values.help || !opts.positionals.length) return showUsage(); - return opts; + return opts; + } catch { + return showUsage(); + } } -if (require.main === module) { - const opts = parseCommandLine(); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + const { values: opts, positionals } = parseCommandLine(); if (!opts.root) { opts.root = '.'; @@ -188,7 +208,7 @@ if (require.main === module) { } } - main(path.resolve(process.cwd(), opts.root), opts._, { + main(path.resolve(process.cwd(), opts.root), positionals, { fetchExternalLinks: opts['fetch-external-links'], checkRedirects: opts['check-redirects'], ignoreGlobs: opts.ignore, diff --git a/bin/lint-markdown-standard.ts b/bin/lint-markdown-standard.ts index b064bff..edfa33b 100644 --- a/bin/lint-markdown-standard.ts +++ b/bin/lint-markdown-standard.ts @@ -2,8 +2,8 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; - -import * as minimist from 'minimist'; +import { fileURLToPath } from 'node:url'; +import { parseArgs } from 'node:util'; import { TextDocument, TextEdit, Range } from 'vscode-languageserver-textdocument'; import { URI } from 'vscode-uri'; @@ -12,8 +12,8 @@ import { dynamicImport, removeParensWrappingOrphanedObject, wrapOrphanObjectInParens, -} from '../lib/helpers'; -import { getCodeBlocks, DocsWorkspace } from '../lib/markdown'; +} from '../lib/helpers.js'; +import { getCodeBlocks, DocsWorkspace } from '../lib/markdown.js'; interface Options { fix?: boolean; @@ -167,31 +167,50 @@ async function main( } function parseCommandLine() { - const showUsage = (arg?: string): boolean => { - if (!arg || arg.startsWith('-')) { - console.log( - 'Usage: lint-roller-markdown-standard [--root ] [-h|--help] [--fix]' + - '[--ignore ] [--ignore-path ] [--semi]', - ); - process.exit(1); - } - - return true; + const showUsage = (): never => { + console.log( + 'Usage: lint-roller-markdown-standard [--root ] [-h|--help] [--fix]' + + '[--ignore ] [--ignore-path ] [--semi]', + ); + process.exit(1); }; - const opts = minimist(process.argv.slice(2), { - boolean: ['help', 'fix', 'semi'], - string: ['root', 'ignore', 'ignore-path'], - unknown: showUsage, - }); + try { + const opts = parseArgs({ + allowPositionals: true, + options: { + fix: { + type: 'boolean', + }, + semi: { + type: 'boolean', + }, + root: { + type: 'string', + }, + ignore: { + type: 'string', + multiple: true, + }, + 'ignore-path': { + type: 'string', + }, + help: { + type: 'boolean', + }, + }, + }); - if (opts.help || !opts._.length) showUsage(); + if (opts.values.help || !opts.positionals.length) return showUsage(); - return opts; + return opts; + } catch { + return showUsage(); + } } -if (require.main === module) { - const opts = parseCommandLine(); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + const { values: opts, positionals } = parseCommandLine(); if (!opts.root) { opts.root = '.'; @@ -211,7 +230,7 @@ if (require.main === module) { } } - main(path.resolve(process.cwd(), opts.root), opts._, { + main(path.resolve(process.cwd(), opts.root), positionals, { fix: opts.fix, ignoreGlobs: opts.ignore, semi: opts.semi, diff --git a/bin/lint-markdown-ts-check.ts b/bin/lint-markdown-ts-check.ts index cf00af5..26cc736 100644 --- a/bin/lint-markdown-ts-check.ts +++ b/bin/lint-markdown-ts-check.ts @@ -4,9 +4,9 @@ import * as crypto from 'node:crypto'; import * as fs from 'node:fs'; import * as os from 'node:os'; import * as path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { parseArgs } from 'node:util'; -import * as minimist from 'minimist'; -import { rimraf } from 'rimraf'; import { URI } from 'vscode-uri'; import { @@ -16,8 +16,8 @@ import { spawnAsync, wrapOrphanObjectInParens, LintRollerConfig, -} from '../lib/helpers'; -import { getCodeBlocks, DocsWorkspace } from '../lib/markdown'; +} from '../lib/helpers.js'; +import { getCodeBlocks, DocsWorkspace } from '../lib/markdown.js'; interface Options { config?: LintRollerConfig; @@ -30,7 +30,8 @@ async function typeCheckFiles( filenames: string[], typings: string[], ) { - const tscExec = path.join(require.resolve('typescript'), '..', '..', 'bin', 'tsc'); + const pkgPath = fileURLToPath(import.meta.resolve('typescript')); + const tscExec = path.join(pkgPath, '..', '..', 'bin', 'tsc'); const options = ['--noEmit', '--pretty', '--moduleDetection', 'force']; if (filenames.find((filename) => filename.endsWith('.js'))) { options.push('--checkJs'); @@ -274,36 +275,52 @@ async function main( return errors; } finally { - await rimraf(tempDir); + await fs.promises.rm(tempDir, { force: true, recursive: true }); } } function parseCommandLine() { - const showUsage = (arg?: string): boolean => { - if (!arg || arg.startsWith('-')) { - console.log( - 'Usage: lint-roller-markdown-ts-check [--root ] [-h|--help]' + - '[--ignore ] [--ignore-path ] [--config ]', - ); - process.exit(1); - } - - return true; + const showUsage = (): never => { + console.log( + 'Usage: lint-roller-markdown-ts-check [--root ] [-h|--help]' + + '[--ignore ] [--ignore-path ] [--config ]', + ); + process.exit(1); }; - const opts = minimist(process.argv.slice(2), { - boolean: ['help'], - string: ['config', 'root', 'ignore', 'ignore-path'], - unknown: showUsage, - }); + try { + const opts = parseArgs({ + allowPositionals: true, + options: { + config: { + type: 'string', + }, + root: { + type: 'string', + }, + ignore: { + type: 'string', + multiple: true, + }, + 'ignore-path': { + type: 'string', + }, + help: { + type: 'boolean', + }, + }, + }); - if (opts.help || !opts._.length) showUsage(); + if (opts.values.help || !opts.positionals.length) return showUsage(); - return opts; + return opts; + } catch { + return showUsage(); + } } -if (require.main === module) { - const opts = parseCommandLine(); +if (process.argv[1] === fileURLToPath(import.meta.url)) { + const { values: opts, positionals } = parseCommandLine(); if (!opts.root) { opts.root = '.'; @@ -327,7 +344,7 @@ if (require.main === module) { opts.config ? path.resolve(opts.config) : path.resolve('.lint-roller.json'), ); - main(path.resolve(process.cwd(), opts.root), opts._, { + main(path.resolve(process.cwd(), opts.root), positionals, { config, ignoreGlobs: opts.ignore, }) diff --git a/lib/markdown.ts b/lib/markdown.ts index d1d1910..aba4405 100644 --- a/lib/markdown.ts +++ b/lib/markdown.ts @@ -2,7 +2,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import * as glob from 'glob'; -import * as MarkdownIt from 'markdown-it'; +import MarkdownIt from 'markdown-it'; import { githubSlugifier, resolveInternalDocumentLink, @@ -17,16 +17,14 @@ import { MdLink, MdLinkKind, } from '@dsanders11/vscode-markdown-languageservice'; +import { visit } from 'unist-util-visit'; +import { fromMarkdown } from 'mdast-util-from-markdown'; import { Emitter, Range } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { URI } from 'vscode-uri'; -import { dynamicImport } from './helpers'; - import type { Code, Definition, ImageReference, Link, LinkReference } from 'mdast'; -import type { fromMarkdown as FromMarkdownFunction } from 'mdast-util-from-markdown'; import type { Node, Position } from 'unist'; -import type { visit as VisitFunction } from 'unist-util-visit'; export type { Code }; @@ -186,10 +184,6 @@ export class MarkdownLinkComputer implements IMdLinkComputer { } async getAllLinks(document: ITextDocument): Promise { - const { fromMarkdown } = (await dynamicImport('mdast-util-from-markdown')) as { - fromMarkdown: typeof FromMarkdownFunction; - }; - const tree = fromMarkdown(document.getText()); const links = [ @@ -202,10 +196,6 @@ export class MarkdownLinkComputer implements IMdLinkComputer { } async #getInlineLinks(document: ITextDocument, tree: Node): Promise { - const { visit } = (await dynamicImport('unist-util-visit')) as { - visit: typeof VisitFunction; - }; - const documentUri = URI.parse(document.uri); const links: MdLink[] = []; @@ -246,10 +236,6 @@ export class MarkdownLinkComputer implements IMdLinkComputer { } async #getReferenceLinks(document: ITextDocument, tree: Node): Promise { - const { visit } = (await dynamicImport('unist-util-visit')) as { - visit: typeof VisitFunction; - }; - const links: MdLink[] = []; visit( @@ -287,10 +273,6 @@ export class MarkdownLinkComputer implements IMdLinkComputer { } async #getLinkDefinitions(document: ITextDocument, tree: Node): Promise { - const { visit } = (await dynamicImport('unist-util-visit')) as { - visit: typeof VisitFunction; - }; - const documentUri = URI.parse(document.uri); const links: MdLink[] = []; @@ -336,13 +318,6 @@ export class MarkdownLinkComputer implements IMdLinkComputer { } export async function getCodeBlocks(content: string): Promise { - const { fromMarkdown } = (await dynamicImport('mdast-util-from-markdown')) as { - fromMarkdown: typeof FromMarkdownFunction; - }; - const { visit } = (await dynamicImport('unist-util-visit')) as { - visit: typeof VisitFunction; - }; - const tree = fromMarkdown(content); const codeBlocks: Code[] = []; diff --git a/markdownlint-rules/emd004.js b/markdownlint-rules/emd004.js deleted file mode 100644 index 40947e9..0000000 --- a/markdownlint-rules/emd004.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - names: ['EMD004', 'no-newline-in-links'], - description: 'Newlines inside link text', - tags: ['newline', 'links'], - parser: 'markdownit', - function: function EMD004(params, onError) { - const tokens = params.parsers.markdownit.tokens.filter((token) => token.type === 'inline'); - - for (const token of tokens) { - const { children } = token; - let { lineNumber } = token; - let inLink = false; - for (const child of children) { - const { type } = child; - if (type === 'link_open') { - inLink = true; - } else if (type === 'link_close') { - inLink = false; - } else if (type === 'softbreak') { - if (inLink) { - onError({ lineNumber }); - break; - } else { - lineNumber++; - } - } - } - } - }, -}; diff --git a/markdownlint-rules/emd004.mjs b/markdownlint-rules/emd004.mjs new file mode 100644 index 0000000..36e6896 --- /dev/null +++ b/markdownlint-rules/emd004.mjs @@ -0,0 +1,31 @@ +export const names = ['EMD004', 'no-newline-in-links']; +export const description = 'Newlines inside link text'; +export const tags = ['newline', 'links']; +export const parser = 'markdownit'; + +function EMD004(params, onError) { + const tokens = params.parsers.markdownit.tokens.filter((token) => token.type === 'inline'); + + for (const token of tokens) { + const { children } = token; + let { lineNumber } = token; + let inLink = false; + for (const child of children) { + const { type } = child; + if (type === 'link_open') { + inLink = true; + } else if (type === 'link_close') { + inLink = false; + } else if (type === 'softbreak') { + if (inLink) { + onError({ lineNumber }); + break; + } else { + lineNumber++; + } + } + } + } +} + +export { EMD004 as function }; diff --git a/markdownlint-rules/index.js b/markdownlint-rules/index.js deleted file mode 100644 index 71ef263..0000000 --- a/markdownlint-rules/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const EMD002 = require('./emd002.js'); -const EMD003 = require('./emd003.js'); -const EMD004 = require('./emd004.js'); - -module.exports = [EMD002, EMD003, EMD004]; diff --git a/markdownlint-rules/index.mjs b/markdownlint-rules/index.mjs new file mode 100644 index 0000000..287c2ec --- /dev/null +++ b/markdownlint-rules/index.mjs @@ -0,0 +1,5 @@ +import * as EMD002 from './emd002.mjs'; +import * as EMD003 from './emd003.mjs'; +import * as EMD004 from './emd004.mjs'; + +export default [EMD002, EMD003, EMD004]; diff --git a/package.json b/package.json index a1792a9..2779799 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,9 @@ "name": "@electron/lint-roller", "version": "0.0.0-development", "description": "Markdown linting helpers for Electron org repos", + "type": "module", "engines": { - "node": ">=18.0.0" + "node": ">=20.16.0 || >=22.4.0" }, "bin": { "lint-roller-markdown-links": "./dist/bin/lint-markdown-links.js", @@ -21,9 +22,7 @@ "lib": "lib" }, "scripts": { - "build": "tsc && yarn run build:emd002 && yarn run build:emd003", - "build:emd002": "esbuild --platform=node --target=node18 --format=cjs --bundle --outfile=markdownlint-rules/emd002.js markdownlint-rules/emd002.mjs", - "build:emd003": "esbuild --platform=node --target=node18 --format=cjs --bundle --outfile=markdownlint-rules/emd003.js markdownlint-rules/emd003.mjs", + "build": "tsc", "prepublishOnly": "yarn run build", "lint:eslint": "eslint \"{bin,lib,markdownlint-rules,tests}/**/*.{js,mjs,ts}\"", "lint:eslint:fix": "eslint --fix \"{bin,lib,markdownlint-rules,tests}/**/*.{js,mjs,ts}\"", @@ -49,12 +48,10 @@ }, "devDependencies": { "@electron-internal/eslint-config": "^1.0.1", - "@types/balanced-match": "^1.0.3", + "@types/balanced-match": "^3.0.2", "@types/glob": "^8.1.0", - "@types/markdown-it": "^13.0.6", - "@types/minimist": "^1.2.5", - "@types/node": "20.1.2", - "esbuild": "^0.21.0", + "@types/markdown-it": "^14.1.2", + "@types/node": "22.8.7", "eslint": "^8.54.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-node": "^11.1.0", @@ -66,18 +63,16 @@ "dependencies": { "@dsanders11/vscode-markdown-languageservice": "^0.3.0", "ajv": "^8.16.0", - "balanced-match": "^2.0.0", - "glob": "^8.1.0", + "balanced-match": "^3.0.1", + "glob": "^10.4.5", "hast-util-from-html": "^2.0.1", - "markdown-it": "^13.0.1", + "markdown-it": "^14.1.0", "mdast-util-from-markdown": "^1.3.0", - "minimist": "^1.2.8", - "rimraf": "^4.4.1", "standard": "^17.0.0", "unist-util-visit": "^4.1.2", "vscode-languageserver": "^8.1.0", "vscode-languageserver-textdocument": "^1.0.8", - "vscode-uri": "^3.0.7", + "vscode-uri": "^3.0.8", "yaml": "^2.4.5" }, "peerDependencies": { @@ -87,8 +82,5 @@ "typescript": { "optional": true } - }, - "resolutions": { - "jackspeak": "2.1.1" } } diff --git a/tests/helpers.spec.ts b/tests/helpers.spec.ts index 317826b..da89e32 100644 --- a/tests/helpers.spec.ts +++ b/tests/helpers.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { findCurlyBracedDirectives } from '../lib/helpers'; +import { findCurlyBracedDirectives } from '../lib/helpers.js'; describe('findCurlyBracedDirectives', () => { it('should return an empty array if no matches', () => { diff --git a/tests/lint-roller-markdown-api-history.spec.ts b/tests/lint-roller-markdown-api-history.spec.ts index 3485cde..e3c55c8 100644 --- a/tests/lint-roller-markdown-api-history.spec.ts +++ b/tests/lint-roller-markdown-api-history.spec.ts @@ -501,8 +501,7 @@ describe('lint-roller-markdown-api-history', () => { '--check-placement', '--check-strings', '--check-descriptions', - '--disallow-comments', - 'false', + '--no-disallow-comments', '*.md', ); diff --git a/tests/markdownlint-cli2.spec.ts b/tests/markdownlint-cli2.spec.ts index fe6b054..beacbaf 100644 --- a/tests/markdownlint-cli2.spec.ts +++ b/tests/markdownlint-cli2.spec.ts @@ -18,7 +18,7 @@ async function runMarkdownlint(args: string[], configOptions: Record