Skip to content

Commit

Permalink
server: Change target from ES2018 (Node 10) to ES2022 (Node 18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdforrester committed Nov 19, 2024
1 parent 91e9a0b commit a954f6f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 35 deletions.
3 changes: 2 additions & 1 deletion server.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"extends": [
"./common",
"./node",
"./language/es2018"
"./language/es2022"
],
"rules": {
"n/no-unsupported-features/node-builtins": [ "error", { "version": ">18.0.0" } ],
"es-x/no-hashbang": "off"
}
}
35 changes: 1 addition & 34 deletions test/fixtures/server/invalid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: <!-- eslint-disable-next-line n/no-extraneous-require -->
// TODO: <!-- eslint-disable-next-line n/no-unpublished-bin -->
// TODO: <!-- eslint-disable-next-line n/process-exit-as-throw -->

// 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-unsupported-features/node-builtins -->

// eslint-disable-next-line n/no-process-exit
process.exit( 1 );
Expand Down
39 changes: 39 additions & 0 deletions test/fixtures/server/valid.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,45 @@
// 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
'foo'.replace( globalThis ?? 'foo', 'bar' );

// ES2020
// Off: es-x/no-string-prototype-replaceall
'abc'.replaceAll( 'a', 'x' );
// Off: es-x/no-promise-any
Promise.any( [] );

// ES2021
// Nothing yet

// ES2022
const e = new DOMException();

/* Globals */
console.log(
// Global: AggregateError
Expand Down

0 comments on commit a954f6f

Please sign in to comment.