Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix lint issues #1111

Merged
merged 1 commit into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { WebSocketPlugin } from '@/plugins/webSocketClient'
import { registerSW } from 'virtual:pwa-register'

// noinspection JSUnusedGlobalSymbols
const updateSW = registerSW({
registerSW({
onOfflineReady() {},
})

Expand Down Expand Up @@ -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!')
})

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/build-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 0 additions & 1 deletion src/plugins/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
mdiEngine,
mdiGamepad,
mdiInformation,
mdiPrinter3d,
mdiPrinter3dNozzle,
mdiThermometerLines,
mdiWebcam,
Expand Down
4 changes: 2 additions & 2 deletions src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/store/editor/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/store/farm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion src/store/farm/printer/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 1 addition & 4 deletions src/store/files/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/store/files/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> = {
Expand Down
4 changes: 2 additions & 2 deletions src/store/gui/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/store/gui/console/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getters: GetterTree<GuiConsoleState, any> = {
return output
},

getConsoleClearedSince: (state, getters, rootState) => {
getConsoleClearedSince: (state) => {
return state.cleared_since
},
}
4 changes: 2 additions & 2 deletions src/store/gui/macros/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand All @@ -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)
},
Expand Down
1 change: 0 additions & 1 deletion src/store/gui/notifications/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
6 changes: 3 additions & 3 deletions src/store/gui/remoteprinters/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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 })
Expand All @@ -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 })

Expand Down
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions src/store/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/store/server/history/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 1 addition & 7 deletions src/store/server/history/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/store/server/jobQueue/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ 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 })
},

deleteFromQueue(_, job_ids: string[]) {
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' })
},
}
2 changes: 1 addition & 1 deletion src/store/server/mutations.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
2 changes: 1 addition & 1 deletion src/store/server/timelapse/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
},

Expand Down