Skip to content

Commit

Permalink
lint fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Kusumgar committed Nov 6, 2024
1 parent 9b5c429 commit 8c51df0
Show file tree
Hide file tree
Showing 45 changed files with 49 additions and 67 deletions.
8 changes: 4 additions & 4 deletions app/static/src/apiService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import axios, { AxiosError, AxiosResponse } from "axios";
import { Commit } from "vuex";
import { freezer } from "./utils";
Expand Down Expand Up @@ -34,9 +34,9 @@ export interface API<S, E> {
get<T>(url: string): Promise<void | ResponseWithType<T>>;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
type OnError = (failure: ResponseFailure) => void;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type OnSuccess = (success: ResponseSuccess) => void;

export class APIService<S extends string, E extends string> implements API<S, E> {
Expand Down
4 changes: 2 additions & 2 deletions app/static/src/components/WodinPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default defineComponent({
// Only used as an indicator that redraw is required when this changes - the data to display is calculated by
// plotData function using these solutions
redrawWatches: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type: Array as PropType<any[]>,
required: true
},
Expand Down Expand Up @@ -102,7 +102,7 @@ export default defineComponent({
const lastYAxisFromZoom: Ref<Partial<LayoutAxis> | null> = ref(null);
const commitYAxisRange = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const plotLayout = (plot.value as any).layout;
const yRange = plotLayout.yaxis?.range;
if (plotLayout) {
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/components/WodinSession.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default defineComponent({
const appInitialised = computed(() => !!store.state.config && !!store.state.sessions.sessionsMetadata);
// These props won't change as provided by server
// eslint-disable-next-line vue/no-setup-props-destructure
const { appName, baseUrl, loadSessionId, appsPath, enableI18n, defaultLanguage } = props;
store.dispatch(AppStateAction.InitialiseApp, {
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/components/options/ParameterSetView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default defineComponent({
};
const saveButton = ref<HTMLButtonElement | null>(null);
const cancelEditDisplayName = (event: FocusEvent) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (event.relatedTarget && event.relatedTarget === (saveButton.value as any).$el) return;
store.commit(`run/${RunMutation.TurnOffDisplayNameError}`, props.parameterSet.name);
newDisplayName.value = props.parameterSet.displayName;
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/components/options/ParameterValues.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default defineComponent({
const paramVaryFlags = computed(() => {
return paramNames.value.reduce((values: Dict<boolean>, key: string) => {
// eslint-disable-next-line no-param-reassign
values[key] = paramsToVary.value.includes(key);
return values;
}, {} as Dict<boolean>);
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/components/run/RunPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const allPlotData = (start: number, end: number, points: number): WodinPlotData
const lineStylesForParamSets = computed(() => store.getters[`run/${RunGetter.lineStylesForParameterSets}`]);
const updatePlotTraceNameWithParameterSetName = (plotTrace: Partial<PlotData>, setName: string) => {
// eslint-disable-next-line no-param-reassign
plotTrace.name = `${plotTrace.name} (${setName})`;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default defineComponent({
const plotlyOptions = { includeLegendGroup: true };
const filterStochasticCentralOutput = (centralOutput: OdinSeriesSet) => {
// Only show summary and deterministic values as central for stochastic
// eslint-disable-next-line no-param-reassign
centralOutput.values = centralOutput.values.filter(
(v: DiscreteSeriesValues) => v.description !== "Individual"
);
Expand Down
4 changes: 2 additions & 2 deletions app/static/src/csvUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { WodinError } from "./types/responseTypes";
import { processFitData, ProcessFitDataResult } from "./utils";
import { SetDataPayload } from "./store/fitData/mutations";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
type OnError = (error: WodinError) => void;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type OnSuccess = (success: SetDataPayload) => void;
type PostSuccess = () => void;

Expand Down
8 changes: 4 additions & 4 deletions app/static/src/directives/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
if (typeof value === "string") {
// disabling no-new lint error as bootstrap
// needs the new keyword
// eslint-disable-next-line no-new
new Tooltip(el, {
title: value,
placement: "top",
Expand All @@ -27,7 +27,7 @@ export default {
});
} else {
const variant = value?.variant || "text";
// eslint-disable-next-line no-new
new Tooltip(el, {
title: value?.content || "",
placement: value?.placement || "top",
Expand All @@ -47,7 +47,7 @@ export default {
const variant = value?.variant || "text";
const oldCustomClass = variant === "text" ? "" : `tooltip-${variant}`;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isVariantSame = (tooltip as any)._config.customClass === oldCustomClass;
if (!isVariantSame) {
tooltip.dispose();
Expand All @@ -66,7 +66,7 @@ export default {
const content = typeof value === "string" ? value : value?.content || "";

if (tooltip) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const configuredTooltip = tooltip as any;
configuredTooltip._config.title = content;
const { trigger } = configuredTooltip._config;
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/excel/wodinExcelDownload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export abstract class WodinExcelDownload {

protected readonly _state: AppState;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected readonly _rootGetters: any;

protected readonly _commit: Commit;
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ export const updatePlotTraceName = (
if (parameterSetName) {
parenthesisItems.push(parameterSetName);
}
// eslint-disable-next-line no-param-reassign
plotTrace.name = `${plotTrace.name} (${parenthesisItems.join(" ")})`;
};
2 changes: 1 addition & 1 deletion app/static/src/serialise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const deserialiseState = (targetState: AppState, serialised: SerialisedAp
!graphs.config[0].selectedVariables.length &&
!graphs.config[0].unselectedVariables?.length
) {
/* eslint-disable no-param-reassign */
const selectedVariables = [...(model.odinModelResponse?.metadata?.variables || [])];
const unselectedVariables: string[] = [];

Expand Down
2 changes: 1 addition & 1 deletion app/static/src/store/basic/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { multiSensitivity } from "../multiSensitivity/multiSensitivity";

const language = getStoreModule();

/* eslint-disable @typescript-eslint/no-explicit-any */
const defaultState: () => any = () => {
return {
sessionId: newUid(),
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/store/fit/fit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { multiSensitivity } from "../multiSensitivity/multiSensitivity";

const language = getStoreModule();

/* eslint-disable @typescript-eslint/no-explicit-any */
const defaultState: () => any = () => {
return {
sessionId: newUid(),
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/store/stochastic/stochastic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { multiSensitivity } from "../multiSensitivity/multiSensitivity";

const language = getStoreModule();

/* eslint-disable @typescript-eslint/no-explicit-any */
const defaultState: () => any = () => {
return {
sessionId: newUid(),
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/types/responseTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface OdinParameter {
default: null | number;
min: null | number;
max: null | number;
// eslint-disable-next-line camelcase
is_integer: boolean;
rank: number;
}
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/types/utilTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { ActionContext } from "vuex";

export type Dict<V> = { [k: string]: V };

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type AppCtx = ActionContext<any, any>;
4 changes: 2 additions & 2 deletions app/static/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { AppState } from "./store/appState/state";
import { AdvancedComponentType, AdvancedSettings, Tag } from "./store/run/state";

export const freezer = {
/* eslint-disable @typescript-eslint/no-explicit-any */
deepFreeze: (data: unknown): unknown => {
if (Array.isArray(data)) {
return Object.freeze(data.map((d) => freezer.deepFreeze(d)));
Expand All @@ -36,7 +36,7 @@ export const freezer = {
}
};

/* eslint-disable no-eval */
export function evaluateScript<T>(script: string): T {
return eval(script) as T;
}
Expand Down
2 changes: 0 additions & 2 deletions app/static/src/wodin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { createApp } from "vue";
import Vuex from "vuex";
import WodinSession from "./components/WodinSession.vue";
import BasicApp from "./components/basic/BasicApp.vue";
import FitApp from "./components/fit/FitApp.vue";
import StochasticApp from "./components/stochastic/StochasticApp.vue";
import AppHeader from "./components/header/AppHeader.vue";
import { BasicState } from "./store/basic/state";
import { FitState } from "./store/fit/state";
import { StochasticState } from "./store/stochastic/state";
Expand Down
1 change: 0 additions & 1 deletion app/static/tests/e2e/code.etest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const expectMonacoDecoration = async (state: EditorStates, line: number, numOfLi
};

const expectMonacoHover = async (type: "glyph" | "content", line: number, message: string, page: Page) => {
const isGlyph = type === "glyph";
const hoverElem = type === "content" ?
`.view-overlays div:nth-child(${line}) >> div` :
".glyph-margin-widgets .fa-solid";
Expand Down
2 changes: 1 addition & 1 deletion app/static/tests/e2e/data.etest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test, Page } from "@playwright/test";
import { expect, test } from "@playwright/test";
import PlaywrightConfig from "../../playwright.config";
import { uploadCSVData } from "./utils";

Expand Down
1 change: 0 additions & 1 deletion app/static/tests/e2e/link.etest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect, test, Page } from "@playwright/test";
import PlaywrightConfig from "../../playwright.config";
import { uploadCSVData } from "./utils";
import { newValidCode } from "./code.etest";

export const newVariableCode = `# variables
deriv(S) <- - beta * S * J / N
Expand Down
2 changes: 1 addition & 1 deletion app/static/tests/e2e/stochastic.etest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, Page, test } from "@playwright/test";
import { expect, test } from "@playwright/test";
import PlaywrightConfig from "../../playwright.config";
import { expectSummaryValues } from "./utils";

Expand Down
2 changes: 1 addition & 1 deletion app/static/tests/e2e/tabs.etest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test, Page } from "@playwright/test";
import { expect, test } from "@playwright/test";

test.describe("Wodin App tabs tests", () => {
test.beforeEach(async ({ page }) => {
Expand Down
3 changes: 1 addition & 2 deletions app/static/tests/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FitState } from "../src/store/fit/state";
import { StochasticState } from "../src/store/stochastic/state";
import {
AdvancedOptions,
BatchPars,
OdinUserType,
ResponseFailure,
ResponseSuccess,
Expand Down Expand Up @@ -377,7 +376,7 @@ export const mockBatchParsDisplace = (

export const mockRunnerOde = () => {
return {
wodinRun: vi.fn((odin, pars, start, end) => "test solution" as any)
wodinRun: vi.fn(() => "test solution" as any)
} as any;
};

Expand Down
4 changes: 1 addition & 3 deletions app/static/tests/unit/components/downloadOutput.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import Vuex from "vuex";
import { shallowMount } from "@vue/test-utils";
import { mockBasicState, mockRunState } from "../../mocks";
import { mockBasicState } from "../../mocks";
import { BasicState } from "../../../src/store/basic/state";
import DownloadOutput from "../../../src/components/DownloadOutput.vue";

/* eslint-disable max-len */
const generatedFilenameRegex =
/^test-run-([0-9]{4})?(1[0-2]|0[1-9])?(3[01]|0[1-9]|[12][0-9])-(2[0-3]|[0-1][0-9])?([0-5][0-9])?([0-5][0-9])?$/;
/* eslint-disable max-len */
const generatedFilenameWithSuffixRegex =
/^test-run-([0-9]{4})?(1[0-2]|0[1-9])?(3[01]|0[1-9]|[12][0-9])-(2[0-3]|[0-1][0-9])?([0-5][0-9])?([0-5][0-9])?.xlsx$/;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mount, shallowMount } from "@vue/test-utils";
import { mount } from "@vue/test-utils";
import VueFeather from "vue-feather";
import { nextTick } from "vue";
import DraggableDialog from "../../../../src/components/help/DraggableDialog.vue";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { shallowMount } from "@vue/test-utils";
import Vuex from "vuex";
import MultiSensitivityTab from "../../../../src/components/multiSensitivity/MultiSensitivityTab.vue";
import { AppState, AppType } from "../../../../src/store/appState/state";
import { AppState } from "../../../../src/store/appState/state";
import LoadingButton from "../../../../src/components/LoadingButton.vue";
import { ModelState } from "../../../../src/store/model/state";
import { MultiSensitivityAction } from "../../../../src/store/multiSensitivity/actions";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import StandardFormInput from "../../../../src/components/options/StandardFormIn
import { AdvancedOptions } from "../../../../src/types/responseTypes";
import TagInput from "../../../../src/components/options/TagInput.vue";
import { ModelFitMutation } from "../../../../src/store/modelFit/mutations";
import { BaseSensitivityMutation, SensitivityMutation } from "../../../../src/store/sensitivity/mutations";
import { BaseSensitivityMutation } from "../../../../src/store/sensitivity/mutations";
import { AppType } from "../../../../src/store/appState/state";

describe("Advanced Settings", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vuex from "vuex";
import { nextTick } from "vue";
import { flushPromises, shallowMount } from "@vue/test-utils";
import { shallowMount } from "@vue/test-utils";
import VueFeather from "vue-feather";
import { BasicState } from "../../../../src/store/basic/state";
import { mockBasicState, mockRunState, mockModelState } from "../../../mocks";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ModelState } from "../../../../src/store/model/state";
import { getters } from "../../../../src/store/run/getters";
import { RunAction } from "../../../../src/store/run/actions";
import { RunMutation } from "../../../../src/store/run/mutations";
import { nextTick } from "vue";

describe("ParameterSets", () => {
const mockNewParameterSet = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { RunMutation, mutations as runMutations } from "../../../../src/store/ru
import { AppType, VisualisationTab } from "../../../../src/store/appState/state";
import { Mock } from "vitest";
import { ModelFitMutation } from "../../../../src/store/modelFit/mutations";
import { BaseSensitivityMutation, SensitivityMutation } from "../../../../src/store/sensitivity/mutations";
import { BaseSensitivityMutation } from "../../../../src/store/sensitivity/mutations";
import { ModelState } from "../../../../src/store/model/state";

const mockTooltipDirective = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("SensitivityPlotOptions", () => {
});

it("on mounted, initialises time to model end if null", () => {
const wrapper = getWrapper({ plotType: SensitivityPlotType.ValueAtTime, time: null });
getWrapper({ plotType: SensitivityPlotType.ValueAtTime, time: null });
expect(mockSetPlotTime).toHaveBeenCalledTimes(1);
expect(mockSetPlotTime.mock.calls[0][1]).toBe(100);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe("verifies valid plot settings time", () => {
});

it("does not update time if already valid", () => {
const state = getState(50, 100);
getState(50, 100);
expect(commit).not.toHaveBeenCalled();
});
});
2 changes: 0 additions & 2 deletions app/static/tests/unit/components/wodinSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { localStorageManager } from "../../../src/localStorageManager";
import { LanguageState } from "../../../translationPackage/store/state";
import { MockInstance } from "vitest";

const realLocation = window.location;

describe("WodinSession", () => {
const mockInitialiseApp = vi.fn();
const mockAddError = vi.fn();
Expand Down
2 changes: 1 addition & 1 deletion app/static/tests/unit/components/wodinTabs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("WodinTabs", () => {
// can click back too
await tabLinks.at(0)!.trigger("click");
expect(tabLinks.at(0)!.classes()).toContain("active");
expect(slotContainer.html())!.toContain("<div>ONE</div>");
expect(slotContainer.html()).toContain("<div>ONE</div>");
expect(wrapper.emitted("tabSelected")!.length).toBe(2);
expect(wrapper.emitted("tabSelected")![1]).toStrictEqual(["one"]);
});
Expand Down
1 change: 0 additions & 1 deletion app/static/tests/unit/palette.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe("interpolate colours", () => {

it("interpolates down", () => {
const p = interpolateColours(cols, 4);
const res = [p(0), p(1), p(2), p(3)];
expect(p(0)).toEqual(cols[0]); // lower bound
expect(p(3)).toEqual(cols[4]); // upper bound
expect(p(1)).toEqual("#6ab74d");
Expand Down
Loading

0 comments on commit 8c51df0

Please sign in to comment.