From 8bdd99b94cd18e754fa56246bd28c0e39486facc Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Mon, 13 May 2024 01:46:58 -0500 Subject: [PATCH] fix(web): Fix eslint config --- .pre-commit-config.yaml | 1 + web/.eslintrc.cjs | 24 -------------- web/eslint.config.js | 18 +++++++++++ web/game_frame/index.html | 2 +- web/index.html | 18 +++++------ web/package-lock.json | 50 ++++++++++++++++++++++++++++-- web/package.json | 5 ++- web/src/components/GameView.vue | 2 +- web/src/components/KeyTable.vue | 7 +++-- web/src/components/UpdateAlert.vue | 6 ++-- 10 files changed, 89 insertions(+), 44 deletions(-) delete mode 100644 web/.eslintrc.cjs create mode 100644 web/eslint.config.js diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 092989ed..5bb35e94 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,7 @@ repos: types: [] types_or: [javascript, vue] args: + - --config=web/eslint.config.js - --fix - repo: local diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs deleted file mode 100644 index e3f61e06..00000000 --- a/web/.eslintrc.cjs +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-env node */ -require("@rushstack/eslint-patch/modern-module-resolution"); - -module.exports = { - root: true, - env: { - browser: true, - }, - extends: [ - "plugin:vue/vue3-recommended", - "eslint:recommended", - "@vue/eslint-config-prettier/skip-formatting", - "prettier", - "plugin:prettier/recommended", - ], - rules: { - "no-unused-vars": ["error", { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }], - "vue/no-template-shadow": "off", - }, - parserOptions: { - sourceType: "module", - }, - ignorePatterns: ["wasm_exec.js"], -}; diff --git a/web/eslint.config.js b/web/eslint.config.js new file mode 100644 index 00000000..efcf36aa --- /dev/null +++ b/web/eslint.config.js @@ -0,0 +1,18 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; +import pluginVue from "eslint-plugin-vue"; +import pluginPrettier from "eslint-plugin-prettier/recommended"; + +export default [ + { languageOptions: { globals: globals.browser } }, + { ignores: ["dist", "**/wasm_exec.js"] }, + pluginJs.configs.recommended, + ...pluginVue.configs["flat/recommended"], + pluginPrettier, + { + rules: { + "no-unused-vars": ["error", { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }], + "vue/no-template-shadow": "off", + }, + }, +]; diff --git a/web/game_frame/index.html b/web/game_frame/index.html index cd38ddb6..4c2061cb 100644 --- a/web/game_frame/index.html +++ b/web/game_frame/index.html @@ -1,2 +1,2 @@ - + diff --git a/web/index.html b/web/index.html index d55f14fc..b5147e7e 100644 --- a/web/index.html +++ b/web/index.html @@ -1,18 +1,18 @@ - + GoNES - - - - - - - - + + + + + + + + diff --git a/web/package-lock.json b/web/package-lock.json index c834cd25..c4e55ed8 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -22,11 +22,14 @@ "vue": "3.4.27" }, "devDependencies": { + "@eslint/js": "9.2.0", "@rushstack/eslint-patch": "1.10.2", "@vue/eslint-config-prettier": "9.0.0", "eslint": "9.2.0", + "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", "eslint-plugin-vue": "9.26.0", + "globals": "15.2.0", "prettier": "3.2.5" } }, @@ -2167,6 +2170,47 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/espree": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.0.1.tgz", + "integrity": "sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==", + "dev": true, + "dependencies": { + "acorn": "^8.11.3", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/js": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.2.0.tgz", @@ -4345,9 +4389,9 @@ } }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "15.2.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.2.0.tgz", + "integrity": "sha512-FQ5YwCHZM3nCmtb5FzEWwdUc9K5d3V/w9mzcz8iGD1gC/aOTHc6PouYu0kkKipNJqHAT7m51sqzQjEjIP+cK0A==", "dev": true, "engines": { "node": ">=18" diff --git a/web/package.json b/web/package.json index d8198764..fd40ba53 100644 --- a/web/package.json +++ b/web/package.json @@ -7,7 +7,7 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "lint": "eslint . --fix", "format": "prettier . --write --ignore-path .gitignore" }, "dependencies": { @@ -25,11 +25,14 @@ "vue": "3.4.27" }, "devDependencies": { + "@eslint/js": "9.2.0", "@rushstack/eslint-patch": "1.10.2", "@vue/eslint-config-prettier": "9.0.0", "eslint": "9.2.0", + "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", "eslint-plugin-vue": "9.26.0", + "globals": "15.2.0", "prettier": "3.2.5" } } diff --git a/web/src/components/GameView.vue b/web/src/components/GameView.vue index 0fa91471..d49ac4d1 100644 --- a/web/src/components/GameView.vue +++ b/web/src/components/GameView.vue @@ -108,5 +108,5 @@ const loadState = () => { src="game_frame/index.html" class="w-full h-full overflow-hidden" title="Game" - > + /> diff --git a/web/src/components/KeyTable.vue b/web/src/components/KeyTable.vue index 70a2c791..58873566 100644 --- a/web/src/components/KeyTable.vue +++ b/web/src/components/KeyTable.vue @@ -39,10 +39,13 @@ const keys = reactive({ v-for="key in keyList" :key="key" class="px-1.5 py-0.5 m-0.5 text-xs font-semibold bg-gray-700 text-gray-100 border-gray-500 border border-b-2 rounded-lg" - >{{ key }} + {{ key }} + + + + {{ action }} - {{ action }} diff --git a/web/src/components/UpdateAlert.vue b/web/src/components/UpdateAlert.vue index 466ead5c..aa39624e 100644 --- a/web/src/components/UpdateAlert.vue +++ b/web/src/components/UpdateAlert.vue @@ -6,9 +6,9 @@ class="z-40 flex items-center absolute bottom-0 right-0 m-8 mb-md-2 bg-teal-700 border-b-4 border-teal-500 rounded-lg text-teal-100 px-4 py-3 shadow-md" > - +