diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 8c91c06..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - ecmaVersion: 2020, - }, - env: { - es6: true, - node: true, - jest: true, - }, - plugins: ["github"], - extends: ["plugin:github/recommended"], - rules: { - "import/no-commonjs": "off", - "filenames/match-regex": "off", - "i18n-text/no-en": "off", - }, -}; diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..fca6ebb --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "root": true, + "parserOptions": { + "ecmaVersion": 2020 + }, + "env": { + "es6": true, + "node": true, + "jest": true + }, + "plugins": ["github"], + "extends": ["plugin:github/recommended"], + "rules": { + "filenames/match-regex": "off", + "i18n-text/no-en": "off", + "import/extensions": ["error", { "js": "ignorePackages"}], + "import/no-unresolved": [ + "error", + { + "ignore": ["^markdownlint/.+"] + } + ] + } +} diff --git a/.markdownlint-cli2.cjs b/.markdownlint-cli2.cjs deleted file mode 100644 index ed72624..0000000 --- a/.markdownlint-cli2.cjs +++ /dev/null @@ -1,12 +0,0 @@ -const options = require('./index.js').init({ - "default": false, - "heading-increment": true, - "no-alt-text": true, - "single-h1": true, - "no-emphasis-as-heading": true, - "first-line-heading": true -}) -module.exports = { - config: options, - customRules: ["./index.js"], -} diff --git a/.markdownlint-cli2.mjs b/.markdownlint-cli2.mjs new file mode 100644 index 0000000..f750071 --- /dev/null +++ b/.markdownlint-cli2.mjs @@ -0,0 +1,15 @@ +import { init } from "./index.js"; + +const configOptions = await init({ + default: false, + "heading-increment": true, + "no-alt-text": true, + "single-h1": true, + "no-emphasis-as-heading": true, + "first-line-heading": true, +}); +const options = { + config: configOptions, + customRules: ["./index.js"], +}; +export default options; diff --git a/.nvmrc b/.nvmrc index 8351c19..3c03207 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14 +18 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..132bee3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## 0.2.0 + +* BREAKING change: Convert to ECMAScript modules (ESM) + +## 0.1.0 + +* Initial release diff --git a/README.md b/README.md index e9cc582..ca2a94c 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali **Important**: We support the use of `markdownlint` through [`markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2) instead of `markdownlint-cli` for compatibility with the [`vscode-markdownlint`](https://github.com/DavidAnson/vscode-markdownlint) plugin. -1. Create a `.markdownlint-cli2.cjs` file in the root of your repository. +1. Create a `.markdownlint-cli2.mjs` file in the root of your repository. ```bash - touch .markdownlint-cli2.cjs + touch .markdownlint-cli2.mjs ``` 2. Install packages. @@ -44,36 +44,39 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali } ``` -4. Edit `.markdownlint-cli2.cjs` file to suit your needs. Start with +4. Edit `.markdownlint-cli2.mjs` file to suit your needs. Start with ```js - const options = require('@github/markdownlint-github').init() - module.exports = { - config: options, + import configOptions, {init} from "@github/markdownlint-github" + const options = { + config: init(), customRules: ["@github/markdownlint-github"], outputFormatters: [ [ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation ] } + export default options ``` - Or, you can also pass in configuration options that you wish to override the default. Read more at [Customizing configurations](#customizing-configurations). + Or, you can also pass in configuration options that you wish to override the default. Read more at [Customizing configurations](#customizing-configurations). This looks like: ```js - const options = require('@github/markdownlint-github').init({ + import configOptions, {init} from "@github/markdownlint-github" + const overriddenOptions = init({ 'fenced-code-language': false, // Custom overrides }) - module.exports = { - config: options, + const options = { + config: overriddenOptions, customRules: ["@github/markdownlint-github"], outputFormatters: [ [ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] ] } + export default options ``` -5. Install the [`vscode-markdownlint`](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) plugin to ensure `markdownlint` violations are surfaced in the file. This plugin should flag rules based off your `.markdownlint-cli2.cjs` configuration. When you make edits to your configuration, you will need to reload the VSCode window (`Ctrl+Shift+P` -> `Reload Window`) to ensure the extension syncs. If your project runs on Codespaces, consider adding this extension to your `.devcontainer/devcontainer.json` so that this extension is installed to new Codespaces by default. +5. Install the [`vscode-markdownlint`](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) plugin to ensure `markdownlint` violations are surfaced in the file. This plugin should flag rules based off your `.markdownlint-cli2.mjs` configuration. When you make edits to your configuration, you will need to reload the VSCode window (`Ctrl+Shift+P` -> `Reload Window`) to ensure the extension syncs. If your project runs on Codespaces, consider adding this extension to your `.devcontainer/devcontainer.json` so that this extension is installed to new Codespaces by default. ### Customizing configurations @@ -89,13 +92,15 @@ To review configurations supported by `markdownlint`, see [`markdownlint-cli2` c You may write custom rules within your repository. Follow the [custom rules guide in `markdownlint`](https://github.com/DavidAnson/markdownlint/blob/main/doc/CustomRules.md) to write your rule. -The rule will need to be enabled in the configuration. For instance, if you introduce `some-rule.js` with the name "some-rule", you must set the path of the custom rule in the `.markdownlint-cli2.cjs` file: +The rule will need to be enabled in the configuration. For instance, if you introduce `some-rule.js` with the name "some-rule", you must set the path of the custom rule in the `.markdownlint-cli2.mjs` file: ```js -module.exports = require('@github/markdownlint-github').init({ +import configOptions, {init} from "@github/markdownlint-github" +const options = init({ "some-rule": true, customRules: ["@github/markdownlint-github", "some-rule.js"], }) +export default options ``` See [`markdownlint-cli2` configuration](https://github.com/DavidAnson/markdownlint-cli2#configuration). @@ -104,7 +109,8 @@ Consider upstreaming any rules you find useful as proposals to this repository. ## License -This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE.txt) for the full terms. +This project is licensed under the terms of the MIT open source license. Please +refer to [the MIT license](./LICENSE.txt) for the full terms. ## Maintainers diff --git a/index.js b/index.js index 06ba60c..8983146 100644 --- a/index.js +++ b/index.js @@ -1,19 +1,25 @@ -const _ = require("lodash"); +import { readFile } from "fs/promises"; +import _ from "lodash-es"; +import { githubMarkdownLint } from "./src/rules/index.js"; -const accessibilityRules = require("./style/accessibility.json"); -const base = require("./style/base.json"); -const gitHubCustomRules = require("./src/rules/index").rules; +const offByDefault = ["no-empty-alt-text"]; -module.exports = [...gitHubCustomRules]; +export async function init(consumerConfig) { + // left overwrites right + const accessibilityRules = JSON.parse( + await readFile(new URL("./style/accessibility.json", import.meta.url)), + ); -const offByDefault = ["no-empty-alt-text"]; + const base = JSON.parse( + await readFile(new URL("./style/base.json", import.meta.url)), + ); -for (const rule of gitHubCustomRules) { - const ruleName = rule.names[1]; - base[ruleName] = offByDefault.includes(ruleName) ? false : true; -} + for (const rule of githubMarkdownLint) { + const ruleName = rule.names[1]; + base[ruleName] = offByDefault.includes(ruleName) ? false : true; + } -module.exports.init = function init(consumerConfig) { - // left overwrites right return _.defaultsDeep(consumerConfig, accessibilityRules, base); -}; +} + +export default githubMarkdownLint; diff --git a/jest.config.json b/jest.config.json new file mode 100644 index 0000000..955c0ac --- /dev/null +++ b/jest.config.json @@ -0,0 +1,4 @@ +{ + "transform": { + } +} diff --git a/package-lock.json b/package-lock.json index 1adbe4f..a0c6be4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,25 @@ { "name": "@github/markdownlint-github", - "version": "0.1.0", - "lockfileVersion": 2, + "version": "0.2.0", + "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github/markdownlint-github", - "version": "0.1.0", + "version": "0.2.0", "license": "ISC", "dependencies": { - "lodash": "^4.17.15" + "lodash-es": "^4.17.15" }, "devDependencies": { "eslint": "^8.22.0", "eslint-plugin-github": "^5.0.1", "jest": "^29.5.0", - "markdownlint": "^0.36.1", + "markdownlint": "^0.37.3", "markdownlint-cli2": "^0.17.1" + }, + "engines": { + "node": ">=18" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -2849,9 +2852,9 @@ } }, "node_modules/eslint-plugin-github": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-5.1.5.tgz", - "integrity": "sha512-vRgIVJ88FfESAGGYsJlf7SQhQlFEJaa7/I9z/5K5vKbWEQ3DnRkg8cvoj8LZA30MFb2uW1SltOcEj+Q8UR8LxA==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-5.1.4.tgz", + "integrity": "sha512-j5IgIxsDoch06zJzeqPvenfzRXDKI9Z8YwfUg1pm2ay1q44tMSFwvEu6l0uEIrTpA3v8QdPyLr98LqDl1TIhSA==", "dev": true, "dependencies": { "@eslint/compat": "^1.2.3", @@ -3428,20 +3431,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -4986,10 +4975,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { + "node_modules/lodash-es": { "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "license": "MIT" }, "node_modules/lodash.camelcase": { "version": "4.3.0", @@ -5063,13 +5053,20 @@ } }, "node_modules/markdownlint": { - "version": "0.36.1", - "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.36.1.tgz", - "integrity": "sha512-s73fU2CQN7WCgjhaQUQ8wYESQNzGRNOKDd+3xgVqu8kuTEhmwepd/mxOv1LR2oV046ONrTLBFsM7IoKWNvmy5g==", + "version": "0.37.3", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.37.3.tgz", + "integrity": "sha512-eoQqH0291YCCjd+Pe1PUQ9AmWthlVmS0XWgcionkZ8q34ceZyRI+pYvsWksXJJL8OBkWCPwp1h/pnXxrPFC4oA==", "dev": true, "dependencies": { "markdown-it": "14.1.0", - "markdownlint-micromark": "0.1.12" + "micromark": "4.0.1", + "micromark-core-commonmark": "2.0.2", + "micromark-extension-directive": "3.0.2", + "micromark-extension-gfm-autolink-literal": "2.1.0", + "micromark-extension-gfm-footnote": "2.1.0", + "micromark-extension-gfm-table": "2.1.0", + "micromark-extension-math": "3.1.0", + "micromark-util-types": "2.0.1" }, "engines": { "node": ">=18" @@ -5083,6 +5080,7 @@ "resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.17.2.tgz", "integrity": "sha512-XH06ZOi8wCrtOSSj3p8y3yJzwgzYOSa7lglNyS3fP05JPRzRGyjauBb5UvlLUSCGysMmULS1moxdRHHudV+g/Q==", "dev": true, + "license": "MIT", "dependencies": { "globby": "14.0.2", "js-yaml": "4.1.0", @@ -5180,18 +5178,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/markdownlint-micromark": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.12.tgz", - "integrity": "sha512-RlB6EwMGgc0sxcIhOQ2+aq7Zw1V2fBnzbXKGgYK/mVWdT7cz34fteKSwfYeo4rL6+L/q2tyC9QtD/PgZbkdyJQ==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/DavidAnson" - } - }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", diff --git a/package.json b/package.json index 9d16274..ee1c7e6 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,29 @@ { "name": "@github/markdownlint-github", - "version": "0.1.0", + "version": "0.2.0", "description": "An opinionated collection of markdownlint rules used by GitHub.", - "main": "index.js", + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=18" + }, "directories": { "test": "test" }, "scripts": { "publish": "npm publish --access public --@github:registry=https://registry.npmjs.org", - "test": "npm run lint && jest", + "test": "npm run lint && NODE_OPTIONS=--experimental-vm-modules jest", "lint": "markdownlint-cli2 \"**/*.{md,mdx}\" \"!node_modules\" \"!docs/rules\" \"!test/example.md\" && eslint .", "lint:fix": "npm run lint -- --fix" }, "dependencies": { - "lodash": "^4.17.15" + "lodash-es": "^4.17.15" }, "devDependencies": { "eslint": "^8.22.0", "eslint-plugin-github": "^5.0.1", "jest": "^29.5.0", - "markdownlint": "^0.36.1", + "markdownlint": "^0.37.3", "markdownlint-cli2": "^0.17.1" }, "repository": { diff --git a/src/helpers/strip-and-downcase-text.js b/src/helpers/strip-and-downcase-text.js index af5c238..fb53fcc 100644 --- a/src/helpers/strip-and-downcase-text.js +++ b/src/helpers/strip-and-downcase-text.js @@ -1,10 +1,8 @@ /* Downcase and strip extra whitespaces and punctuation */ -function stripAndDowncaseText(text) { +export function stripAndDowncaseText(text) { return text .toLowerCase() .replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "") .replace(/\s+/g, " ") .trim(); } - -module.exports = { stripAndDowncaseText }; diff --git a/src/rules/index.js b/src/rules/index.js index 08fd9e6..0def82c 100644 --- a/src/rules/index.js +++ b/src/rules/index.js @@ -1,7 +1,9 @@ -module.exports = { - rules: [ - require("./no-default-alt-text"), - require("./no-generic-link-text"), - require("./no-empty-alt-text"), - ], -}; +import { noEmptyStringAltRule } from "./no-empty-alt-text.js"; +import { noGenericLinkTextRule } from "./no-generic-link-text.js"; +import { altTextRule } from "./no-default-alt-text.js"; + +export const githubMarkdownLint = [ + altTextRule, + noGenericLinkTextRule, + noEmptyStringAltRule, +]; diff --git a/src/rules/no-default-alt-text.js b/src/rules/no-default-alt-text.js index e91a9ef..5135057 100644 --- a/src/rules/no-default-alt-text.js +++ b/src/rules/no-default-alt-text.js @@ -14,7 +14,7 @@ const combinedRegex = `(${[defaultScreenshotRegex, imageRegex].join("|")})`; const markdownAltRegex = new RegExp(`!\\[${combinedRegex}\\]\\(.*\\)`, "gid"); const htmlAltRegex = new RegExp(`alt=["']${combinedRegex}["']`, "gid"); -module.exports = { +export const altTextRule = { names: ["GH001", "no-default-alt-text"], description: "Images should have meaningful alternative text (alt text)", information: new URL( diff --git a/src/rules/no-empty-alt-text.js b/src/rules/no-empty-alt-text.js index 85ad2e7..e796057 100644 --- a/src/rules/no-empty-alt-text.js +++ b/src/rules/no-empty-alt-text.js @@ -1,4 +1,4 @@ -module.exports = { +export const noEmptyStringAltRule = { names: ["GH003", "no-empty-alt-text"], description: "Please provide an alternative text for the image.", information: new URL( diff --git a/src/rules/no-generic-link-text.js b/src/rules/no-generic-link-text.js index 5e36c2e..c602459 100644 --- a/src/rules/no-generic-link-text.js +++ b/src/rules/no-generic-link-text.js @@ -1,4 +1,4 @@ -const { stripAndDowncaseText } = require("../helpers/strip-and-downcase-text"); +import { stripAndDowncaseText } from "../helpers/strip-and-downcase-text.js"; const bannedLinkText = [ "read more", @@ -9,7 +9,7 @@ const bannedLinkText = [ "link", ]; -module.exports = { +export const noGenericLinkTextRule = { names: ["GH002", "no-generic-link-text"], description: "Avoid using generic link text like `Learn more` or `Click here`", diff --git a/test/accessibility-rules.test.js b/test/accessibility-rules.test.js index e41e7bf..8fc6548 100644 --- a/test/accessibility-rules.test.js +++ b/test/accessibility-rules.test.js @@ -1,21 +1,25 @@ -const markdownlint = require("markdownlint"); -const accessibilityRulesConfig = require("../style/accessibility.json"); -const accessibilityRules = require(".."); +import { readFile } from "fs/promises"; +import { lint } from "markdownlint/async"; +import githubMarkdownLint from "../index.js"; const exampleFileName = "./test/example.md"; -const options = { - config: { - default: false, - ...accessibilityRulesConfig, - }, - files: [exampleFileName], - customRules: accessibilityRules, -}; describe("when A11y rules applied", () => { test("fails expected rules", async () => { + const accessibilityRules = JSON.parse( + await readFile(new URL("../style/accessibility.json", import.meta.url)), + ); + const options = { + config: { + default: false, + ...accessibilityRules, + }, + files: [exampleFileName], + customRules: githubMarkdownLint, + }; + const result = await new Promise((resolve, reject) => { - markdownlint(options, (err, res) => { + lint(options, (err, res) => { if (err) reject(err); resolve(res); }); diff --git a/test/no-default-alt-text.test.js b/test/no-default-alt-text.test.js index 04fc9fd..dfb39c9 100644 --- a/test/no-default-alt-text.test.js +++ b/test/no-default-alt-text.test.js @@ -1,5 +1,5 @@ -const altTextRule = require("../src/rules/no-default-alt-text"); -const runTest = require("./utils/run-test").runTest; +import { altTextRule } from "../src/rules/no-default-alt-text"; +import { runTest } from "./utils/run-test"; describe("GH001: No Default Alt Text", () => { describe("successes", () => { diff --git a/test/no-empty-alt-text.test.js b/test/no-empty-alt-text.test.js index 180594a..1ce1ee3 100644 --- a/test/no-empty-alt-text.test.js +++ b/test/no-empty-alt-text.test.js @@ -1,5 +1,5 @@ -const noEmptyStringAltRule = require("../src/rules/no-empty-alt-text"); -const runTest = require("./utils/run-test").runTest; +import { noEmptyStringAltRule } from "../src/rules/no-empty-alt-text"; +import { runTest } from "./utils/run-test"; describe("GH003: No Empty Alt Text", () => { describe("successes", () => { diff --git a/test/no-generic-link-text.test.js b/test/no-generic-link-text.test.js index ac11941..1c8ffc7 100644 --- a/test/no-generic-link-text.test.js +++ b/test/no-generic-link-text.test.js @@ -1,5 +1,5 @@ -const noGenericLinkTextRule = require("../src/rules/no-generic-link-text"); -const runTest = require("./utils/run-test").runTest; +import { noGenericLinkTextRule } from "../src/rules/no-generic-link-text"; +import { runTest } from "./utils/run-test"; describe("GH002: No Generic Link Text", () => { describe("successes", () => { diff --git a/test/strip-and-downcase-text.test.js b/test/strip-and-downcase-text.test.js index 9357a3c..3766f17 100644 --- a/test/strip-and-downcase-text.test.js +++ b/test/strip-and-downcase-text.test.js @@ -1,6 +1,4 @@ -const { - stripAndDowncaseText, -} = require("../src/helpers/strip-and-downcase-text"); +import { stripAndDowncaseText } from "../src/helpers/strip-and-downcase-text"; describe("stripAndDowncaseText", () => { test("strips extra whitespace", () => { diff --git a/test/usage.test.js b/test/usage.test.js index 234effe..db7de0a 100644 --- a/test/usage.test.js +++ b/test/usage.test.js @@ -1,4 +1,5 @@ -const githubMarkdownLint = require("../index"); +import { init } from "../index.js"; +import { githubMarkdownLint } from "../src/rules/index.js"; describe("usage", () => { describe("default export", () => { @@ -12,8 +13,8 @@ describe("usage", () => { }); }); describe("init method", () => { - test("default options returned with no arguments provided", () => { - const options = githubMarkdownLint.init(); + test("default options returned with no arguments provided", async () => { + const options = await init(); expect(options).toEqual({ "no-duplicate-heading": true, "ol-prefix": "ordered", @@ -36,8 +37,8 @@ describe("usage", () => { }); }); - test("arguments override default configuration", () => { - const defaultOptions = githubMarkdownLint.init(); + test("arguments override default configuration", async () => { + const defaultOptions = await init(); const toTestOptions = Object.keys(defaultOptions).slice(0, 3); @@ -52,7 +53,7 @@ describe("usage", () => { expect(originalConfig).not.toEqual(consumerConfig); // do config step - const options = githubMarkdownLint.init(consumerConfig); + const options = await init(consumerConfig); // confirm config is set by consumer expect(options).toHaveProperty( diff --git a/test/utils/run-test.js b/test/utils/run-test.js index b3a6aa1..c9f4be6 100644 --- a/test/utils/run-test.js +++ b/test/utils/run-test.js @@ -1,6 +1,6 @@ -const markdownlint = require("markdownlint"); +import { lint } from "markdownlint/async"; -async function runTest(strings, rule, ruleConfig) { +export async function runTest(strings, rule, ruleConfig) { const thisRuleName = rule.names[1]; const config = { @@ -19,7 +19,7 @@ async function runTest(strings, rule, ruleConfig) { }; return new Promise((resolve, reject) => { - markdownlint(thisTestConfig, (err, result) => { + lint(thisTestConfig, (err, result) => { if (err) reject(err); resolve(result[0]); }); @@ -29,5 +29,3 @@ async function runTest(strings, rule, ruleConfig) { return results.flat(); } - -exports.runTest = runTest;