Skip to content

Commit 1bf6509

Browse files
committed
chore: bump to Node 20.11.0+
BREAKING CHANGE: Requires Node 20.11.0+ Also: - refactor: use `import.meta.dirname`
1 parent 228c568 commit 1bf6509

File tree

10 files changed

+67
-62
lines changed

10 files changed

+67
-62
lines changed

.babelrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@babel/preset-env",
99
{
1010
"targets": {
11-
"node": 16
11+
"node": 20
1212
}
1313
}
1414
]

.github/workflows/feature.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: setup node.js
1414
uses: actions/setup-node@v4
1515
with:
16-
node-version: '20'
16+
node-version: '20.11.0'
1717
- run: pnpm install
1818
- run: pnpm build
1919
- run: pnpm lint
@@ -40,8 +40,7 @@ jobs:
4040
fail-fast: false
4141
matrix:
4242
node_js_version:
43-
- '18'
44-
- '20'
43+
- '20.11.0'
4544
- '22'
4645
build:
4746
runs-on: ubuntu-latest
@@ -57,7 +56,7 @@ jobs:
5756
- name: setup node.js
5857
uses: actions/setup-node@v4
5958
with:
60-
node-version: '20'
59+
node-version: '20.11.0'
6160
- run: pnpm install
6261
- run: pnpm build
6362
timeout-minutes: 10

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: setup node.js
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: "20"
17+
node-version: "22"
1818
- run: pnpm install
1919
- run: pnpm build
2020
- run: npx semantic-release

.ncurc.cjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,5 @@ module.exports = {
44
reject: [
55
// Todo: When our package converted to ESM only
66
'escape-string-regexp',
7-
8-
// todo[engine:node@>=20]: Can reenable
9-
'glob',
10-
// todo[engine:node@>=20]: Can reenable
11-
'rimraf',
127
],
138
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"eslint": "9.28.0",
5656
"eslint-config-canonical": "~44.9.5",
5757
"gitdown": "^4.1.1",
58-
"glob": "^10.4.2",
58+
"glob": "^11.0.2",
5959
"globals": "^16.2.0",
6060
"husky": "^9.1.7",
6161
"jsdoc-type-pratt-parser": "^4.1.0",
@@ -65,13 +65,13 @@
6565
"mocha": "^11.5.0",
6666
"open-editor": "^5.1.0",
6767
"replace": "^1.2.2",
68-
"rimraf": "^5.0.7",
68+
"rimraf": "^6.0.1",
6969
"semantic-release": "^24.2.5",
7070
"typescript": "5.8.3",
7171
"typescript-eslint": "^8.33.0"
7272
},
7373
"engines": {
74-
"node": ">=18"
74+
"node": ">=20.11.0"
7575
},
7676
"keywords": [
7777
"eslint",

pnpm-lock.yaml

Lines changed: 51 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bin/generateDocs.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ import {
77
/**
88
* This script is used to inline assertions into the README.md documents.
99
*/
10-
import path, {
11-
dirname as getDirname,
12-
} from 'path';
13-
import {
14-
fileURLToPath,
15-
} from 'url';
10+
import path from 'path';
1611

17-
const dirname = getDirname(fileURLToPath(import.meta.url));
12+
const dirname = import.meta.dirname;
1813

1914
/**
2015
* @param {string} code

src/bin/generateRule.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
existsSync,
66
} from 'fs';
77
import fs from 'fs/promises';
8+
// Todo: Add back `@example` when reject other langs from processing
89
/**
910
*
1011
* ```shell
@@ -13,15 +14,8 @@ import fs from 'fs/promises';
1314
*/
1415
import open from 'open-editor';
1516
import {
16-
dirname as getDirname,
1717
resolve,
1818
} from 'path';
19-
// Todo: Add back `@example` when reject other langs from processing
20-
import {
21-
fileURLToPath,
22-
} from 'url';
23-
24-
const dirname = getDirname(fileURLToPath(import.meta.url));
2519

2620
// Todo: Would ideally have prompts, e.g., to ask for whether
2721
// type was problem/layout, etc.
@@ -284,7 +278,7 @@ export default iterateJsdoc(({
284278
*/
285279

286280
// Set chdir as somehow still in operation from other test
287-
process.chdir(resolve(dirname, '../../'));
281+
process.chdir(resolve(import.meta.dirname, '../../'));
288282
await open([
289283
// Could even add editor line column numbers like `${rulePath}:1:1`
290284
ruleReadmePath,

src/getJsdocProcessorPlugin.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,14 @@ import {
1515
readFileSync,
1616
} from 'node:fs';
1717
import {
18-
dirname as getDirname,
1918
join,
2019
} from 'node:path';
21-
import {
22-
fileURLToPath,
23-
} from 'node:url';
24-
25-
const dirname = getDirname(fileURLToPath(import.meta.url));
2620

2721
const {
2822
version,
2923
} = JSON.parse(
3024
// @ts-expect-error `Buffer` is ok for `JSON.parse`
31-
readFileSync(join(dirname, '../package.json')),
25+
readFileSync(join(import.meta.dirname, '../package.json')),
3226
);
3327

3428
// const zeroBasedLineIndexAdjust = -1;

test/rules/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,23 @@ import {
99
} from 'fs';
1010
import defaultsDeep from 'lodash.defaultsdeep';
1111
import {
12-
dirname as getDirname,
1312
join,
1413
} from 'path';
1514
import semver from 'semver';
16-
import {
17-
fileURLToPath,
18-
} from 'url';
1915

2016
/**
2117
* @typedef {object} TestCases
2218
* @property {import('eslint').RuleTester.ValidTestCase[]} valid Valid test cases
2319
* @property {import('eslint').RuleTester.InvalidTestCase[]} invalid Invalid test cases
2420
*/
2521

26-
const dirname = getDirname(fileURLToPath(import.meta.url));
27-
2822
const ruleTester = new RuleTester();
2923

3024
// eslint-disable-next-line complexity -- Temporary
3125
const main = async () => {
32-
const ruleNames = JSON.parse(readFileSync(join(dirname, './ruleNames.json'), 'utf8'));
26+
const ruleNames = JSON.parse(readFileSync(join(
27+
import.meta.dirname, './ruleNames.json',
28+
), 'utf8'));
3329

3430
if (!config.rules) {
3531
throw new Error('TypeScript guard');

0 commit comments

Comments
 (0)