diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f5f8755..2d4293e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ macos-latest, ubuntu-latest, windows-latest ] - node-version: [ 18, 20, 22 ] + node-version: [ 18, 20, 22, 23 ] steps: - uses: actions/checkout@v4 diff --git a/.npmrc b/.npmrc index 3757b304..68353c60 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,3 @@ +engine-strict=true ignore-scripts=true package-lock=false diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index a89e42df..9df01f4a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -4,18 +4,18 @@ entry: markdownlint-cli2 language: node types: [markdown] - minimum_pre_commit_version: 0.15.0 + minimum_pre_commit_version: 0.16.0 - id: markdownlint-cli2-docker name: markdownlint-cli2-docker description: "Checks the style of Markdown/CommonMark files." entry: davidanson/markdownlint-cli2 language: docker_image types: [markdown] - minimum_pre_commit_version: 0.15.0 + minimum_pre_commit_version: 0.16.0 - id: markdownlint-cli2-rules-docker name: markdownlint-cli2-rules-docker description: "Checks the style of Markdown/CommonMark files." entry: davidanson/markdownlint-cli2-rules language: docker_image types: [markdown] - minimum_pre_commit_version: 0.15.0 + minimum_pre_commit_version: 0.16.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 46eeb0e5..a33dafe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.16.0 + +- Try not to use require for modules (due to Node 22.12) +- Update dependencies (EXcluding `markdownlint`) + ## 0.15.0 - Add support for `stdin` input via `-` glob diff --git a/README.md b/README.md index 35e43fec..9d4d97bd 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ A container image [`davidanson/markdownlint-cli2`][docker-hub-markdownlint-cli2] can also be used (e.g., as part of a CI pipeline): ```bash -docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.15.0 "**/*.md" "#node_modules" +docker run -v $PWD:/workdir davidanson/markdownlint-cli2:v0.16.0 "**/*.md" "#node_modules" ``` Notes: @@ -166,7 +166,7 @@ Notes: - A custom working directory can be specified with Docker's `-w` flag: ```bash - docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.15.0 "**/*.md" "#node_modules" + docker run -w /myfolder -v $PWD:/myfolder davidanson/markdownlint-cli2:v0.16.0 "**/*.md" "#node_modules" ``` For convenience, the container image @@ -413,7 +413,7 @@ reference to the `repos` list in that project's `.pre-commit-config.yaml` like: ```yaml - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.15.0 + rev: v0.16.0 hooks: - id: markdownlint-cli2 ``` diff --git a/markdownlint-cli2.js b/markdownlint-cli2.js index 2ae120d6..83685309 100755 --- a/markdownlint-cli2.js +++ b/markdownlint-cli2.js @@ -30,7 +30,7 @@ const resolveAndRequire = require("./resolve-and-require"); // Variables const packageName = "markdownlint-cli2"; -const packageVersion = "0.15.0"; +const packageVersion = "0.16.0"; const libraryName = "markdownlint"; const libraryVersion = getLibraryVersion(); const bannerMessage = `${packageName} v${packageVersion} (${libraryName} v${libraryVersion})`; @@ -97,11 +97,18 @@ const importOrRequireResolve = async (dirOrDirs, id, noRequire) => { const dirs = Array.isArray(dirOrDirs) ? dirOrDirs : [ dirOrDirs ]; const expandId = expandTildePath(id); const errors = []; + // Try to load via require(...) try { - return resolveAndRequire(dynamicRequire, expandId, dirs); + const isModule = /\.mjs$/iu.test(expandId); + if (!isModule) { + // Try not to use require for modules due to breaking change in Node 22.12: + // https://github.com/nodejs/node/releases/tag/v22.12.0 + return resolveAndRequire(dynamicRequire, expandId, dirs); + } } catch (error) { errors.push(error); } + // Try to load via import(...) try { // eslint-disable-next-line n/no-unsupported-features/node-builtins const isURL = !pathDefault.isAbsolute(expandId) && URL.canParse(expandId); @@ -114,6 +121,7 @@ const importOrRequireResolve = async (dirOrDirs, id, noRequire) => { } catch (error) { errors.push(error); } + // Give up throw new AggregateError( errors, `Unable to require or import module '${id}'.` diff --git a/package.json b/package.json index 4e0ae1e0..aba2cd01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "markdownlint-cli2", - "version": "0.15.0", + "version": "0.16.0", "description": "A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library", "author": { "name": "David Anson", @@ -35,9 +35,9 @@ "lint-dockerfile": "docker run --rm -i hadolint/hadolint:latest-alpine < docker/Dockerfile", "lint-watch": "git ls-files | entr npm run lint", "playwright-install-bare": "npm run playwright-install-npm && playwright install", - "playwright-install-npm": "npm install --no-save playwright@1.48.2", + "playwright-install-npm": "npm install --no-save playwright@1.49.0", "playwright-test": "playwright test --config ./webworker/playwright.config.mjs", - "playwright-test-docker": "docker run --rm --volume $PWD:/home/workdir --workdir /home/workdir --ipc=host mcr.microsoft.com/playwright:v1.48.2 npm run playwright-test", + "playwright-test-docker": "docker run --rm --volume $PWD:/home/workdir --workdir /home/workdir --ipc=host mcr.microsoft.com/playwright:v1.49.0 npm run playwright-test", "schema": "cpy ./node_modules/markdownlint/schema/markdownlint-config-schema.json ./schema --flat", "test": "ava --timeout=1m test/append-to-array-test.js test/fs-mock-test.js test/fs-virtual-test.js test/markdownlint-cli2-test.js test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-exports.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js test/merge-options-test.js test/resolve-and-require-test.js", "test-cover": "c8 --100 npm test", @@ -80,20 +80,20 @@ "micromatch": "4.0.8" }, "devDependencies": { - "@eslint/js": "9.14.0", + "@eslint/js": "9.16.0", "@iktakahiro/markdown-it-katex": "4.0.1", - "@playwright/test": "1.48.2", - "@stylistic/eslint-plugin": "2.10.1", + "@playwright/test": "1.49.0", + "@stylistic/eslint-plugin": "2.11.0", "ajv": "8.17.1", "ava": "6.2.0", "c8": "10.1.2", "cpy": "11.1.0", "cpy-cli": "5.0.0", "del": "8.0.0", - "eslint": "9.14.0", - "eslint-plugin-jsdoc": "50.4.3", - "eslint-plugin-n": "17.13.1", - "eslint-plugin-unicorn": "56.0.0", + "eslint": "9.16.0", + "eslint-plugin-jsdoc": "50.6.0", + "eslint-plugin-n": "17.14.0", + "eslint-plugin-unicorn": "56.0.1", "nano-spawn": "0.2.0", "markdown-it-emoji": "3.0.0", "markdown-it-for-inline": "2.0.1", diff --git a/schema/markdownlint-cli2-config-schema.json b/schema/markdownlint-cli2-config-schema.json index b6737449..8807180a 100644 --- a/schema/markdownlint-cli2-config-schema.json +++ b/schema/markdownlint-cli2-config-schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.15.0/schema/markdownlint-cli2-config-schema.json", + "$id": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.16.0/schema/markdownlint-cli2-config-schema.json", "title": "markdownlint-cli2 configuration schema", "type": "object", "properties": { "$schema": { "description": "JSON Schema URI (expected by some editors)", "type": "string", - "default": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.15.0/schema/markdownlint-cli2-config-schema.json" + "default": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/v0.16.0/schema/markdownlint-cli2-config-schema.json" }, "config": { "description": "markdownlint configuration schema : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/schema/.markdownlint.jsonc", @@ -15,7 +15,7 @@ "default": {} }, "customRules": { - "description": "Module names or paths of custom rules to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Module names or paths of custom rules to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "array", "default": [], "items": { @@ -25,18 +25,18 @@ } }, "fix": { - "description": "Whether to enable fixing of linting errors reported by rules that emit fix information : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Whether to enable fixing of linting errors reported by rules that emit fix information : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "boolean", "default": false }, "frontMatter": { - "description": "Regular expression used to match and ignore any front matter at the beginning of a document : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Regular expression used to match and ignore any front matter at the beginning of a document : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "string", "minLength": 1, "default": "" }, "gitignore": { - "description": "Whether to ignore files referenced by .gitignore (or glob expression) (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Whether to ignore files referenced by .gitignore (or glob expression) (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": [ "boolean", "string" @@ -44,7 +44,7 @@ "default": false }, "globs": { - "description": "Glob expressions to include when linting (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Glob expressions to include when linting (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "array", "default": [], "items": { @@ -54,7 +54,7 @@ } }, "ignores": { - "description": "Glob expressions to ignore when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Glob expressions to ignore when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "array", "default": [], "items": { @@ -64,7 +64,7 @@ } }, "markdownItPlugins": { - "description": "markdown-it plugins to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "markdown-it plugins to load and use when linting : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "array", "default": [], "items": { @@ -84,7 +84,7 @@ } }, "modulePaths": { - "description": "Additional paths to resolve module locations from : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Additional paths to resolve module locations from : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "array", "default": [], "items": { @@ -94,22 +94,22 @@ } }, "noBanner": { - "description": "Whether to disable the display of the banner message and version numbers on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Whether to disable the display of the banner message and version numbers on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "boolean", "default": false }, "noInlineConfig": { - "description": "Whether to disable support of HTML comments within Markdown content : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Whether to disable support of HTML comments within Markdown content : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "boolean", "default": false }, "noProgress": { - "description": "Whether to disable the display of progress on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Whether to disable the display of progress on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "boolean", "default": false }, "outputFormatters": { - "description": "Output formatters to load and use to customize markdownlint-cli2 output (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Output formatters to load and use to customize markdownlint-cli2 output (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "array", "default": [], "items": { @@ -129,7 +129,7 @@ } }, "showFound": { - "description": "Whether to show the list of found files on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.15.0/README.md#markdownlint-cli2jsonc", + "description": "Whether to show the list of found files on stdout (only valid at the root) : https://github.com/DavidAnson/markdownlint-cli2/blob/v0.16.0/README.md#markdownlint-cli2jsonc", "type": "boolean", "default": false }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: