Skip to content

Commit

Permalink
refactor: switch to eslint v9, eslint-config-eslint v10 (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Apr 30, 2024
1 parent 18cfaca commit c8de71e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 18 deletions.
6 changes: 1 addition & 5 deletions eslint.config.js
Expand Up @@ -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"
}
}
];
5 changes: 1 addition & 4 deletions 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.
*
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/options.js
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/token-translator.js
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tools/create-test.js
Expand Up @@ -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 += ";";
}

Expand Down
3 changes: 1 addition & 2 deletions tools/update-tests.js
Expand Up @@ -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
Expand Down

0 comments on commit c8de71e

Please sign in to comment.