Skip to content

Commit

Permalink
chore: fix eslint js warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yanfali committed Aug 16, 2024
1 parent 3680c7a commit ae01f08
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 293 deletions.
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/components/BaseKey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/components/ControllerBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ControllerTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export default {
if (isNavigationFailure(failure, NavigationFailureType.cancelled)) {
return;
}
throw err;
throw failure;
});
this.$store.dispatch('status/viewReadme', this.keyboard);
},
Expand All @@ -402,7 +402,7 @@ export default {
if (isNavigationFailure(failure, NavigationFailureType.cancelled)) {
return;
}
throw err;
throw failure;
});
},
compile() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
},
Expand Down
1 change: 0 additions & 1 deletion src/components/StatusBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
</template>
<script>
import axios from 'axios';
import escape from 'lodash/escape';
import { backend_status_url } from '@/store/modules/constants';
import { mapState, mapMutations } from 'vuex';
/**
Expand Down
16 changes: 8 additions & 8 deletions src/i18n/keymap_extras/convert_keymap_extras_header.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
/* global require, process */
const fs = require('fs');

// Taken from https://invisible-characters.com/
Expand Down Expand Up @@ -122,7 +123,7 @@ function computeIntl2US(lines) {
for (const aliasDefinition of lines.filter((line) =>
kcAliasDefRegExp.test(line)
)) {
const [fullMatch, intlAlias, macroExpansion] =
const [/*fullMatch, */ intlAlias, macroExpansion] =
kcAliasDefRegExp.exec(aliasDefinition);
const usAlias = translateToUS(macroExpansion, intl2us);
intl2us.set(intlAlias, usAlias);
Expand Down Expand Up @@ -237,7 +238,7 @@ function convertLine(line, kcInfo, intl2us) {

const copyrightRegExp = /(^.*)Copyright .*$/;
if (copyrightRegExp.test(line)) {
let [fullMatch, beforeCopyrightWord] = copyrightRegExp.exec(line);
let [/*fullMatch,*/ beforeCopyrightWord] = copyrightRegExp.exec(line);
return (
beforeCopyrightWord +
'Copyright ' +
Expand All @@ -252,8 +253,7 @@ function convertLine(line, kcInfo, intl2us) {
}

if (kcAliasDefRegExp.test(line)) {
let keycodeObjectLine = '';
let [fullMatch, intlAlias, macroExpansion, comment] =
let [fullMatch, /*intlAlias, */ macroExpansion /*, comment*/] =
kcAliasDefRegExp.exec(line);
const usMacroExpansion = translateToUS(macroExpansion, intl2us);
let kcInfoLine = stringify(usMacroExpansion, kcInfo.get(usMacroExpansion));
Expand All @@ -280,8 +280,8 @@ function generateMissingANSISOkeys(kcInfo) {
);
let missingKcInfoLines = [];
for (const missingKc of missingKcs) {
baseKcInfo = kcInfo.get(fallbackKc);
shiftedKcInfo = kcInfo.get(`S(${fallbackKc})`) || baseKcInfo;
const baseKcInfo = kcInfo.get(fallbackKc);
const shiftedKcInfo = kcInfo.get(`S(${fallbackKc})`) || baseKcInfo;
if (baseKcInfo === undefined || shiftedKcInfo === undefined) {
throw new Error(
'The input file is missing a mapping to both KC_BSLS and KC_NUHS. At least one of them must be mapped to a locale alias!'
Expand Down Expand Up @@ -333,7 +333,7 @@ function generateMissingShiftedAliasKcInfo(kcInfo) {

function generateSpaceCadetKcInfo(kc, kcInfo) {
const spaceCadetKeycodeRegExp = /([LR])([GASC])P([OC])/;
let [fullMatch, handedness, modifier, variant] =
let [/*fullMatch, */ handedness, modifier, variant] =
spaceCadetKeycodeRegExp.exec(kc);
const table = new Map([
['L', 'Left'],
Expand Down Expand Up @@ -380,7 +380,7 @@ fs.readFile(process.argv.at(-1), 'utf8', function (err, data) {
console.log('/* Other keys */');
console.log(generateMissingANSISOkeys(kcInfo));
console.log(generateMissingShiftedAliasKcInfo(kcInfo));
spaceCadetKeycodes = [
const spaceCadetKeycodes = [
'SC_LSPO',
'SC_RSPC',
'SC_LCPO',
Expand Down
4 changes: 2 additions & 2 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export default new Vuex.Store({
},
state: {},
mutations: {},
actions: {},
strict: process.env.NODE_ENV !== 'production'
actions: {}
// strict: process.env.NODE_ENV !== 'production'
});
6 changes: 1 addition & 5 deletions src/store/modules/app/state.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
localStorageSet,
localStorageLoad,
CONSTS
} from '@/store/localStorage';
import { localStorageLoad, CONSTS } from '@/store/localStorage';
import osKeyboardLayouts from '@/os_keyboard_layouts';

function getDefaultConfiguratorSettings() {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/keycodes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const getters = {

function countMatches(filter, collection) {
filter = filter.toUpperCase();
return collection.reduce((acc, { group, width, code, name, title }) => {
return collection.reduce((acc, { code, name, title }) => {
if (!isUndefined(code)) {
if (
code.includes(filter) ||
Expand Down
7 changes: 6 additions & 1 deletion src/store/modules/keymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ const getters = {
keycode = compiler ? key.text : `ANY(${key.text})`;
}
} else {
console.error(`ERROR: unexpected keycode ${key}`, k, i, _layer);
console.error(
`ERROR: unexpected keycode ${key}`,
key,
i,
_layer
);
}
newLayer.push(keycode);
return newLayer;
Expand Down
Loading

0 comments on commit ae01f08

Please sign in to comment.