Skip to content

chore: bump to Node 20.11.0+ #1375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@babel/preset-env",
{
"targets": {
"node": 16
"node": 20
}
}
]
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,8 +40,7 @@ jobs:
fail-fast: false
matrix:
node_js_version:
- '18'
- '20'
- '20.11.0'
- '22'
build:
runs-on: ubuntu-latest
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"typescript-eslint": "^8.1.0"
},
"engines": {
"node": ">=18"
"node": ">=20.11.0"
},
"keywords": [
"eslint",
Expand Down
5 changes: 2 additions & 3 deletions src/bin/generateDocs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/**
* This script is used to inline assertions into the README.md documents.
*/
import path, {dirname} from 'path';
import {fileURLToPath} from 'url';
import path from 'path';
import fs from 'fs';
import decamelize from 'decamelize';
import Gitdown from 'gitdown';
import {
glob,
} from 'glob';

const __dirname = dirname(fileURLToPath(import.meta.url));
const __dirname = import.meta.dirname;

/**
* @param {string} code
Expand Down
7 changes: 2 additions & 5 deletions src/bin/generateRule.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable no-console -- CLI */

import {fileURLToPath} from 'url';
import {
existsSync,
} from 'fs';
import fs from 'fs/promises';
import {
resolve, dirname,
resolve,
} from 'path';

/**
Expand All @@ -20,8 +19,6 @@ import {
import camelCase from 'camelcase';
import open from 'open-editor';

const __dirname = dirname(fileURLToPath(import.meta.url));

// Todo: Would ideally have prompts, e.g., to ask for whether
// type was problem/layout, etc.

Expand Down Expand Up @@ -283,7 +280,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,
Expand Down
7 changes: 2 additions & 5 deletions src/getJsdocProcessorPlugin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Todo: Support TS by fenced block type

import {readFileSync} from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';
import * as espree from 'espree';
import {
getRegexFromString,
Expand All @@ -15,11 +14,9 @@ import {
parseComment,
} from '@es-joy/jsdoccomment';

const __dirname = dirname(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;
Expand Down
5 changes: 0 additions & 5 deletions src/rules/checkValues.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

import semver from 'semver';
import spdxExpressionParse from 'spdx-expression-parse';
import {parseImportsExports} from 'parse-imports-exports';
import iterateJsdoc from '../iterateJsdoc.js';

const __dirname = dirname(fileURLToPath(import.meta.url));

const allowedKinds = new Set([
'class',
'constant',
Expand Down
5 changes: 0 additions & 5 deletions src/rules/noUndefinedTypes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

import {parseImportsExports} from 'parse-imports-exports';
import {
getJSDocComment,
Expand All @@ -12,8 +9,6 @@ import iterateJsdoc, {
parseComment,
} from '../iterateJsdoc.js';

const __dirname = dirname(fileURLToPath(import.meta.url));

const extraTypes = [
'null', 'undefined', 'void', 'string', 'boolean', 'object',
'function', 'symbol',
Expand Down
8 changes: 3 additions & 5 deletions test/rules/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import config from '../../src/index.js';
import {fileURLToPath} from 'url';
import camelCase from 'camelcase';
import {
ESLint,
Expand All @@ -10,7 +9,6 @@ import {
} from 'fs';
import defaultsDeep from 'lodash.defaultsdeep';
import {
dirname,
join,
} from 'path';
import semver from 'semver';
Expand All @@ -21,13 +19,13 @@ import semver from 'semver';
* @property {import('eslint').RuleTester.InvalidTestCase[]} invalid
*/

const __dirname = dirname(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');
Expand Down