Skip to content

Commit

Permalink
[deps] Upgrade eslint to v9 and fix config
Browse files Browse the repository at this point in the history
Upgrade eslint to v9 - requires upgrading to the new config mechanism "flat
config".

- Switch from .cjs to .js which implies mjs
- Change style of plugins and shared configs (install @eslint/js)
  • Loading branch information
werkshy committed Oct 6, 2024
1 parent 9f80928 commit b86b376
Show file tree
Hide file tree
Showing 5 changed files with 723 additions and 659 deletions.
23 changes: 0 additions & 23 deletions go/frontend/.eslintrc.cjs

This file was deleted.

35 changes: 35 additions & 0 deletions go/frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import globals from "globals";
import { default as reactPlugin } from "eslint-plugin-react";
import js from "@eslint/js";

export default [
{
...js.configs.recommended,
...reactPlugin.configs.flat.recommended, // This is not a plugin object, but a shareable config object
...reactPlugin.configs.flat["jsx-runtime"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
files: ["src/**/*.{js,jsx}"],
plugins: {
reactPlugin,
},
settings: {
react: {
version: "detect",
},
},
rules: {
"react/prop-types": [0],
},
},
];
7 changes: 4 additions & 3 deletions go/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
"scripts": {
"build": "vite build",
"format": "prettier --write src index.html",
"lint": "eslint src --ext .jsx --ext .js",
"lint": "eslint",
"start": "vite serve",
"preview": "vite preview",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Andy O'Neill <[email protected]>",
"license": "ISC",
"devDependencies": {
"eslint": "^8",
"eslint-plugin-react": "^7",
"@eslint/js": "^9.12.0",
"eslint": "^9",
"eslint-plugin-react": "^7.37.1",
"prettier": "^3",
"vite": "^5"
},
Expand Down
1 change: 0 additions & 1 deletion go/frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-undef */
import { defineConfig } from "vite";
import { resolve } from "node:path";

Expand Down
Loading

0 comments on commit b86b376

Please sign in to comment.