diff --git a/.babelrc.json b/.babelrc.json index 68ca053f..6ca99f28 100644 --- a/.babelrc.json +++ b/.babelrc.json @@ -8,7 +8,7 @@ "@babel/preset-env", { "targets": { - "node": 16 + "node": 20 } } ] diff --git a/.github/workflows/feature.yaml b/.github/workflows/feature.yaml index d8e7b583..a58769f3 100644 --- a/.github/workflows/feature.yaml +++ b/.github/workflows/feature.yaml @@ -13,7 +13,7 @@ jobs: - name: setup node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '20.11.0' - run: pnpm install - run: pnpm build - run: pnpm lint @@ -40,8 +40,7 @@ jobs: fail-fast: false matrix: node_js_version: - - '18' - - '20' + - '20.11.0' - '22' build: runs-on: ubuntu-latest @@ -57,7 +56,7 @@ jobs: - name: setup node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '20.11.0' - run: pnpm install - run: pnpm build timeout-minutes: 10 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f10c5484..3ff1fc0f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -14,7 +14,7 @@ jobs: - name: setup node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "22" - run: pnpm install - run: pnpm build - run: npx semantic-release diff --git a/.ncurc.cjs b/.ncurc.cjs index 3bc05ea2..57437fa6 100644 --- a/.ncurc.cjs +++ b/.ncurc.cjs @@ -4,12 +4,5 @@ module.exports = { reject: [ // Todo: When our package converted to ESM only 'escape-string-regexp', - - // todo[engine:node@>=20]: Can reenable - 'are-docs-informative', - // todo[engine:node@>=20]: Can reenable - 'glob', - // todo[engine:node@>=20]: Can reenable - 'rimraf', ], }; diff --git a/package.json b/package.json index 81616c7c..61eb1cc5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "dependencies": { "@es-joy/jsdoccomment": "~0.50.2", - "are-docs-informative": "^0.0.2", + "are-docs-informative": "^0.1.0", "comment-parser": "1.4.1", "debug": "^4.4.1", "escape-string-regexp": "^4.0.0", @@ -55,7 +55,7 @@ "eslint": "9.28.0", "eslint-config-canonical": "~44.9.5", "gitdown": "^4.1.1", - "glob": "^10.4.2", + "glob": "^11.0.2", "globals": "^16.2.0", "husky": "^9.1.7", "jsdoc-type-pratt-parser": "^4.1.0", @@ -65,13 +65,13 @@ "mocha": "^11.5.0", "open-editor": "^5.1.0", "replace": "^1.2.2", - "rimraf": "^5.0.7", + "rimraf": "^6.0.1", "semantic-release": "^24.2.5", "typescript": "5.8.3", "typescript-eslint": "^8.33.0" }, "engines": { - "node": ">=18" + "node": ">=20.11.0" }, "keywords": [ "eslint", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bbb04e49..a0a1f9ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ~0.50.2 version: 0.50.2 are-docs-informative: - specifier: ^0.0.2 - version: 0.0.2 + specifier: ^0.1.0 + version: 0.1.0 comment-parser: specifier: 1.4.1 version: 1.4.1 @@ -151,8 +151,8 @@ importers: specifier: ^4.1.1 version: 4.1.1(re2@1.20.9) glob: - specifier: ^10.4.2 - version: 10.4.2 + specifier: ^11.0.2 + version: 11.0.2 globals: specifier: ^16.2.0 version: 16.2.0 @@ -181,8 +181,8 @@ importers: specifier: ^1.2.2 version: 1.2.2 rimraf: - specifier: ^5.0.7 - version: 5.0.7 + specifier: ^6.0.1 + version: 6.0.1 semantic-release: specifier: ^24.2.5 version: 24.2.5(typescript@5.8.3) @@ -1625,6 +1625,10 @@ packages: resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} engines: {node: '>=14'} + are-docs-informative@0.1.0: + resolution: {integrity: sha512-CplVvB5za1z5Zn528h0EUogt/McTT7lvHZKFtb2NYldodL7G3u2O49Mgws3mP/TrKhpNuDjKPHYxmh8t2DGTtQ==} + engines: {node: '>=18'} + argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} @@ -3031,15 +3035,15 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@10.4.2: - resolution: {integrity: sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==} - engines: {node: '>=16 || 14 >=14.18'} - hasBin: true - glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@11.0.2: + resolution: {integrity: sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -3634,6 +3638,10 @@ packages: resolution: {integrity: sha512-kWmLKn2tRtfYMF/BakihVVRzBKOxz4gJMiL2Rj91WnAB5TPZumSH99R/Yf1qE1u4uRimvCSJfm6hnxohXeEXjQ==} engines: {node: '>=14'} + jackspeak@4.1.1: + resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==} + engines: {node: 20 || >=22} + java-properties@1.0.2: resolution: {integrity: sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==} engines: {node: '>= 0.6.0'} @@ -3851,6 +3859,10 @@ packages: resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} + lru-cache@11.1.0: + resolution: {integrity: sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==} + engines: {node: 20 || >=22} + lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} @@ -3941,6 +3953,10 @@ packages: resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} engines: {node: '>=4'} + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@3.0.5: resolution: {integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==} @@ -4392,6 +4408,10 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} + path-scurry@2.0.0: + resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} + engines: {node: 20 || >=22} + path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -4695,9 +4715,9 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true - rimraf@5.0.7: - resolution: {integrity: sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==} - engines: {node: '>=14.18'} + rimraf@6.0.1: + resolution: {integrity: sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==} + engines: {node: 20 || >=22} hasBin: true roarr@7.21.1: @@ -7366,6 +7386,8 @@ snapshots: are-docs-informative@0.0.2: {} + are-docs-informative@0.1.0: {} + argparse@1.0.10: dependencies: sprintf-js: 1.0.3 @@ -8509,7 +8531,7 @@ snapshots: eslint: 9.28.0(jiti@2.4.2) eslint-import-context: 0.1.6(unrs-resolver@1.7.8) is-glob: 4.0.3 - minimatch: 9.0.5 + minimatch: 10.0.1 semver: 7.7.2 stable-hash: 0.0.5 unrs-resolver: 1.7.8 @@ -9217,7 +9239,7 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@10.4.2: + glob@10.4.5: dependencies: foreground-child: 3.1.1 jackspeak: 3.1.2 @@ -9226,14 +9248,14 @@ snapshots: package-json-from-dist: 1.0.0 path-scurry: 1.11.1 - glob@10.4.5: + glob@11.0.2: dependencies: foreground-child: 3.1.1 - jackspeak: 3.1.2 - minimatch: 9.0.4 + jackspeak: 4.1.1 + minimatch: 10.0.1 minipass: 7.1.2 package-json-from-dist: 1.0.0 - path-scurry: 1.11.1 + path-scurry: 2.0.0 glob@7.2.3: dependencies: @@ -9815,6 +9837,10 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jackspeak@4.1.1: + dependencies: + '@isaacs/cliui': 8.0.2 + java-properties@1.0.2: {} jiti@2.4.2: {} @@ -10036,6 +10062,8 @@ snapshots: lru-cache@10.2.0: {} + lru-cache@11.1.0: {} + lru-cache@5.1.1: dependencies: yallist: 3.1.1 @@ -10119,6 +10147,10 @@ snapshots: min-indent@1.0.1: {} + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.1 + minimatch@3.0.5: dependencies: brace-expansion: 1.1.11 @@ -10537,6 +10569,11 @@ snapshots: lru-cache: 10.2.0 minipass: 7.1.2 + path-scurry@2.0.0: + dependencies: + lru-cache: 11.1.0 + minipass: 7.1.2 + path-type@4.0.0: {} path-type@5.0.0: {} @@ -10853,9 +10890,10 @@ snapshots: dependencies: glob: 7.2.3 - rimraf@5.0.7: + rimraf@6.0.1: dependencies: - glob: 10.4.2 + glob: 11.0.2 + package-json-from-dist: 1.0.0 roarr@7.21.1: dependencies: diff --git a/src/bin/generateDocs.js b/src/bin/generateDocs.js index 1e0df84b..b7c14caf 100644 --- a/src/bin/generateDocs.js +++ b/src/bin/generateDocs.js @@ -7,14 +7,9 @@ import { /** * This script is used to inline assertions into the README.md documents. */ -import path, { - dirname as getDirname, -} from 'path'; -import { - fileURLToPath, -} from 'url'; +import path from 'path'; -const dirname = getDirname(fileURLToPath(import.meta.url)); +const dirname = import.meta.dirname; /** * @param {string} code diff --git a/src/bin/generateRule.js b/src/bin/generateRule.js index 3de87b40..1f402a18 100644 --- a/src/bin/generateRule.js +++ b/src/bin/generateRule.js @@ -5,6 +5,7 @@ import { existsSync, } from 'fs'; import fs from 'fs/promises'; +// Todo: Add back `@example` when reject other langs from processing /** * @example * ```shell @@ -13,15 +14,8 @@ import fs from 'fs/promises'; */ import open from 'open-editor'; import { - dirname as getDirname, resolve, } from 'path'; -// Todo: Add back `@example` when reject other langs from processing -import { - fileURLToPath, -} from 'url'; - -const dirname = getDirname(fileURLToPath(import.meta.url)); // Todo: Would ideally have prompts, e.g., to ask for whether // type was problem/layout, etc. @@ -284,7 +278,7 @@ export default iterateJsdoc(({ */ // Set chdir as somehow still in operation from other test - process.chdir(resolve(dirname, '../../')); + process.chdir(resolve(import.meta.dirname, '../../')); await open([ // Could even add editor line column numbers like `${rulePath}:1:1` ruleReadmePath, diff --git a/src/getJsdocProcessorPlugin.js b/src/getJsdocProcessorPlugin.js index 96958577..3d24de63 100644 --- a/src/getJsdocProcessorPlugin.js +++ b/src/getJsdocProcessorPlugin.js @@ -13,20 +13,14 @@ import { readFileSync, } from 'node:fs'; import { - dirname as getDirname, join, } from 'node:path'; -import { - fileURLToPath, -} from 'node:url'; - -const dirname = getDirname(fileURLToPath(import.meta.url)); const { version, } = JSON.parse( // @ts-expect-error `Buffer` is ok for `JSON.parse` - readFileSync(join(dirname, '../package.json')), + readFileSync(join(import.meta.dirname, '../package.json')), ); // const zeroBasedLineIndexAdjust = -1; diff --git a/test/rules/index.js b/test/rules/index.js index 185d87ff..b5f8a835 100644 --- a/test/rules/index.js +++ b/test/rules/index.js @@ -9,13 +9,9 @@ import { } from 'fs'; import defaultsDeep from 'lodash.defaultsdeep'; import { - dirname as getDirname, join, } from 'path'; import semver from 'semver'; -import { - fileURLToPath, -} from 'url'; /** * @typedef {object} TestCases @@ -23,13 +19,13 @@ import { * @property {import('eslint').RuleTester.InvalidTestCase[]} invalid Invalid test cases */ -const dirname = getDirname(fileURLToPath(import.meta.url)); - const ruleTester = new RuleTester(); // eslint-disable-next-line complexity -- Temporary const main = async () => { - const ruleNames = JSON.parse(readFileSync(join(dirname, './ruleNames.json'), 'utf8')); + const ruleNames = JSON.parse(readFileSync(join( + import.meta.dirname, './ruleNames.json', + ), 'utf8')); if (!config.rules) { throw new Error('TypeScript guard');