refactor: fix lint issues (#1111)

This commit is contained in:
Stefan Dej authored and GitHub committed 2022-10-08 21:06:13 +02:00
1 parent 57bb268ea0
commit 835c5dacd2
21 files changed
+29 -41

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ import { WebSocketPlugin } from '@/plugins/webSocketClient'
import { registerSW } from 'virtual:pwa-register'
// noinspection JSUnusedGlobalSymbols
const updateSW = registerSW({
registerSW({
onOfflineReady() {},
})
@@ -84,7 +84,7 @@ const initLoad = async () => {
await store.dispatch('importConfigJson', file)
if ('defaultLocale' in file) i18n.locale = file.defaultLocale
})
.catch((_) => {
.catch(() => {
window.console.error('config.json not found or cannot be decoded!')
})
+1 -1
View File
@@ -10,7 +10,7 @@ import { PluginOption } from 'vite'
export default function buildVersion(): PluginOption {
return {
name: 'build-version',
writeBundle: (context, options) => {
writeBundle: () => {
setImmediate(async () => {
const versionIdentifier = version.toString()
const versionFile = await fs.promises.open(path.resolve(__dirname, '../../dist/.version'), 'w')
-1
View File
@@ -8,7 +8,6 @@ import {
mdiEngine,
mdiGamepad,
mdiInformation,
mdiPrinter3d,
mdiPrinter3dNozzle,
mdiThermometerLines,
mdiWebcam,
+2 -2
View File
@@ -7,7 +7,7 @@ export const actions: ActionTree<RootState, RootState> = {
if (router.currentRoute.fullPath !== '/') router.push('/')
},
changePrinter({ dispatch, getters, state }, payload) {
changePrinter({ dispatch, getters }, payload) {
dispatch('files/reset')
dispatch('gui/reset')
dispatch('printer/reset')
@@ -29,7 +29,7 @@ export const actions: ActionTree<RootState, RootState> = {
/**
* This function will parse the config.json content and config mainsail
*/
importConfigJson({ commit, dispatch }, payload: ConfigJson) {
importConfigJson({ commit }, payload: ConfigJson) {
type RootStateInstancesDbType = 'moonraker' | 'browser' | 'json'
let instancesDB: RootStateInstancesDbType = payload.instancesDB ?? 'moonraker'
if (document.location.hostname === 'my.mainsail.xyz') instancesDB = 'browser'
+1 -1
View File
@@ -12,7 +12,7 @@ export const actions: ActionTree<EditorState, RootState> = {
commit('reset')
},
openFile({ state, dispatch, commit, rootGetters, rootState }, payload) {
openFile({ state, dispatch, commit, rootGetters }, payload) {
const fullFilepathArray = []
fullFilepathArray.push(payload.root)
let path = payload.path
+1 -1
View File
@@ -38,7 +38,7 @@ export const farm: Module<FarmState, RootState> = {
},
},
actions: {
registerPrinter({ state, commit, dispatch }, payload) {
registerPrinter({ commit, dispatch }, payload) {
if (!this.hasModule(['farm', payload.id])) {
this.registerModule(['farm', payload.id], printer)
commit('farm/' + payload.id + '/setSocketData', { ...payload, _namespace: payload.id }, { root: true })
+1 -1
View File
@@ -186,7 +186,7 @@ export const actions: ActionTree<FarmPrinterState, RootState> = {
})
},
getData({ commit, dispatch, state }, payload) {
getData({ commit, dispatch }, payload) {
const data = 'status' in payload ? { ...payload.status } : { ...payload }
commit('setData', data)
+1 -4
View File
@@ -260,10 +260,7 @@ export const actions: ActionTree<FileState, RootState> = {
}
},
async uploadFile(
{ dispatch, commit, rootGetters },
payload: { file: File; path: string; root: 'gcodes' | 'config' }
) {
async uploadFile({ commit, rootGetters }, payload: { file: File; path: string; root: 'gcodes' | 'config' }) {
const apiUrl = rootGetters['socket/getUrl']
const formData = new FormData()
formData.append('file', payload.file, payload.file.name)
-1
View File
@@ -8,7 +8,6 @@ import {
import { GetterTree } from 'vuex'
import { FileState, FileStateFile, FileStateGcodefile } from '@/store/files/types'
import { ServerHistoryStateJob } from '@/store/server/history/types'
import { ServerJobQueueStateJob } from '@/store/server/jobQueue/types'
// eslint-disable-next-line
export const getters: GetterTree<FileState, any> = {
+2 -2
View File
@@ -239,7 +239,7 @@ export const actions: ActionTree<GuiState, RootState> = {
})
},
async resetMoonrakerDB({ commit, dispatch, rootGetters }, payload) {
async resetMoonrakerDB({ rootGetters }, payload) {
const baseUrl = rootGetters['socket/getUrl'] + '/server/database/item'
const urlDefault =
@@ -306,7 +306,7 @@ export const actions: ActionTree<GuiState, RootState> = {
window.location.reload()
},
async backupMoonrakerDB({ commit, dispatch, rootGetters }, payload) {
async backupMoonrakerDB({ rootGetters }, payload) {
const backup: any = {}
const responseMainsail = await fetch(rootGetters['socket/getUrl'] + '/server/database/item?namespace=mainsail')
+1 -1
View File
@@ -37,7 +37,7 @@ export const getters: GetterTree<GuiConsoleState, any> = {
return output
},
getConsoleClearedSince: (state, getters, rootState) => {
getConsoleClearedSince: (state) => {
return state.cleared_since
},
}
+2 -2
View File
@@ -28,7 +28,7 @@ export const actions: ActionTree<GuiMacrosState, RootState> = {
})
},
async groupStore({ commit, dispatch, state }, payload) {
async groupStore({ commit, dispatch }, payload) {
const id = uuidv4()
await commit('groupStore', { id, values: payload.values })
@@ -37,7 +37,7 @@ export const actions: ActionTree<GuiMacrosState, RootState> = {
return id
},
groupUpdate({ commit, dispatch, state }, payload) {
groupUpdate({ commit, dispatch }, payload) {
commit('groupUpdate', payload)
dispatch('groupUpload', payload.id)
},
-1
View File
@@ -3,7 +3,6 @@ import { GuiNotificationState, GuiNotificationStateDismissEntry, GuiNotification
import { ServerAnnouncementsStateEntry } from '@/store/server/announcements/types'
import i18n from '@/plugins/i18n.js'
import { RootStateDependency } from '@/store/types'
import { camelize } from '@/plugins/helpers'
import { sha256 } from 'js-sha256'
import { PrinterStateKlipperConfigWarning } from '@/store/printer/types'
+3 -3
View File
@@ -28,7 +28,7 @@ export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
}
},
async initStore({ commit, dispatch, state }, payload) {
async initStore({ commit, dispatch }, payload) {
dispatch('reset')
Object.keys(payload).forEach((printerId: string) => {
const printer = payload[printerId]
@@ -74,7 +74,7 @@ export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
}
},
store({ commit, dispatch, state }, payload) {
store({ commit, dispatch }, payload) {
const id = uuidv4()
commit('store', { id, values: payload.values })
@@ -91,7 +91,7 @@ export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
dispatch('upload', id)
},
update({ commit, dispatch, state }, payload) {
update({ commit, dispatch }, payload) {
commit('update', payload)
dispatch('farm/updatePrinter', payload, { root: true })
+1 -1
View File
@@ -3,7 +3,7 @@ import Vuex from 'vuex'
import { actions } from '@/store/actions'
import { mutations } from '@/store/mutations'
import { getters } from '@/store/getters'
import { ConfigJsonInstance, RootState } from './types'
import { RootState } from './types'
// load modules
import { socket } from '@/store/socket'
+3 -3
View File
@@ -54,7 +54,7 @@ export const actions: ActionTree<ServerState, RootState> = {
dispatch('socket/removeInitModule', 'server/identify', { root: true })
},
checkDatabases({ dispatch, commit, rootState }, payload) {
checkDatabases({ dispatch, commit }, payload) {
if (payload.namespaces?.includes('mainsail')) {
dispatch('socket/addInitModule', 'gui/init', { root: true })
dispatch('gui/init', null, { root: true })
@@ -159,7 +159,7 @@ export const actions: ActionTree<ServerState, RootState> = {
commit('setKlippyConnectedTimer', null)
},
checkKlippyConnected({ commit, dispatch, state }, payload) {
checkKlippyConnected({ commit, dispatch }, payload) {
if (!payload.klippy_connected) {
dispatch('startKlippyConnectedInterval')
@@ -187,7 +187,7 @@ export const actions: ActionTree<ServerState, RootState> = {
commit('setKlippyStateTimer', null)
},
checkKlippyState({ commit, dispatch, state }, payload: { state: string; state_message: string | null }) {
checkKlippyState({ commit, dispatch }, payload: { state: string; state_message: string | null }) {
commit('setKlippyState', payload.state)
commit('setKlippyMessage', payload.state_message)
+1 -1
View File
@@ -47,7 +47,7 @@ export const actions: ActionTree<ServerHistoryState, RootState> = {
else dispatch('socket/removeInitModule', 'server/history/init', { root: true })
},
async initHistoryNotes({ commit, dispatch, state }, payload) {
async initHistoryNotes({ commit, dispatch }, payload) {
const job_ids = Object.keys(payload.value)
for (const job_id of job_ids) {
+1 -7
View File
@@ -4,13 +4,7 @@ import {
ServerHistoryStateAllPrintStatusEntry,
ServerHistoryStateJob,
} from '@/store/server/history/types'
import {
mdiAlertCircleOutline,
mdiAlertOutline,
mdiCheckboxMarkedCircleOutline,
mdiCloseCircleOutline,
mdiProgressClock,
} from '@mdi/js'
import { mdiAlertOutline, mdiCheckboxMarkedCircleOutline, mdiCloseCircleOutline, mdiProgressClock } from '@mdi/js'
import i18n from '@/plugins/i18n'
// eslint-disable-next-line
+4 -4
View File
@@ -24,7 +24,7 @@ export const actions: ActionTree<ServerJobQueueState, RootState> = {
await dispatch('socket/removeInitModule', 'server/jobQueue/init', { root: true })
},
async addToQueue({ state }, filenames: string[]) {
async addToQueue(_, filenames: string[]) {
Vue.$socket.emit('server.job_queue.post_job', { filenames: filenames })
},
@@ -32,15 +32,15 @@ export const actions: ActionTree<ServerJobQueueState, RootState> = {
Vue.$socket.emit('server.job_queue.delete_job', { job_ids })
},
clearQueue(_) {
clearQueue() {
Vue.$socket.emit('server.job_queue.delete_job', { all: true })
},
start(_) {
start() {
Vue.$socket.emit('server.job_queue.start', {}, { loading: 'startJobqueue' })
},
pause(_) {
pause() {
Vue.$socket.emit('server.job_queue.pause', {}, { loading: 'pauseJobqueue' })
},
}
+1 -1
View File
@@ -1,7 +1,7 @@
import Vue from 'vue'
import { getDefaultState } from './index'
import { MutationTree } from 'vuex'
import { ServerState, ServerStateNetworkInterface } from '@/store/server/types'
import { ServerState } from '@/store/server/types'
import { formatConsoleMessage, formatTime } from '@/plugins/helpers'
import { maxEventHistory } from '@/store/variables'
+1 -1
View File
@@ -48,7 +48,7 @@ export const actions: ActionTree<ServerTimelapseState, RootState> = {
}
},
saveSetting({ commit }, payload) {
saveSetting(_, payload) {
Vue.$socket.emit('machine.timelapse.post_settings', payload, { action: 'server/timelapse/initSettings' })
},