From 770ecd6abbab5e29ab0f529df8a7fc56151097a3 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 5 Nov 2024 13:31:37 -0500 Subject: [PATCH] server: Change target from ES2018 (Node 10) to ES2022 (Node 18) --- server.json | 2 +- test/fixtures/server/invalid.js | 35 +------------------------------- test/fixtures/server/valid.js | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/server.json b/server.json index 5e598ce4..62e8d697 100644 --- a/server.json +++ b/server.json @@ -2,7 +2,7 @@ "extends": [ "./common", "./node", - "./language/es2018" + "./language/es2022" ], "rules": { "es-x/no-hashbang": "off" diff --git a/test/fixtures/server/invalid.js b/test/fixtures/server/invalid.js index 63ed012e..9442ee9c 100644 --- a/test/fixtures/server/invalid.js +++ b/test/fixtures/server/invalid.js @@ -59,43 +59,10 @@ // eslint-disable-next-line n/no-missing-require require( 'missing' ); - const crypto = require( 'crypto' ); - // This depends on the Node version defined in package.engine - // eslint-disable-next-line n/no-unsupported-features/node-builtins - crypto.verify(); - // TODO: // TODO: // TODO: - - // not-es2018 - // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend - ''.trimEnd(); - - // not-es2019 - // eslint-disable-next-line es-x/no-string-prototype-matchall - ''.matchAll( /foo/ ); - - // not-es2019 - // eslint-disable-next-line es-x/no-bigint - const c = BigInt( 100 ); - - // not-es2019 - // eslint-disable-next-line es-x/no-promise-all-settled - Promise.allSettled( [] ); - - // not-es2019 - // eslint-disable-next-line es-x/no-global-this, no-unused-expressions - globalThis === c; - - // not-es2020 - // eslint-disable-next-line es-x/no-string-prototype-replaceall - 'abc'.replaceAll( 'a', 'x' ); - // eslint-disable-next-line es-x/no-promise-any - Promise.any( [] ); - - // not-es2021 - // Nothing yet + // TODO: // eslint-disable-next-line n/no-process-exit process.exit( 1 ); diff --git a/test/fixtures/server/valid.js b/test/fixtures/server/valid.js index 646311db..2f49dc5a 100644 --- a/test/fixtures/server/valid.js +++ b/test/fixtures/server/valid.js @@ -56,6 +56,42 @@ // Off: es-x/no-symbol-prototype-description global.desc = a.description; + const crypto = require( 'crypto' ); + // This depends on the Node version defined in package.engine + + crypto.verify(); + + // TODO: n/process-exit-as-throw + + // ES2018 + // Off: es-x/no-string-prototype-trimstart-trimend + ''.trimEnd(); + + // ES2019 + // Off: es-x/no-string-prototype-matchall + ''.matchAll( /foo/ ); + + // ES2019 + // Off: es-x/no-bigint + const c = BigInt( 100 ); + + // ES2019 + // Off: es-x/no-promise-all-settled + Promise.allSettled( [] ); + + // ES2019 + // Off: es-x/no-global-this, no-unused-expressions + globalThis === c; + + // ES2020 + // Off: es-x/no-string-prototype-replaceall + 'abc'.replaceAll( 'a', 'x' ); + // Off: es-x/no-promise-any + Promise.any( [] ); + + // ES2021 + // Nothing yet + /* Globals */ console.log( // Global: AggregateError