Skip to content

Commit

Permalink
Upgrade to latest eslint 9 (#4393)
Browse files Browse the repository at this point in the history
Use eslint.config.mjs
Update some of the eslint packages in package.json
  • Loading branch information
christinach authored Sep 25, 2024
1 parent 46dad8d commit 9e8f174
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 158 deletions.
31 changes: 0 additions & 31 deletions .eslintrc

This file was deleted.

57 changes: 57 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import globals from "globals";
import babelParser from "@babel/eslint-parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"**/node_modules",
"**/.gitignore",
"**/tmp",
"**/vendor",
"**/public",
"**/docs",
"**/solr",
],
}, ...compat.extends("plugin:prettier/recommended"), {
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jquery,
},

parser: babelParser,
},

rules: {
"prefer-const": "error",

"no-trailing-spaces": ["error", {
skipBlankLines: true,
ignoreComments: true,
}],

"arrow-body-style": "off",
"prefer-arrow-callback": "off",
"no-unused-vars": "warn",
},
}, {
files: ["**/*.spec.js", "**/*.spec.jsx"],

languageOptions: {
globals: {
...globals.jest,
},
},
}];
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
"@babel/eslint-plugin": "^7.22.10",
"@babel/plugin-transform-runtime": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@vue/test-utils": "2.4.6",
"@vue/vue3-jest": "29.2.6",
"babel-jest": "^29.4.0",
"babel-plugin-macros": "^3.1.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.9.0",
"jest": "^29.4.0",
"jquery": "^3.7.0",
"lint-staged": "^15.1.0",
Expand All @@ -45,15 +48,18 @@
"scripts": {
"test": "jest",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
"lint": "eslint --fix --ext .js",
"lint": "eslint -c eslint.config.mjs",
"format": "prettier . --write",
"prepare": "simple-git-hooks"
},
"jest": {
"verbose": true,
"testEnvironmentOptions": {
"url": "http://localhost/",
"customExportConditions": ["node", "node-addons"]
"customExportConditions": [
"node",
"node-addons"
]
},
"roots": [
"spec/javascript"
Expand Down
Loading

0 comments on commit 9e8f174

Please sign in to comment.