From ae01f08c20a76f5d4c832acdd78b59e59ea7234d Mon Sep 17 00:00:00 2001 From: Yan-Fa Li Date: Thu, 15 Aug 2024 18:40:08 -0700 Subject: [PATCH] chore: fix eslint js warnings --- eslint.config.js | 3 +- package.json | 1 + src/components/BaseKey.vue | 3 +- src/components/ControllerBottom.vue | 8 +- src/components/ControllerTop.vue | 4 +- src/components/Main.vue | 2 +- src/components/StatusBar.vue | 1 - .../convert_keymap_extras_header.js | 16 +- src/store/index.js | 4 +- src/store/modules/app/state.js | 6 +- src/store/modules/keycodes/index.js | 2 +- src/store/modules/keymap.js | 7 +- yarn.lock | 467 ++++++++---------- 13 files changed, 231 insertions(+), 293 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 54058c1e04..98a4c153d9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,7 +1,8 @@ +const js = require('@eslint/js'); const cypress = require('eslint-plugin-cypress'); const eslintPluginVue = require('eslint-plugin-vue'); -const cypressConfig = require('./cypress.config'); module.exports = [ + js.configs.recommended, ...eslintPluginVue.configs['flat/vue2-essential'], { plugins: { diff --git a/package.json b/package.json index 32c64ad2fb..7c8e59ac36 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "@achrinza/node-ipc": "9", + "@eslint/js": "^9.9.0", "@fontsource/montserrat": "^4.5.1", "@fontsource/roboto": "^4.5.1", "@fontsource/roboto-mono": "^4.5.0", diff --git a/src/components/BaseKey.vue b/src/components/BaseKey.vue index 9eb285fcb3..15c094e83d 100644 --- a/src/components/BaseKey.vue +++ b/src/components/BaseKey.vue @@ -136,9 +136,10 @@ export default { }, displayName() { switch (this.legends) { - case 'size': + case 'size': { const { uh, uw } = this; return uh > uw ? (uw === 1 ? uh : `${uw} /\n ${uh}`) : uw; + } case 'matrix': if (this.matrix) { const [row, col] = this.matrix; diff --git a/src/components/ControllerBottom.vue b/src/components/ControllerBottom.vue index 40dbe5306b..181fb939b0 100644 --- a/src/components/ControllerBottom.vue +++ b/src/components/ControllerBottom.vue @@ -226,6 +226,7 @@ export default { await this.loadJsonData(data); } catch (err) { alert('Seems like there is an issue trying to get the file'); + console.error(err); } this.closeVeil(); }, @@ -386,10 +387,9 @@ export default { throw err; }); - var store = this.$store; - let promise = await new Promise((resolve) => - this.setLoadingKeymapPromise(resolve) - ); + // wait for keymap to load + await new Promise((resolve) => this.setLoadingKeymapPromise(resolve)); + const stats = await this.load_converted_keymap(data.layers); let msg = this.$t('statsTemplate', stats); if (stats.warnings.length > 0 || stats.errors.length > 0) { diff --git a/src/components/ControllerTop.vue b/src/components/ControllerTop.vue index 0d3f7eb656..96a6cba5cb 100644 --- a/src/components/ControllerTop.vue +++ b/src/components/ControllerTop.vue @@ -381,7 +381,7 @@ export default { if (isNavigationFailure(failure, NavigationFailureType.cancelled)) { return; } - throw err; + throw failure; }); this.$store.dispatch('status/viewReadme', this.keyboard); }, @@ -402,7 +402,7 @@ export default { if (isNavigationFailure(failure, NavigationFailureType.cancelled)) { return; } - throw err; + throw failure; }); }, compile() { diff --git a/src/components/Main.vue b/src/components/Main.vue index af74ca76bb..1b269ff8a4 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -117,7 +117,7 @@ export default { .replace(/Dcs/, 'DCS') .replace(/Dev Tty/, '/dev/tty') .replace(/ ?Plus/g, '+') - .replace(/ ?Dot ?/g, '\.') + .replace(/ ?Dot ?/g, '.') .replace(/Ascii/, 'ASCII'); }); }, diff --git a/src/components/StatusBar.vue b/src/components/StatusBar.vue index ef27b93fa8..80067e0253 100644 --- a/src/components/StatusBar.vue +++ b/src/components/StatusBar.vue @@ -49,7 +49,6 @@