diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index b4e8091a..00000000 --- a/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -.git -.nyc_output -coverage -node_modules -lib/wpt/templates diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 5a1ce310..00000000 --- a/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "standard", - "rules": { - "semi": ["error", "always"], - "space-before-function-paren": ["error", "never"], - "no-multi-spaces": ["error", { "ignoreEOLComments": true }], - "camelcase": "off", - "max-len": [2, 100, 4, {"ignoreRegExpLiterals": true, "ignoreUrls": true}], - "object-property-newline": "off" - }, - "env": { - "node": true - }, - "parserOptions": { - "sourceType": "module" - } -} diff --git a/bin/git-node.js b/bin/git-node.js index 69fa3777..12107fc5 100755 --- a/bin/git-node.js +++ b/bin/git-node.js @@ -27,4 +27,6 @@ Promise.all(commandFiles.map(importCommand)).then((commands) => { .epilogue(epilogue) .help('help') .parse(); +}).catch((err) => { + throw err; }); diff --git a/components/git/metadata.js b/components/git/metadata.js index 274e6f3f..60da097f 100644 --- a/components/git/metadata.js +++ b/components/git/metadata.js @@ -90,5 +90,6 @@ export function handler(argv) { if (status === false) { throw new Error(IGNORE); } + return undefined; })); } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..10e67b91 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,46 @@ +import globals from 'globals'; +import pluginJs from '@eslint/js'; +import neostandard from 'neostandard'; +import nodePlugin from 'eslint-plugin-n'; +import pluginPromise from 'eslint-plugin-promise'; +import importPlugin from 'eslint-plugin-import'; + +export default [ + pluginJs.configs.recommended, + ...neostandard(), + nodePlugin.configs['flat/recommended'], + pluginPromise.configs['flat/recommended'], + importPlugin.flatConfigs.recommended, + { + ignores: [ + '**/.git', + '**/.nyc_output', + 'coverage/', + 'node_modules/', + 'lib/wpt/templates/', + ], + }, + { + languageOptions: { + globals: globals.node, + sourceType: 'module', + ecmaVersion: 'latest', + }, + rules: { + '@stylistic/semi': ['error', 'always'], + '@stylistic/space-before-function-paren': ['error', 'never'], + '@stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }], + camelcase: 'off', + '@stylistic/max-len': [ + 2, + 100, + 4, + { ignoreRegExpLiterals: true, ignoreUrls: true }, + ], + '@stylistic/object-property-newline': 'off', + 'promise/always-return': ['error', { ignoreLastCallback: true }], + 'n/no-process-exit': 'off', + 'n/no-unsupported-features/node-builtins': 'off', + }, + }, +]; diff --git a/lib/ci/build-types/health_build.js b/lib/ci/build-types/health_build.js index fdc82f2f..0aceb948 100644 --- a/lib/ci/build-types/health_build.js +++ b/lib/ci/build-types/health_build.js @@ -20,10 +20,10 @@ class Health { formatAsMarkdown() { const { success, pending, aborted, failed, unstable, count } = this; const rate = `${(success / (count - pending - aborted) * 100).toFixed(2)}%`; - // eslint-disable-next-line max-len - let result = '| UTC Time | RUNNING | SUCCESS | UNSTABLE | ABORTED | FAILURE | Green Rate |\n'; - // eslint-disable-next-line max-len - result += '| ---------------- | ------- | ------- | -------- | ------- | ------- | ---------- |\n'; + let result = + '| UTC Time | RUNNING | SUCCESS | UNSTABLE | ABORTED | FAILURE | Green Rate |\n'; + result += + '| ---------------- | ------- | ------- | -------- | ------- | ------- | ---------- |\n'; const time = new Date().toISOString().slice(0, 16).replace('T', ' '); result += `| ${time} | ${pad(pending, 7)} | ${pad(success, 8)}|`; result += ` ${pad(unstable, 8)} | ${pad(aborted, 7)} | ${pad(failed, 7)} |`; diff --git a/lib/ci/build-types/test_build.js b/lib/ci/build-types/test_build.js index 4de6b274..87456853 100644 --- a/lib/ci/build-types/test_build.js +++ b/lib/ci/build-types/test_build.js @@ -76,6 +76,8 @@ export class TestBuild extends Job { return result; } } + + return undefined; } get commit() { diff --git a/lib/ci/ci_failure_parser.js b/lib/ci/ci_failure_parser.js index f33981f6..3635fa00 100644 --- a/lib/ci/ci_failure_parser.js +++ b/lib/ci/ci_failure_parser.js @@ -204,7 +204,6 @@ const FAILURE_FILTERS = [{ context: { index: 0, contextBefore: 0, contextAfter: 0 } }, { pattern: - // eslint-disable-next-line max-len /error: Your local changes to the following files[\s\S]+Failed to merge in the changes./g, context: { index: 0, contextBefore: 0, contextAfter: 0 } }, { diff --git a/lib/cli.js b/lib/cli.js index 8925fa65..1c119b75 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -81,6 +81,7 @@ export default class CLI { return defaultAnswer; } + // eslint-disable-next-line import/namespace -- Plugin can't validate computed reference here const answer = await inquirer[questionType]({ message: question, default: defaultAnswer diff --git a/lib/collaborators.js b/lib/collaborators.js index 64d2dccc..5b942fd3 100644 --- a/lib/collaborators.js +++ b/lib/collaborators.js @@ -105,7 +105,6 @@ function parseCollaborators(readme, cli) { // We also assume that TSC & TSC Emeriti are also listed as collaborators CONTACT_RE.lastIndex = tscIndex; - // eslint-disable-next-line no-cond-assign while ((m = CONTACT_RE.exec(readme)) && CONTACT_RE.lastIndex < tscrIndex) { const login = m[1].toLowerCase(); const user = new Collaborator(m[1], m[2], m[3], TSC); @@ -113,7 +112,6 @@ function parseCollaborators(readme, cli) { } CONTACT_RE.lastIndex = clIndex; - // eslint-disable-next-line no-cond-assign while ((m = CONTACT_RE.exec(readme)) && CONTACT_RE.lastIndex < cleIndex) { const login = m[1].toLowerCase(); diff --git a/lib/prepare_security.js b/lib/prepare_security.js index d498a313..7061ba66 100644 --- a/lib/prepare_security.js +++ b/lib/prepare_security.js @@ -56,8 +56,8 @@ export default class PrepareSecurityRelease extends SecurityRelease { await this.closePRWithLabel('Security Release'); const updateFolder = await this.cli.prompt( - // eslint-disable-next-line max-len - `Would you like to update the next-security-release folder to ${vulnerabilityJSON.releaseDate}?`, + `Would you like to update the next-security-release folder to ${ + vulnerabilityJSON.releaseDate}?`, { defaultAnswer: true }); if (updateFolder) { this.updateReleaseFolder( diff --git a/lib/release/utils.js b/lib/release/utils.js index 78b316c1..f4fec996 100644 --- a/lib/release/utils.js +++ b/lib/release/utils.js @@ -21,12 +21,10 @@ export function getStartLTSBlurb({ date, ltsCodename, versionComponents }) { const eol = eolDate.toLocaleString('en-US', dateFormat); const { major } = versionComponents; return [ - /* eslint-disable max-len */ `This release marks the transition of Node.js ${major}.x into Long Term Support (LTS)`, `with the codename '${ltsCodename}'. The ${major}.x release line now moves into "Active LTS"`, `and will remain so until ${mainStart}. After that time, it will move into`, `"Maintenance" until end of life in ${eol}.` - /* eslint-enable */ ].join('\n'); } diff --git a/lib/team_info.js b/lib/team_info.js index 09ff36f0..d4568e21 100644 --- a/lib/team_info.js +++ b/lib/team_info.js @@ -67,7 +67,6 @@ TeamInfo.update = async function(cli, request, content) { const blocks = new Map(); let m; - // eslint-disable-next-line no-cond-assign while ((m = RE.exec(content))) { const [, org, team] = m; const mapKey = key(org, team); diff --git a/lib/update-v8/majorUpdate.js b/lib/update-v8/majorUpdate.js index 0ca3f8a1..15fd4cd5 100644 --- a/lib/update-v8/majorUpdate.js +++ b/lib/update-v8/majorUpdate.js @@ -119,7 +119,6 @@ function updateV8Deps() { path: v8Dep.repo })), newV8Version); if (deps.length === 0) return; - /* eslint-disable no-await-in-loop */ for (const dep of deps) { if (dep.gitignore) { if (typeof dep.gitignore === 'string') { @@ -132,7 +131,6 @@ function updateV8Deps() { const thePath = path.join(ctx.nodeDir, 'deps/v8', dep.path); await fetchFromGit(thePath, repo, commit); } - /* eslint-enable */ } }; } diff --git a/lib/voting_session.js b/lib/voting_session.js index 9a3f7977..377aef2e 100644 --- a/lib/voting_session.js +++ b/lib/voting_session.js @@ -10,6 +10,7 @@ import { getEditor, isGhAvailable } from './utils.js'; +// eslint-disable-next-line import/no-unresolved import voteUsingGit from '@node-core/caritat/voteUsingGit'; import * as yaml from 'js-yaml'; @@ -97,7 +98,7 @@ export default class VotingSession extends Session { cp.stdin.end(share); const [code] = await Promise.race([ once(cp, 'exit'), - once(cp, 'error').then((er) => Promise.reject(er)) + once(cp, 'error').then((er) => { throw er; }) ]); if (code !== 0) throw new Error('failed', { cause: code }); return Buffer.concat(await stdout); diff --git a/package.json b/package.json index b39bb465..dd31b86a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@pkgjs/nv": "^0.2.2", "branch-diff": "^3.1.1", "chalk": "^5.4.1", - "changelog-maker": "^4.3.1", + "changelog-maker": "^4.3.2", "cheerio": "^1.0.0", "clipboardy": "^4.0.0", "core-validate-commit": "^4.1.0", @@ -53,18 +53,21 @@ "log-symbols": "^7.0.0", "ora": "^8.1.1", "replace-in-file": "^8.3.0", - "undici": "^7.2.2", + "semver": "^7.6.3", + "undici": "^7.3.0", "which": "^5.0.0", "yargs": "^17.7.2" }, "devDependencies": { + "@eslint/js": "^9.19.0", "@reporters/github": "^1.7.2", "c8": "^10.1.3", - "eslint": "^8.57.1", - "eslint-config-standard": "^17.1.0", + "eslint": "^9.19.0", "eslint-plugin-import": "^2.31.0", - "eslint-plugin-n": "^16.6.2", - "eslint-plugin-promise": "^6.6.0", + "eslint-plugin-n": "^17.15.1", + "eslint-plugin-promise": "^7.2.1", + "globals": "^15.14.0", + "neostandard": "^0.12.0", "sinon": "^19.0.2" } } diff --git a/test/fixtures/release/expected-test-process-release.js b/test/fixtures/release/expected-test-process-release.js index ebb259f7..c031f1f2 100644 --- a/test/fixtures/release/expected-test-process-release.js +++ b/test/fixtures/release/expected-test-process-release.js @@ -1,5 +1,6 @@ 'use strict'; +// eslint-disable-next-line n/no-missing-require require('../common'); const assert = require('assert'); diff --git a/test/fixtures/release/original-test-process-release.js b/test/fixtures/release/original-test-process-release.js index 13263894..72275a0b 100644 --- a/test/fixtures/release/original-test-process-release.js +++ b/test/fixtures/release/original-test-process-release.js @@ -1,5 +1,6 @@ 'use strict'; +// eslint-disable-next-line n/no-missing-require require('../common'); const assert = require('assert'); diff --git a/test/unit/ci_start.test.js b/test/unit/ci_start.test.js index 0d2d8d13..9a89a7f5 100644 --- a/test/unit/ci_start.test.js +++ b/test/unit/ci_start.test.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-named-as-default-member */ import { describe, it, before, afterEach } from 'node:test'; import assert from 'assert'; diff --git a/test/unit/pr_checker.test.js b/test/unit/pr_checker.test.js index e71837f7..9b5fa43c 100644 --- a/test/unit/pr_checker.test.js +++ b/test/unit/pr_checker.test.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-named-as-default-member */ import { describe, it, before, after, afterEach } from 'node:test'; import assert from 'node:assert'; diff --git a/test/unit/pr_data.test.js b/test/unit/pr_data.test.js index f2468e0d..1b4870ff 100644 --- a/test/unit/pr_data.test.js +++ b/test/unit/pr_data.test.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-named-as-default-member */ import { describe, it } from 'node:test'; import assert from 'node:assert'; diff --git a/test/unit/prepare_release.test.js b/test/unit/prepare_release.test.js index 318802f6..1e14b889 100644 --- a/test/unit/prepare_release.test.js +++ b/test/unit/prepare_release.test.js @@ -31,12 +31,10 @@ describe('prepare_release: utils.getLTSMaintenanceStartDate', () => { describe('prepare_release: utils.getStartLTSBlurb', () => { it('generates first LTS release text with correct dates', () => { const expected = [ - /* eslint-disable max-len */ 'This release marks the transition of Node.js 14.x into Long Term Support (LTS)', 'with the codename \'Fermium\'. The 14.x release line now moves into "Active LTS"', 'and will remain so until October 2021. After that time, it will move into', '"Maintenance" until end of life in April 2023.' - /* eslint-enable max-len */ ].join('\n'); const text = utils.getStartLTSBlurb({ date: '2020-10-27', diff --git a/test/unit/team_info.test.js b/test/unit/team_info.test.js index 5ba5b1fe..a696204a 100644 --- a/test/unit/team_info.test.js +++ b/test/unit/team_info.test.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-named-as-default-member */ import { describe, it, before, after } from 'node:test'; import assert from 'node:assert'; diff --git a/test/unit/wpt_updater.test.js b/test/unit/wpt_updater.test.js index 4265a465..34a03abd 100644 --- a/test/unit/wpt_updater.test.js +++ b/test/unit/wpt_updater.test.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-named-as-default-member */ import { describe, it, before, after } from 'node:test'; import assert from 'node:assert'; import TestCLI from '../fixtures/test_cli.js';