diff --git a/eslint.config.js b/eslint.config.js index bd4cd6bc..767d028b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -23,11 +23,7 @@ export default [ files: ["tools/**"], rules: { "no-console": "off", - "n/no-process-exit": "off", - "n/no-unsupported-features/es-syntax": ["error", { - version: ">=16.0.0", - ignores: ["modules"] - }] + "n/no-process-exit": "off" } } ]; diff --git a/espree.js b/espree.js index e9b11188..15e0ce52 100644 --- a/espree.js +++ b/espree.js @@ -1,5 +1,3 @@ -/* eslint-disable jsdoc/no-multi-asterisks -- needed to preserve original formatting of licences */ - /** * @fileoverview Main Espree file that converts Acorn into Esprima output. * @@ -57,7 +55,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* eslint-enable jsdoc/no-multi-asterisks -- needed to preserve original formatting of licences */ import * as acorn from "acorn"; import jsx from "acorn-jsx"; @@ -160,7 +157,7 @@ export const Syntax = (function() { } for (key in VisitorKeys) { - if (Object.hasOwnProperty.call(VisitorKeys, key)) { + if (Object.hasOwn(VisitorKeys, key)) { types[key] = key; } } diff --git a/lib/options.js b/lib/options.js index 1460ac27..8eae1b0c 100644 --- a/lib/options.js +++ b/lib/options.js @@ -27,7 +27,7 @@ const SUPPORTED_VERSIONS = [ * @returns {number} The latest ECMAScript version. */ export function getLatestEcmaVersion() { - return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; + return SUPPORTED_VERSIONS.at(-1); } /** diff --git a/lib/token-translator.js b/lib/token-translator.js index 2a915fb5..6daf865a 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -40,7 +40,7 @@ const Token = { */ function convertTemplatePart(tokens, code) { const firstToken = tokens[0], - lastTemplateToken = tokens[tokens.length - 1]; + lastTemplateToken = tokens.at(-1); const token = { type: Token.Template, diff --git a/package.json b/package.json index 8b4ef8e8..c8991cbb 100644 --- a/package.json +++ b/package.json @@ -42,11 +42,11 @@ "@rollup/plugin-node-resolve": "^11.2.0", "c8": "^7.11.0", "chai": "^4.3.6", - "eslint": "^8.44.0", - "eslint-config-eslint": "^9.0.0", + "eslint": "^9.1.1", + "eslint-config-eslint": "^10.0.0", "eslint-release": "^3.2.0", "esprima-fb": "^8001.2001.0-dev-harmony-fb", - "globals": "^13.20.0", + "globals": "^15.1.0", "lint-staged": "^13.2.0", "mocha": "^9.2.2", "npm-run-all": "^4.1.5", @@ -70,7 +70,7 @@ "build:debug": "npm run build -- -m", "build:docs": "node tools/sync-docs.js", "build:update-version": "node tools/update-version.js", - "lint": "eslint . --report-unused-disable-directives", + "lint": "eslint .", "lint:fix": "npm run lint -- --fix", "prepublishOnly": "npm run build:update-version && npm run build", "pretest": "npm run build", diff --git a/tools/create-test.js b/tools/create-test.js index 20c731c0..1179ad8c 100644 --- a/tools/create-test.js +++ b/tools/create-test.js @@ -89,7 +89,7 @@ code.forEach((source, index) => { sourceCode = source.trim(); // add an extra semicolon if there's not already one at the end - helps normalize empty lines at end of input - if (sourceCode[sourceCode.length - 1] !== ";") { + if (sourceCode.at(-1) !== ";") { sourceCode += ";"; } diff --git a/tools/update-tests.js b/tools/update-tests.js index 16aef31b..e2792c74 100644 --- a/tools/update-tests.js +++ b/tools/update-tests.js @@ -70,14 +70,13 @@ const testFiles = getTestFilenames(FIXTURES_DIR), libraryFiles.forEach(filename => { const testResultFilename = `${path.resolve(__dirname, "..", LIBRARIES_DIR, filename)}.result.json`, code = shelljs.cat(path.resolve(LIBRARIES_DIR, filename)); - let result = tester.getExpectedResult(code, { + const result = tester.getExpectedResult(code, { loc: true, range: true, tokens: true }); JSON.stringify(result).to(testResultFilename); - result = null; }); // update all tests in ecma-features