Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: no any (#18574)

ecmadaod5325d358727
diff --git a/frontend/biome.json b/frontend/biome.json
index bbfde635de..4140fa67b5 100644
--- a/frontend/biome.json
+++ b/frontend/biome.json
@@ -57,7 +57,7 @@
"options": { "allow": ["warn", "error", "debug", "assert", "log"] }
},
"noDebugger": "error",
- "noExplicitAny": "off",
+ "noExplicitAny": "error",
"noExtraNonNullAssertion": "error",
"noMisleadingInstantiator": "error",
"noNonNullAssertedOptionalChain": "error",
diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs
index ca59a7b99a..b1b5750f45 100644
--- a/frontend/eslint.config.mjs
+++ b/frontend/eslint.config.mjs
@@ -39,7 +39,7 @@ export default [
],
"@intlify/vue-i18n/no-missing-keys": "error",
"@intlify/vue-i18n/no-raw-text": "off",
- "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-explicit-any": "error",
"vue/no-mutating-props": "error",
"vue/no-unused-components": "error",
"vue/no-useless-template-attributes": "error",
diff --git a/frontend/i18n.ts b/frontend/i18n.ts
index ecfd48c18c..4812d9301e 100644
--- a/frontend/i18n.ts
+++ b/frontend/i18n.ts
@@ -1,3 +1,4 @@
+import { unknown } from './src/types/common';
/* eslint-disable no-console */
import { config } from "dotenv";
import { promises as fs } from "fs";
@@ -122,13 +123,13 @@ async function translateJsonValue(
}
}
-async function loadJsonFile(filePath: string): Promise<any> {
+async function loadJsonFile(filePath: string): Promise<JsonObject> {
try {
const data = await fs.readFile(filePath, "utf8");
return JSON.parse(data);
} catch (error) {
console.error(`Error reading file ${filePath}:`, error);
- return null;
+ return {};
}
}
diff --git a/frontend/naive-ui.config.ts b/frontend/naive-ui.config.ts
index bafd5ae038..5bd5ce6b2d 100644
--- a/frontend/naive-ui.config.ts
+++ b/frontend/naive-ui.config.ts
@@ -7,7 +7,7 @@ import {
} from "naive-ui";
import { computed } from "vue";
import { callCssVariable } from "@/utils";
-import i18n from "./src/plugins/i18n";
+import { locale } from "./src/plugins/i18n";
export const themeOverrides = computed((): GlobalThemeOverrides => {
return {
@@ -67,7 +67,7 @@ export const darkThemeOverrides = computed((): GlobalThemeOverrides => {
});
const isZhCn = (): boolean => {
- return i18n.global.locale.value === "zh-CN";
+ return locale.value === "zh-CN";
};
export const dateLang = computed((): NDateLocale | null => {
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 68805cfa54..f4815d73e2 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -59,7 +59,7 @@ watchEffect(async () => {
overrideAppProfile();
});
-onErrorCaptured((error: any /* , _, info */) => {
+onErrorCaptured((error: unknown /* , _, info */) => {
if (
error instanceof ConnectError &&
Object.values(Code).includes(error.code)
@@ -67,12 +67,13 @@ onErrorCaptured((error: any /* , _, info */) => {
return;
}
- if (!error.response) {
+ const err = error as { response?: unknown; stack?: string };
+ if (!err.response) {
notificationStore.pushNotification({
module: "bytebase",
style: "CRITICAL",
title: `Internal error captured`,
- description: isDev() ? error.stack : undefined,
+ description: isDev() ? err.stack : undefined,
});
}
return true;
diff --git a/frontend/src/ExplainVisualizerApp.vue b/frontend/src/ExplainVisualizerApp.vue
index 0007eb7cce..4f9c7b04ad 100644
--- a/frontend/src/ExplainVisualizerApp.vue
+++ b/frontend/src/ExplainVisualizerApp.vue
@@ -45,7 +45,11 @@ import { readExplainFromToken } from "@/utils/pev2";
declare global {
interface Window {
QP: {
- showPlan: (container: Element, planXml: string, options?: any) => void;
+ showPlan: (
+ container: Element,
+ planXml: string,
+ options?: Record<string, unknown>
+ ) => void;
};
}
}
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
index df5ca0d759..6a6da3428e 100644
--- a/frontend/src/bbkit/types.ts
+++ b/frontend/src/bbkit/types.ts
@@ -7,7 +7,7 @@ export type BBButtonType =
export type BBButtonConfirmType = "NORMAL" | "DELETE" | "ARCHIVE" | "RESTORE";
-export type BBTabItem<T = any> = {
+export type BBTabItem<T = unknown> = {
title: string;
// Used as the anchor
id: string;
diff --git a/frontend/src/components/AuditLog/AuditLogDataTable.vue b/frontend/src/components/AuditLog/AuditLogDataTable.vue
index 3749d62b65..0e4e54f8e0 100644
--- a/frontend/src/components/AuditLog/AuditLogDataTable.vue
+++ b/frontend/src/components/AuditLog/AuditLogDataTable.vue
@@ -32,21 +32,14 @@ import {
AuditDataSchema,
AuditLog_Severity,
} from "@/types/proto-es/v1/audit_log_service_pb";
-import { type Issue, IssueService } from "@/types/proto-es/v1/issue_service_pb";
+import { IssueService } from "@/types/proto-es/v1/issue_service_pb";
import {
file_v1_plan_service,
- type Plan,
PlanService,
} from "@/types/proto-es/v1/plan_service_pb";
-import {
- type Rollout,
- RolloutService,
-} from "@/types/proto-es/v1/rollout_service_pb";
+import { RolloutService } from "@/types/proto-es/v1/rollout_service_pb";
import { SettingSchema } from "@/types/proto-es/v1/setting_service_pb";
-import {
- type ExportRequest,
- SQLService,
-} from "@/types/proto-es/v1/sql_service_pb";
+import { SQLService } from "@/types/proto-es/v1/sql_service_pb";
import { extractProjectResourceName, humanizeDurationV1 } from "@/utils";
import JSONStringView from "./JSONStringView.vue";
@@ -230,11 +223,17 @@ const columnList = computed((): AuditDataTableColumn[] => {
});
const getViewLink = (auditLog: AuditLog): string | null => {
- let parsedRequest: any;
- let parsedResponse: any;
+ let parsedRequest: Record<string, unknown>;
+ let parsedResponse: Record<string, unknown>;
try {
- parsedRequest = JSON.parse(auditLog.request || "{}");
- parsedResponse = JSON.parse(auditLog.response || "{}");
+ parsedRequest = JSON.parse(auditLog.request || "{}") as Record<
+ string,
+ unknown
+ >;
+ parsedResponse = JSON.parse(auditLog.response || "{}") as Record<
+ string,
+ unknown
+ >;
} catch {
return null;
}
@@ -245,16 +244,16 @@ const getViewLink = (auditLog: AuditLog): string | null => {
const sections = auditLog.method.split("/").filter((i) => i);
switch (sections[0]) {
case RolloutService.typeName:
- return (parsedResponse as Rollout).name;
+ return (parsedResponse["name"] as string) || null;
case PlanService.typeName:
- return (parsedResponse as Plan).name;
+ return (parsedResponse["name"] as string) || null;
case IssueService.typeName:
- return (parsedResponse as Issue).name;
- case SQLService.typeName:
+ return (parsedResponse["name"] as string) || null;
+ case SQLService.typeName: {
if (sections[1] !== "Export") {
return null;
}
- const name = (parsedRequest as ExportRequest).name;
+ const name = parsedRequest["name"] as string | undefined;
if (!name) {
return null;
}
@@ -263,6 +262,7 @@ const getViewLink = (auditLog: AuditLog): string | null => {
return null;
}
return `${projectNamePrefix}${projectId}/${rolloutNamePrefix}${rolloutId}`;
+ }
}
return null;
};
diff --git a/frontend/src/components/DataExportButton.vue b/frontend/src/components/DataExportButton.vue
index 9f6a292916..8e8b650ab4 100644
--- a/frontend/src/components/DataExportButton.vue
+++ b/frontend/src/components/DataExportButton.vue
@@ -202,7 +202,7 @@ const emit = defineEmits<{
event: "export",
option: {
resolve: (content: DownloadContent[]) => void;
- reject: (reason?: any) => void;
+ reject: (reason?: unknown) => void;
options: ExportOption;
}
): Promise<void>;
diff --git a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue
index b7094d90ad..0aa4594640 100644
--- a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue
+++ b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue
@@ -45,11 +45,11 @@
</div>
</div>
<NButton
- v-if="item.hasNext(item.token)"
+ v-if="checkHasNext(item)"
size="small"
quaternary
:loading="item.loading"
- @click="() => loadMoreDatabase(item)"
+ @click="loadMore(item)"
>
{{ $t("common.load-more") }}
</NButton>
@@ -95,10 +95,18 @@ interface DatabaseMatchList<T> {
loadMore: (token: T) => Promise<{ databases: ComposedDatabase[]; token: T }>;
}
+type AnyDatabaseMatchList =
+ | DatabaseMatchList<number>
+ | DatabaseMatchList<string>;
+
+const checkHasNext = (item: AnyDatabaseMatchList): boolean => {
+ return (item.hasNext as (token: number | string) => boolean)(item.token);
+};
+
interface LocalState {
loading: boolean;
matchingError?: string;
- databaseMatchLists: DatabaseMatchList<any>[];
+ databaseMatchLists: AnyDatabaseMatchList[];
collapseExpandedNames: string[];
}
@@ -181,19 +189,26 @@ const state = reactive<LocalState>({
});
// biome-ignore format: ESLint requires trailing comma for generic type parameter
-const loadMoreDatabase = async <T,>(state: DatabaseMatchList<T>) => {
- state.loading = true;
+const loadMoreDatabase = async <T,>(item: DatabaseMatchList<T>) => {
+ item.loading = true;
try {
- const { databases, token } = await state.loadMore(state.token);
- state.token = token;
- state.databaseList.push(
+ const { databases, token } = await item.loadMore(item.token);
+ item.token = token;
+ item.databaseList.push(
...databases.filter((database) => isValidDatabaseName(database.name))
);
} finally {
- state.loading = false;
+ item.loading = false;
}
};
+const loadMore = (item: AnyDatabaseMatchList) => {
+ if (item.name === "matched") {
+ return loadMoreDatabase(item as DatabaseMatchList<number>);
+ }
+ return loadMoreDatabase(item as DatabaseMatchList<string>);
+};
+
watch(
[
() => state.databaseMatchLists[0].databaseList.length,
@@ -230,9 +245,7 @@ const updateDatabaseMatchingState = useDebounceFn(async () => {
state.matchingError = undefined;
state.databaseMatchLists = getInitialState();
matchedDatabaseNameList.value = matchedDatabaseList;
- await Promise.all(
- state.databaseMatchLists.map((item) => loadMoreDatabase(item))
- );
+ await Promise.all(state.databaseMatchLists.map((item) => loadMore(item)));
} catch (error) {
state.matchingError = (error as ConnectError).message;
} finally {
diff --git a/frontend/src/components/HelpDrawer/config.ts b/frontend/src/components/HelpDrawer/config.ts
index 72ed206af3..56e3327d9a 100644
--- a/frontend/src/components/HelpDrawer/config.ts
+++ b/frontend/src/components/HelpDrawer/config.ts
@@ -1,6 +1,6 @@
-import { Tag } from "@markdoc/markdoc";
+import { type Config, type Node, type Schema, Tag } from "@markdoc/markdoc";
-export const markdocConfig = {
+export const markdocConfig: { nodes: Record<string, Schema> } = {
nodes: {
link: {
render: "a",
@@ -8,7 +8,7 @@ export const markdocConfig = {
href: { type: String, required: true },
target: { type: String, default: "_blank" },
},
- transform(node: any, config: any) {
+ transform(node: Node, config: Config) {
const attributes = node.transformAttributes(config);
const children = node.transformChildren(config);
Object.assign(attributes, { target: "_blank" });
diff --git a/frontend/src/components/InputWithTemplate/InputWithTemplate.vue b/frontend/src/components/InputWithTemplate/InputWithTemplate.vue
index 2d8aa7274d..728e28e4a6 100644
--- a/frontend/src/components/InputWithTemplate/InputWithTemplate.vue
+++ b/frontend/src/components/InputWithTemplate/InputWithTemplate.vue
@@ -22,7 +22,7 @@
<div
v-for="(data, i) in state.templateInputs"
:key="i"
- :ref="(el: any) => (itemRefs[i] = el)"
+ :ref="(el) => (itemRefs[i] = el as HTMLElement)"
>
<BBBadge
v-if="data.type == 'template'"
diff --git a/frontend/src/components/InstanceForm/Buttons.vue b/frontend/src/components/InstanceForm/Buttons.vue
index 0b10db609f..d4500b6340 100644
--- a/frontend/src/components/InstanceForm/Buttons.vue
+++ b/frontend/src/components/InstanceForm/Buttons.vue
@@ -347,7 +347,7 @@ const doUpdate = async () => {
// 2. Update the admin datasource.
// 3. Create OR update read-only data source(s).
- const pendingRequestRunners: (() => Promise<any>)[] = [];
+ const pendingRequestRunners: (() => Promise<unknown>)[] = [];
const maybeQueueUpdateInstanceBasicInfo = () => {
const currentLabels = convertKVListToLabels(labelKVList.value, false);
diff --git a/frontend/src/components/InstanceForm/Form.vue b/frontend/src/components/InstanceForm/Form.vue
index 299dfa58b0..587bdd58ff 100644
--- a/frontend/src/components/InstanceForm/Form.vue
+++ b/frontend/src/components/InstanceForm/Form.vue
@@ -8,9 +8,9 @@
class="w-full grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2"
@update:engine="(newEngine: Engine) => changeInstanceEngine(newEngine)"
>
- <template #suffix="{ engine }: { engine: Engine }">
+ <template #suffix="{ engine }">
<BBBetaBadge
- v-if="isEngineBeta(engine)"
+ v-if="isEngineBeta(engine as Engine)"
class="absolute -top-1.5 -right-1 rounded-sm text-xs bg-gray-500! px-1 py-0! z-10"
/>
</template>
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
index d2998ad03e..e6661d0f30 100644
--- a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
+++ b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
@@ -59,7 +59,7 @@ const props = withDefaults(
overrideScopeIdList?: SearchScopeId[];
autofocus?: boolean;
components?: SearchComponent[];
- componentProps?: Partial<Record<SearchComponent, any>>;
+ componentProps?: Partial<Record<SearchComponent, Record<string, unknown>>>;
defaultParams?: SearchParams;
}>(),
{
diff --git a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
index c1b9f5ef12..d4c0c5417d 100644
--- a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
+++ b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
@@ -45,7 +45,7 @@
:placeholder="placeholder || $t('issue.leave-a-comment')"
:maxlength="maxlength"
@mousedown="clearIssuePanel"
- @input="(e: any) => sizeToFit(e.target)"
+ @input="(e: Event) => sizeToFit(e.target as HTMLTextAreaElement)"
@keyup="(e: KeyboardEvent) => adjustIssuePanelWithPosition(e)"
@keydown.enter="keyboardHandler"
@keydown.down="handleArrowDown"
@@ -617,7 +617,7 @@ const createDivCopyForTextarea = (textArea: HTMLTextAreaElement) => {
copy.textContent = textArea.value;
const style = getComputedStyle(textArea);
- [
+ const styleKeys = [
"fontFamily",
"fontSize",
"fontWeight",
@@ -627,7 +627,8 @@ const createDivCopyForTextarea = (textArea: HTMLTextAreaElement) => {
"borderTopWidth",
"borderRightWidth",
"borderBottomWidth",
- ].forEach(function (key: any) {
+ ] as const;
+ styleKeys.forEach((key) => {
copy.style[key] = style[key];
});
diff --git a/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.ts b/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.ts
index 26a7abdf6c..259b91e8ad 100644
--- a/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.ts
+++ b/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.ts
@@ -4,7 +4,7 @@ import { computed, ref, watchEffect } from "vue";
interface WebSocketMessage {
method: string;
- params: any;
+ params: unknown;
}
interface StatementRangeMessage {
diff --git a/frontend/src/components/MonacoEditor/lsp-client.ts b/frontend/src/components/MonacoEditor/lsp-client.ts
index 1ddccb94d7..a51411f73a 100644
--- a/frontend/src/components/MonacoEditor/lsp-client.ts
+++ b/frontend/src/components/MonacoEditor/lsp-client.ts
@@ -52,7 +52,7 @@ const connectWebSocket = () => {
const connect = (
resolve: (value: WebSocket | PromiseLike<WebSocket>) => void,
- reject: (reason?: any) => void
+ reject: (reason?: unknown) => void
) => {
const ws = new WebSocket(conn.url);
const retries = conn.retries++;
@@ -255,7 +255,7 @@ export const initializeLSPClient = () => {
export const executeCommand = async (
client: MonacoLanguageClient,
command: string,
- args: any[] | undefined
+ args: unknown[] | undefined
) => {
const executeCommandParams: ExecuteCommandParams = {
command,
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/FlagsForm.vue b/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/FlagsForm.vue
index a4b4a172be..a928da2f86 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/FlagsForm.vue
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/FlagsForm.vue
@@ -62,21 +62,21 @@ const emit = defineEmits<{
(event: "update:flags", flags: Record<string, string>): void;
}>();
-const getBoolValue = (param: GhostParameter<"bool">) => {
+const getBoolValue = (param: GhostParameter) => {
const { key, defaults: value } = param;
if (props.flags[key] === "true") return true;
if (props.flags[key] === "false") return false;
return value === "true";
};
-const getStringValue = (param: GhostParameter<"string">) => {
+const getStringValue = (param: GhostParameter) => {
return props.flags[param.key] ?? "";
};
-const getIntValue = (param: GhostParameter<"int">) => {
+const getIntValue = (param: GhostParameter) => {
const intVal = parseInt(props.flags[param.key], 10);
if (Number.isNaN(intVal)) return undefined;
return String(intVal);
};
-const getFloatValue = (param: GhostParameter<"float">) => {
+const getFloatValue = (param: GhostParameter) => {
return props.flags[param.key];
};
@@ -89,7 +89,7 @@ const setBoolValue = (param: GhostParameter, value: boolean) => {
}
emit("update:flags", updated);
};
-const setStringValue = (param: GhostParameter<"string">, value: string) => {
+const setStringValue = (param: GhostParameter, value: string) => {
const updated = { ...props.flags };
const { key } = param;
value = value.trim();
@@ -100,7 +100,7 @@ const setStringValue = (param: GhostParameter<"string">, value: string) => {
}
emit("update:flags", updated);
};
-const setIntValue = (param: GhostParameter<"int">, value: number) => {
+const setIntValue = (param: GhostParameter, value: number) => {
const updated = { ...props.flags };
const { key } = param;
if (!Number.isNaN(value)) {
@@ -110,7 +110,7 @@ const setIntValue = (param: GhostParameter<"int">, value: number) => {
}
emit("update:flags", updated);
};
-const setFloatValue = (param: GhostParameter<"float">, value: string) => {
+const setFloatValue = (param: GhostParameter, value: string) => {
const updated = { ...props.flags };
const { key } = param;
value = value.trim();
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/constants.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/constants.ts
index c7701f0f1d..2218cd2c86 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/constants.ts
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/FlagsForm/constants.ts
@@ -1,10 +1,11 @@
export type GhostParameterType = "bool" | "int" | "float" | "string";
-export type GhostParameter<T extends GhostParameterType = any> = {
- key: string;
- type: T;
- defaults: string;
-};
+export type GhostParameter<T extends GhostParameterType = GhostParameterType> =
+ {
+ key: string;
+ type: T;
+ defaults: string;
+ };
export const SupportedGhostParameters: GhostParameter[] = [
{ key: "attempt-instant-ddl", type: "bool", defaults: "true" },
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
index e10d2af38e..64268de47d 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
@@ -16,6 +16,7 @@
</template>
<script lang="tsx" setup>
+import type { Timestamp as TimestampProto } from "@bufbuild/protobuf/wkt";
import dayjs from "dayjs";
import { last } from "lodash-es";
import { CalendarClockIcon } from "lucide-vue-next";
@@ -165,7 +166,7 @@ const getLatestTaskRun = (task: Task) => {
};
// Format full datetime for display
-const formatFullDateTime = (timestamp: any) => {
+const formatFullDateTime = (timestamp?: TimestampProto) => {
const timestampInMilliseconds = getTimeForPbTimestampProtoEs(timestamp, 0);
return dayjs(timestampInMilliseconds).local().format();
};
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskView.vue b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
index 2a4db6ebd6..1f4d683738 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
@@ -143,6 +143,7 @@
</template>
<script setup lang="ts">
+import type { Timestamp } from "@bufbuild/protobuf/wkt";
import dayjs from "dayjs";
import { last } from "lodash-es";
import { CalendarClockIcon, LinkIcon } from "lucide-vue-next";
@@ -256,7 +257,7 @@ const relatedSpec = computed(() => {
return plan.value.specs.find((spec) => spec.id === task.value.specId);
});
-const formatFullDateTime = (timestamp: any) => {
+const formatFullDateTime = (timestamp?: Timestamp) => {
const timestampInMilliseconds = getTimeForPbTimestampProtoEs(timestamp, 0);
return dayjs(timestampInMilliseconds).local().format();
};
diff --git a/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue b/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue
index c8dec3ce1c..b5c4078680 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue
@@ -126,7 +126,7 @@ const loadAllTargets = async () => {
);
// Batch fetch all targets
- const fetchPromises: Promise<any>[] = [];
+ const fetchPromises: Promise<unknown>[] = [];
if (databaseTargets.length > 0) {
fetchPromises.push(batchGetOrFetchDatabases(databaseTargets));
diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.ts
index 3ee04d91c2..a064e4f361 100644
--- a/frontend/src/components/Plan/logic/initialize/index.ts
+++ b/frontend/src/components/Plan/logic/initialize/index.ts
@@ -208,7 +208,7 @@ export function useInitializePlan(
issue.value = result.issue;
rollout.value = result.rollout;
isInitializing.value = false;
- } catch (error: any) {
+ } catch (error: unknown) {
// Check Connect error type and handle accordingly
if (error instanceof ConnectError) {
if (error.code === Code.NotFound) {
diff --git a/frontend/src/components/Plan/logic/initialize/util.ts b/frontend/src/components/Plan/logic/initialize/util.ts
index 814575112f..997ad282ab 100644
--- a/frontend/src/components/Plan/logic/initialize/util.ts
+++ b/frontend/src/components/Plan/logic/initialize/util.ts
@@ -17,7 +17,7 @@ export const extractInitialSQLFromQuery = async (
}
const sqlStorageKey = query.sqlStorageKey;
if (sqlStorageKey && typeof sqlStorageKey === "string") {
- const sql = (await storageStore.get(sqlStorageKey)) || "";
+ const sql = (await storageStore.get<string>(sqlStorageKey)) || "";
return {
sql,
};
diff --git a/frontend/src/components/Rollout/RolloutDataTable.vue b/frontend/src/components/Rollout/RolloutDataTable.vue
index 4c25bdda68..833ae40043 100644
--- a/frontend/src/components/Rollout/RolloutDataTable.vue
+++ b/frontend/src/components/Rollout/RolloutDataTable.vue
@@ -24,6 +24,7 @@ import { EnvironmentV1Name } from "@/components/v2";
import { useEnvironmentV1Store } from "@/store";
import type {
Rollout,
+ Stage,
Task_Status,
} from "@/types/proto-es/v1/rollout_service_pb";
import {
@@ -50,8 +51,8 @@ const { t } = useI18n();
const router = useRouter();
const environmentStore = useEnvironmentV1Store();
-const getStageTaskCount = (stage: any, status: Task_Status) => {
- return stage.tasks.filter((task: any) => task.status === status).length;
+const getStageTaskCount = (stage: Stage, status: Task_Status) => {
+ return stage.tasks.filter((task) => task.status === status).length;
};
const columnList = computed(
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
index 0ad9f40e76..4722a6353e 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue
@@ -507,7 +507,8 @@ const getColumnKey = (column: ColumnMetadata) => {
};
const vlRef = computed(() => {
- return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef
+ // biome-ignore lint/suspicious/noExplicitAny: accessing internal naive-ui refs
+ return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef // eslint-disable-line @typescript-eslint/no-explicit-any
?.virtualListRef;
});
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue
index 579dd42f05..cfdd06a5dc 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue
+++ b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue
@@ -267,7 +267,8 @@ const getTableKey = (table: TableMetadata) => {
};
const vlRef = computed(() => {
- return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef
+ // biome-ignore lint/suspicious/noExplicitAny: accessing internal naive-ui refs
+ return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef // eslint-disable-line @typescript-eslint/no-explicit-any
?.virtualListRef;
});
useConsumePendingScrollToTable(
diff --git a/frontend/src/components/SchemaEditorLite/Panels/common/common.ts b/frontend/src/components/SchemaEditorLite/Panels/common/common.ts
index f84b3ef7b9..9bfd0f75e3 100644
--- a/frontend/src/components/SchemaEditorLite/Panels/common/common.ts
+++ b/frontend/src/components/SchemaEditorLite/Panels/common/common.ts
@@ -1,10 +1,19 @@
import { v1 as uuidv1 } from "uuid";
import type { EditStatus } from "../../types";
-export const markUUID = (obj: any) => {
+// Hidden properties added to schema objects
+interface HiddenProps {
+ __uuid?: string;
+ __status_before_drop?: EditStatus;
+}
+
+type ObjectWithHiddenProps = object & HiddenProps;
+
+export const markUUID = (obj: object): string => {
// column.name is editable, so we need to insert another hidden field
// as a column's stable unique key.
- if (!obj.__uuid) {
+ const target = obj as ObjectWithHiddenProps;
+ if (!target.__uuid) {
// Make this field 'invisible' to avoid it breaks lodash's deep comparing
Object.defineProperty(obj, "__uuid", {
enumerable: false,
@@ -13,10 +22,10 @@ export const markUUID = (obj: any) => {
value: uuidv1(),
});
}
- return obj.__uuid as string;
+ return target.__uuid as string;
};
-export const markEditStatusBeforeDrop = (obj: any, status: EditStatus) => {
+export const markEditStatusBeforeDrop = (obj: object, status: EditStatus) => {
Object.defineProperty(obj, "__status_before_drop", {
enumerable: false,
writable: true,
@@ -25,6 +34,8 @@ export const markEditStatusBeforeDrop = (obj: any, status: EditStatus) => {
});
};
-export const getEditStatusBeforeDrop = (obj: any) => {
- return obj["__status_before_drop"] as EditStatus | undefined;
+export const getEditStatusBeforeDrop = (
+ obj: object
+): EditStatus | undefined => {
+ return (obj as ObjectWithHiddenProps).__status_before_drop;
};
diff --git a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue
index 674a7770e4..7e31532137 100644
--- a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue
+++ b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue
@@ -21,7 +21,7 @@
class="grid-cols-3 gap-2"
@update:value="onMaskingTypeChange($event as MaskingType)"
>
- <template #item="{ option }: RadioGridItem<MaskingType>">
+ <template #item="{ option }">
{{ option.label }}
</template>
</RadioGrid>
@@ -308,7 +308,7 @@ import {
import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
import RequiredStar from "@/components/RequiredStar.vue";
-import type { RadioGridItem, RadioGridOption } from "@/components/v2";
+import type { RadioGridOption } from "@/components/v2";
import {
Drawer,
DrawerContent,
diff --git a/frontend/src/components/misc/ErrorList.vue b/frontend/src/components/misc/ErrorList.vue
index e43a6f05e3..e4b1ece61c 100644
--- a/frontend/src/components/misc/ErrorList.vue
+++ b/frontend/src/components/misc/ErrorList.vue
@@ -22,7 +22,7 @@ export type NestedError = {
export type ErrorItem = string | JSX.Element | NestedError;
-const isJSXElement = (item: any): item is JSX.Element => {
+const isJSXElement = (item: unknown): item is JSX.Element => {
return isVNode(item);
};
diff --git a/frontend/src/components/v2/Button/ContextMenuButton.vue b/frontend/src/components/v2/Button/ContextMenuButton.vue
index b4f8805b1c..4b4240b1d0 100644
--- a/frontend/src/components/v2/Button/ContextMenuButton.vue
+++ b/frontend/src/components/v2/Button/ContextMenuButton.vue
@@ -35,6 +35,7 @@ import { useLocalStorage } from "@vueuse/core";
import { head } from "lodash-es";
import type { ButtonGroupProps, SelectOption } from "naive-ui";
import { NButton, NButtonGroup, NPopselect } from "naive-ui";
+import type { CSSProperties } from "vue";
import { computed, ref } from "vue";
import type { ContextMenuButtonAction } from "./types";
@@ -111,7 +112,7 @@ const changeActionKey = (key: string) => {
};
const dropdownButtonStyle = (action: ContextMenuButtonAction) => {
- const style: Record<string, any> = {
+ const style: CSSProperties = {
"--n-padding": "0 6px",
};
if (action.props?.type === "primary") {
diff --git a/frontend/src/components/v2/Form/RadioGrid.vue b/frontend/src/components/v2/Form/RadioGrid.vue
index c320cf43bc..63cd9f09b0 100644
--- a/frontend/src/components/v2/Form/RadioGrid.vue
+++ b/frontend/src/components/v2/Form/RadioGrid.vue
@@ -19,11 +19,7 @@
class="pointer-events-none"
v-bind="radioProps ? radioProps(option.value, index) : undefined"
/>
- <slot
- name="item"
- :option="option as RadioGridOption<any>"
- :index="index"
- />
+ <slot name="item" :option="option" :index="index" />
</div>
</NButton>
</div>
diff --git a/frontend/src/components/v2/Form/ResourceIdField.vue b/frontend/src/components/v2/Form/ResourceIdField.vue
index 7ca20c54dd..48bc04e1cd 100644
--- a/frontend/src/components/v2/Form/ResourceIdField.vue
+++ b/frontend/src/components/v2/Form/ResourceIdField.vue
@@ -113,7 +113,7 @@ const props = withDefaults(
editingClass?: string;
validate?: (resourceId: ResourceId) => Promise<ValidatedMessage[]>;
// fetchResource will be used to check if the resource id is duplicate.
- fetchResource?: (resourceId: ResourceId) => Promise<any>;
+ fetchResource?: (resourceId: ResourceId) => Promise<unknown>;
}>(),
{
value: "",
diff --git a/frontend/src/components/v2/Form/SpinnerButton.vue b/frontend/src/components/v2/Form/SpinnerButton.vue
index c5861b742d..07bf8d7a3b 100644
--- a/frontend/src/components/v2/Form/SpinnerButton.vue
+++ b/frontend/src/components/v2/Form/SpinnerButton.vue
@@ -38,7 +38,7 @@ import { computed, ref, useAttrs } from "vue";
import type { VueClass } from "@/utils";
export interface SpinnerButtonProps extends /* @vue-ignore */ ButtonProps {
- onConfirm: () => Promise<any>;
+ onConfirm: () => Promise<void>;
tooltip?: string;
tooltipClass?: VueClass;
popconfirmProps?: PopconfirmProps;
diff --git a/frontend/src/components/v2/Form/SpinnerSelect.vue b/frontend/src/components/v2/Form/SpinnerSelect.vue
index f6cea120b3..505baebf6c 100644
--- a/frontend/src/components/v2/Form/SpinnerSelect.vue
+++ b/frontend/src/components/v2/Form/SpinnerSelect.vue
@@ -15,7 +15,7 @@ import { NSelect, type SelectProps } from "naive-ui";
import { ref } from "vue";
export interface SpinnerSelectProps extends /* @vue-ignore */ SelectProps {
- onUpdate: (value: string | undefined) => Promise<any>;
+ onUpdate: (value: string | undefined) => Promise<void>;
}
const props = defineProps<SpinnerSelectProps>();
diff --git a/frontend/src/components/v2/Form/SpinnerSwitch.vue b/frontend/src/components/v2/Form/SpinnerSwitch.vue
index 26cc38db2c..2b53391ea5 100644
--- a/frontend/src/components/v2/Form/SpinnerSwitch.vue
+++ b/frontend/src/components/v2/Form/SpinnerSwitch.vue
@@ -7,7 +7,7 @@ import { NSwitch, type SwitchProps } from "naive-ui";
import { ref } from "vue";
export interface SpinnerSwitchProps extends /* @vue-ignore */ SwitchProps {
- onToggle: (on: boolean) => Promise<any>;
+ onToggle: (on: boolean) => Promise<void>;
}
const props = defineProps<SpinnerSwitchProps>();
diff --git a/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue b/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue
index 27a654c83c..d887d37597 100644
--- a/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue
+++ b/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue
@@ -4,10 +4,10 @@
:options="options"
@update:value="$emit('update:engine', $event as Engine)"
>
- <template #item="{ option }: RadioGridItem<Engine>">
+ <template #item="{ option }">
<div class="flex flex-row items-center gap-x-1">
<RichEngineName
- :engine="option.value"
+ :engine="option.value as Engine"
tag="p"
class="text-center text-sm text-main!"
/>
@@ -19,11 +19,7 @@
<script setup lang="ts">
import { computed } from "vue";
-import {
- RadioGrid,
- type RadioGridItem,
- type RadioGridOption,
-} from "@/components/v2";
+import { RadioGrid, type RadioGridOption } from "@/components/v2";
import type { Engine } from "@/types/proto-es/v1/common_pb";
import { engineNameV1 } from "@/utils";
import RichEngineName from "./RichEngineName.vue";
diff --git a/frontend/src/components/v2/Model/Project/ProjectOperations.vue b/frontend/src/components/v2/Model/Project/ProjectOperations.vue
index 59e6e4bb90..ce84544b93 100644
--- a/frontend/src/components/v2/Model/Project/ProjectOperations.vue
+++ b/frontend/src/components/v2/Model/Project/ProjectOperations.vue
@@ -174,12 +174,13 @@ const handleBatchArchive = async () => {
state.showArchiveConfirm = false;
state.force = false;
emit("update");
- } catch (error: any) {
+ } catch (error: unknown) {
+ const err = error as { message?: string };
pushNotification({
module: "bytebase",
style: "CRITICAL",
title: t("project.batch.archive.error"),
- description: error.message,
+ description: err.message,
});
} finally {
state.loading = false;
diff --git a/frontend/src/composables/useEmitteryEventListener.ts b/frontend/src/composables/useEmitteryEventListener.ts
index 8a6c4e09f4..2a4455aa1f 100644
--- a/frontend/src/composables/useEmitteryEventListener.ts
+++ b/frontend/src/composables/useEmitteryEventListener.ts
@@ -7,16 +7,12 @@ import type {
import { onUnmounted } from "vue";
export const useEmitteryEventListener = <
- EventData = Record<EventName, any>,
+ EventData = Record<EventName, unknown>,
AllEventData = EventData & OmnipresentEventData,
DatalessEvents = DatalessEventNames<EventData>,
- E extends keyof AllEventData = any,
+ E extends keyof AllEventData = keyof AllEventData,
>(
- target: Emittery<
- EventData, // TODO: Use `unknown` instead of `any`.
- AllEventData,
- DatalessEvents
- >,
+ target: Emittery<EventData, AllEventData, DatalessEvents>,
event: E | readonly E[],
listener: (eventData: AllEventData[E]) => void | Promise<void>
) => {
diff --git a/frontend/src/composables/utils.ts b/frontend/src/composables/utils.ts
index 307eca37d4..6de5350e7c 100644
--- a/frontend/src/composables/utils.ts
+++ b/frontend/src/composables/utils.ts
@@ -89,17 +89,14 @@ const flattenNoSQLColumn = (value: unknown): unknown => {
}
}
- return Object.keys(dict).reduce(
- (d, key) => {
- d[key] = flattenNoSQLColumn(dict[key]);
- return d;
- },
- {} as { [key: string]: any }
- );
+ return Object.keys(dict).reduce<Record<string, unknown>>((d, key) => {
+ d[key] = flattenNoSQLColumn(dict[key]);
+ return d;
+ }, {});
};
const convertAnyToRowValue = (
- value: any,
+ value: unknown,
nested: boolean
): { value: RowValue; type: string } => {
switch (typeof value) {
@@ -329,7 +326,7 @@ const getNoSQLRows = (row: QueryRow): NoSQLRowData[] | undefined => {
return;
}
const parsedRow = JSON.parse(row.values[0].kind.value) as {
- [key: string]: any;
+ [key: string]: Record<string, unknown>;
};
const results: NoSQLRowData[] = [];
diff --git a/frontend/src/customAppProfile.ts b/frontend/src/customAppProfile.ts
index 183cecccc6..bedda3f506 100644
--- a/frontend/src/customAppProfile.ts
+++ b/frontend/src/customAppProfile.ts
@@ -1,5 +1,5 @@
import { computed } from "vue";
-import i18n from "./plugins/i18n";
+import { locale } from "./plugins/i18n";
import { useActuatorV1Store, useSettingByName } from "./store";
import { defaultAppProfile } from "./types";
import {
@@ -23,7 +23,7 @@ export const overrideAppProfile = () => {
const query = new URLSearchParams(window.location.search);
const lang = query.get("lang");
if (lang) {
- i18n.global.locale.value = lang;
+ locale.value = lang;
}
};
diff --git a/frontend/src/plugins/ai/store/conversation.ts b/frontend/src/plugins/ai/store/conversation.ts
index d0d6edc6be..73d41315d8 100644
--- a/frontend/src/plugins/ai/store/conversation.ts
+++ b/frontend/src/plugins/ai/store/conversation.ts
@@ -115,7 +115,7 @@ export const useConversationStore = defineStore("ai-conversation", () => {
"bb.plugin.ai.conversations"
);
const messages = new PouchDB<MessageEntity>("bb.plugin.ai.messages");
- const ready: Promise<any>[] = [];
+ const ready: Promise<unknown>[] = [];
ready.push(
messages.createIndex({
index: { name: FK_MESSAGE_CONVERSATION_ID, fields: ["conversation_id"] },
diff --git a/frontend/src/plugins/i18n-messages.ts b/frontend/src/plugins/i18n-messages.ts
index 19da97bc90..61311b9e75 100644
--- a/frontend/src/plugins/i18n-messages.ts
+++ b/frontend/src/plugins/i18n-messages.ts
@@ -3,30 +3,31 @@ import { merge } from "lodash-es";
const localPathPrefix = "../locales/";
type LocaleModule = { default: Record<string, unknown> };
+export type LocaleMessageObject = {
+ [key: string]: string | LocaleMessageObject;
+};
+
// import i18n resources
// https://vitejs.dev/guide/features.html#glob-import
export const mergedLocalMessage = Object.entries(
import.meta.glob("../locales/**/*.json", { eager: true })
-).reduce(
- (map, [key, value]) => {
- const name = key.slice(localPathPrefix.length, -5);
- const sections = name.split("/");
- if (sections.length === 1) {
- map[name] = merge((value as LocaleModule).default, map[name] || {});
- } else {
- const file = sections.slice(-1)[0];
- const sectionsName = sections[0];
- const existed = map[file] || {};
- map[file] = {
- ...existed,
- [sectionsName]: merge(
- (value as LocaleModule).default,
- existed[sectionsName] || {}
- ),
- };
- }
+).reduce<LocaleMessageObject>((map, [key, value]) => {
+ const name = key.slice(localPathPrefix.length, -5);
+ const sections = name.split("/");
+ if (sections.length === 1) {
+ map[name] = merge((value as LocaleModule).default, map[name] || {});
+ } else {
+ const file = sections.slice(-1)[0];
+ const sectionsName = sections[0];
+ const existed = (map[file] || {}) as LocaleMessageObject;
+ map[file] = {
+ ...existed,
+ [sectionsName]: merge(
+ (value as LocaleModule).default,
+ existed[sectionsName] || {}
+ ),
+ };
+ }
- return map;
- },
- {} as { [k: string]: any }
-);
+ return map;
+}, {});
diff --git a/frontend/src/plugins/i18n.test.ts b/frontend/src/plugins/i18n.test.ts
index 0d242fab2b..65bb37b355 100644
--- a/frontend/src/plugins/i18n.test.ts
+++ b/frontend/src/plugins/i18n.test.ts
@@ -1,3 +1,4 @@
+import { isEqual } from "lodash-es";
import { describe, expect, test } from "vitest";
import { Engine } from "@/types/proto-es/v1/common_pb";
import { SQLReviewRule_Level } from "@/types/proto-es/v1/review_config_service_pb";
@@ -6,7 +7,19 @@ import {
ruleTypeToString,
TEMPLATE_LIST_V2,
} from "../types/sqlReview";
-import { mergedLocalMessage } from "./i18n-messages";
+import { type LocaleMessageObject, mergedLocalMessage } from "./i18n-messages";
+
+// Helper to safely access nested locale objects
+const getNestedObject = (
+ obj: LocaleMessageObject,
+ key: string
+): LocaleMessageObject => {
+ const value = obj[key];
+ if (typeof value === "string") {
+ throw new Error(`Expected object at key "${key}", got string`);
+ }
+ return value;
+};
describe("Test i18n messages", () => {
for (const keyA of Object.keys(mergedLocalMessage)) {
@@ -14,11 +27,20 @@ describe("Test i18n messages", () => {
if (keyA === keyB) {
continue;
}
+ if (
+ typeof mergedLocalMessage[keyA] === "string" ||
+ typeof mergedLocalMessage[keyB] === "string"
+ ) {
+ if (!isEqual(mergedLocalMessage[keyA], mergedLocalMessage[keyB])) {
+ throw Error(`${keyA} and ${keyB} not match`);
+ }
+ continue;
+ }
test(`i18n message for ${keyA} and ${keyB}`, () => {
const missMatchKey = compareMessages(
- mergedLocalMessage[keyA],
- mergedLocalMessage[keyB]
+ mergedLocalMessage[keyA] as LocaleMessageObject,
+ mergedLocalMessage[keyB] as LocaleMessageObject
);
let message = "";
if (missMatchKey !== "") {
@@ -33,56 +55,59 @@ describe("Test i18n messages", () => {
describe("Test i18n for SQL review", () => {
expect(Object.keys(mergedLocalMessage).length).greaterThan(0);
- const i18nMessage = Object.values(mergedLocalMessage)[0];
+ const i18nMessage = Object.values(
+ mergedLocalMessage
+ )[0] as LocaleMessageObject;
expect(!!i18nMessage["sql-review"]).toBe(true);
- const i18nForSQLReview = i18nMessage["sql-review"];
- expect(!!i18nForSQLReview["template"]).toBe(true);
- expect(!!i18nForSQLReview["rule"]).toBe(true);
- expect(!!i18nForSQLReview["engine"]).toBe(true);
- expect(!!i18nForSQLReview["category"]).toBe(true);
+ const i18nForSQLReview = getNestedObject(i18nMessage, "sql-review");
+ const templateMessages = getNestedObject(i18nForSQLReview, "template");
+ const ruleMessages = getNestedObject(i18nForSQLReview, "rule");
+ const categoryMessages = getNestedObject(i18nForSQLReview, "category");
+ const levelMessages = getNestedObject(i18nForSQLReview, "level");
+ const engineMessages = getNestedObject(i18nForSQLReview, "engine");
+
+ expect(!!templateMessages).toBe(true);
+ expect(!!ruleMessages).toBe(true);
+ expect(!!engineMessages).toBe(true);
+ expect(!!categoryMessages).toBe(true);
for (const template of TEMPLATE_LIST_V2) {
describe(`check i18n for template ${template.id}`, () => {
const key = `${template.id.split(".").join("-")}`;
- expect(!!i18nForSQLReview["template"][key]).toBe(true);
- expect(!!i18nForSQLReview["template"][`${key}-desc`]).toBe(true);
+ expect(!!templateMessages[key]).toBe(true);
+ expect(!!templateMessages[`${key}-desc`]).toBe(true);
for (const rule of template.ruleList) {
test(`check i18n for rule ${ruleTypeToString(rule.type)}`, () => {
const key = getRuleLocalizationKey(ruleTypeToString(rule.type));
- expect(!!i18nForSQLReview["rule"][key], "rule-key").toBe(true);
+ const ruleMessage = getNestedObject(ruleMessages, key);
+ expect(!!ruleMessage, "rule-key").toBe(true);
+ expect(!!ruleMessage["title"], "rule-key-title").toBe(true);
+ expect(!!ruleMessage["description"], "rule-key-description").toBe(
+ true
+ );
expect(
- !!i18nForSQLReview["rule"][key]["title"],
- "rule-key-title"
- ).toBe(true);
- expect(
- !!i18nForSQLReview["rule"][key]["description"],
- "rule-key-description"
- ).toBe(true);
- expect(
- !!i18nForSQLReview["category"][rule.category.toLowerCase()],
+ !!categoryMessages[rule.category.toLowerCase()],
"category-rule.category"
).toBe(true);
expect(
- !!i18nForSQLReview["level"][
+ !!levelMessages[
sqlReviewRuleLevelToString(rule.level).toLowerCase()
],
"level-rule.level"
).toBe(true);
expect(
- !!i18nForSQLReview["engine"][Engine[rule.engine].toLowerCase()],
+ !!engineMessages[Engine[rule.engine].toLowerCase()],
"engine.rule-engine"
).toBe(true);
for (const component of rule.componentList) {
+ const componentMessages = getNestedObject(ruleMessage, "component");
+ expect(!!componentMessages, "rule-key-component").toBe(true);
expect(
- !!i18nForSQLReview["rule"][key]["component"],
- "rule-key-component"
- ).toBe(true);
- expect(
- !!i18nForSQLReview["rule"][key]["component"][component.key],
+ !!componentMessages[component.key],
"rule-key-component-component.key"
).toBe(true);
}
@@ -107,8 +132,8 @@ const sqlReviewRuleLevelToString = (level: SQLReviewRule_Level): string => {
};
const compareMessages = (
- localA: { [k: string]: any },
- localB: { [k: string]: any }
+ localA: LocaleMessageObject,
+ localB: LocaleMessageObject
): string => {
for (const [key, valA] of Object.entries(localA)) {
const valB = localB[key];
diff --git a/frontend/src/plugins/i18n.ts b/frontend/src/plugins/i18n.ts
index 6d5728343e..c7403d1025 100644
--- a/frontend/src/plugins/i18n.ts
+++ b/frontend/src/plugins/i18n.ts
@@ -1,4 +1,5 @@
import { useLocalStorage } from "@vueuse/core";
+import type { WritableComputedRef } from "vue";
import { type Composer, createI18n } from "vue-i18n";
import { mergedLocalMessage } from "./i18n-messages";
@@ -58,7 +59,7 @@ const i18n = createI18n({
legacy: false,
locale: getValidLocale(),
globalInjection: true,
- messages: mergedLocalMessage,
+ messages: mergedLocalMessage as Record<string, Record<string, string>>,
fallbackLocale: "en-US",
});
@@ -66,6 +67,6 @@ export const t = i18n.global.t as Composer["t"];
export const te = i18n.global.te as Composer["te"];
-export const locale = i18n.global.locale;
+export const locale = i18n.global.locale as WritableComputedRef<string>;
export default i18n;
diff --git a/frontend/src/store/cache.ts b/frontend/src/store/cache.ts
index 5e498f4870..1b016ad426 100644
--- a/frontend/src/store/cache.ts
+++ b/frontend/src/store/cache.ts
@@ -13,15 +13,18 @@ type EntityCacheEntry<K extends KeyType[], T> = {
};
const REQUEST_CACHE = new Map<
string,
- Map<string, RequestCacheEntry<any, any>>
+ Map<string, RequestCacheEntry<KeyType[], unknown>>
+>();
+const ENTITY_CACHE = new Map<
+ string,
+ Map<string, EntityCacheEntry<KeyType[], unknown>>
>();
-const ENTITY_CACHE = new Map<string, Map<string, EntityCacheEntry<any, any>>>();
export const useCache = <K extends KeyType[], T>(namespace: string) => {
const requestCacheMap = getRequestCacheMap<K, T>(namespace);
const entityCacheMap = getEntityCacheMap<K, T>(namespace);
- const trace = (title: string, keys: KeyType[], ...args: any[]) => {
+ const trace = (title: string, keys: KeyType[], ...args: unknown[]) => {
console.debug("cache", namespace, title, JSON.stringify(keys), ...args);
};
diff --git a/frontend/src/store/modules/uistate.ts b/frontend/src/store/modules/uistate.ts
index 3b0d4052b6..1af941dd75 100644
--- a/frontend/src/store/modules/uistate.ts
+++ b/frontend/src/store/modules/uistate.ts
@@ -24,7 +24,7 @@ export const useUIStateStore = defineStore("uistate", () => {
return stateByKey(state.introStateByKey, INTRO_MODULE_KEY.value, key);
};
- const setCollapseState = (fullState: any) => {
+ const setCollapseState = (fullState: Record<string, boolean>) => {
const newMap = new Map();
for (const key of Object.keys(fullState)) {
newMap.set(key, fullState[key]);
@@ -32,7 +32,7 @@ export const useUIStateStore = defineStore("uistate", () => {
state.collapseStateByKey = newMap;
};
- const setIntroState = (fullState: any) => {
+ const setIntroState = (fullState: Record<string, boolean>) => {
const newMap = new Map();
for (const key of Object.keys(fullState)) {
newMap.set(key, fullState[key]);
diff --git a/frontend/src/store/modules/v1/databaseCatalog.ts b/frontend/src/store/modules/v1/databaseCatalog.ts
index a5503a8082..2f92ed0840 100644
--- a/frontend/src/store/modules/v1/databaseCatalog.ts
+++ b/frontend/src/store/modules/v1/databaseCatalog.ts
@@ -168,7 +168,7 @@ export const getColumnCatalog = (
? tableCatalog.kind.value.columns
: [];
return (
- columns.find((c: any) => c.name === column) ??
+ columns.find((c) => c.name === column) ??
create(ColumnCatalogSchema, {
name: column,
})
diff --git a/frontend/src/store/modules/v1/storage.ts b/frontend/src/store/modules/v1/storage.ts
index aad7ddc47a..96ee9debcd 100644
--- a/frontend/src/store/modules/v1/storage.ts
+++ b/frontend/src/store/modules/v1/storage.ts
@@ -8,7 +8,7 @@ PouchDB.plugin(PouchDBFind);
export const useStorageStore = defineStore("storageStore", () => {
const db = new PouchDB<{
_id: string;
- value: any;
+ value: unknown;
}>("bb.storage", {
// Remove unused and old data automatically.
auto_compaction: true,
@@ -16,7 +16,7 @@ export const useStorageStore = defineStore("storageStore", () => {
revs_limit: 1,
});
- const put = async <T = any>(key: string, value: T) => {
+ const put = async <T = unknown>(key: string, value: T) => {
await db.put(
{
_id: key,
@@ -25,7 +25,7 @@ export const useStorageStore = defineStore("storageStore", () => {
{ force: true }
);
};
- const get = async <T = any>(key: string) => {
+ const get = async <T = unknown>(key: string) => {
try {
const doc = await db.get(key);
return doc.value as T;
diff --git a/frontend/src/types/iam/index.ts b/frontend/src/types/iam/index.ts
index 525322eff1..f15b3c0117 100644
--- a/frontend/src/types/iam/index.ts
+++ b/frontend/src/types/iam/index.ts
@@ -1,7 +1,13 @@
import type { Permission } from "./permission";
import PERMISSION_DATA from "./permission.yaml";
-export const PERMISSIONS: Permission[] = PERMISSION_DATA.permissions;
+interface PermissionYamlData {
+ permissions: Permission[];
+}
+
+export const PERMISSIONS: Permission[] = (
+ PERMISSION_DATA as unknown as PermissionYamlData
+).permissions;
export * from "./permission";
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 9a3f80cc4f..52c1b43096 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -1,18 +1,36 @@
+import { create } from "@bufbuild/protobuf";
import {
PlanFeature,
type PlanLimitConfig,
+ PlanLimitConfigSchema,
PlanType,
} from "@/types/proto-es/v1/subscription_service_pb";
import planData from "./plan.yaml";
+// Type for plan data loaded from YAML
+interface PlanYamlData {
+ type: keyof typeof PlanType;
+ maximumInstanceCount: number;
+ maximumSeatCount: number;
+ features: (keyof typeof PlanFeature)[];
+}
+
+interface PlanDataYaml {
+ plans: PlanYamlData[];
+ instanceFeatures: string[];
+}
+
+const typedPlanData = planData as unknown as PlanDataYaml;
+
// Convert YAML data to proper types
-export const PLANS: PlanLimitConfig[] = planData.plans.map((plan: any) => ({
- ...plan,
- type: PlanType[plan.type as keyof typeof PlanType],
- features: plan.features.map(
- (f: string) => PlanFeature[f as keyof typeof PlanFeature]
- ),
-}));
+export const PLANS: PlanLimitConfig[] = typedPlanData.plans.map((plan) =>
+ create(PlanLimitConfigSchema, {
+ type: PlanType[plan.type],
+ features: plan.features.map((f) => PlanFeature[f]),
+ maximumInstanceCount: plan.maximumInstanceCount,
+ maximumSeatCount: plan.maximumSeatCount,
+ })
+);
// Create a plan feature matrix from the YAML data
const planFeatureMatrix = new Map<PlanType, Set<PlanFeature>>();
@@ -23,7 +41,7 @@ export const instanceLimitFeature = new Set<PlanFeature>();
PLANS.forEach((plan) => {
planFeatureMatrix.set(plan.type, new Set(plan.features));
});
-planData.instanceFeatures.forEach((feature: string) => {
+typedPlanData.instanceFeatures.forEach((feature) => {
instanceLimitFeature.add(PlanFeature[feature as keyof typeof PlanFeature]);
});
diff --git a/frontend/src/types/release.ts b/frontend/src/types/release.ts
index e1bbc7e83b..77a9ff7ee7 100644
--- a/frontend/src/types/release.ts
+++ b/frontend/src/types/release.ts
@@ -13,7 +13,7 @@ export const unknownRelease = (): Release => {
});
};
-export const isValidReleaseName = (name: any): name is string => {
+export const isValidReleaseName = (name: unknown): name is string => {
if (typeof name !== "string") return false;
const [projectName, releaseName] = getProjectNameReleaseId(name);
return Boolean(
diff --git a/frontend/src/types/rollout.ts b/frontend/src/types/rollout.ts
index ec56737391..244a9fa7f4 100644
--- a/frontend/src/types/rollout.ts
+++ b/frontend/src/types/rollout.ts
@@ -20,7 +20,7 @@ export const unknownRollout = (): Rollout => {
});
};
-export const isValidRolloutName = (name: any): name is string => {
+export const isValidRolloutName = (name: unknown): name is string => {
if (typeof name !== "string") return false;
const [projectName, rolloutName] = getProjectNameRolloutId(name);
return Boolean(
diff --git a/frontend/src/types/semanticTypes.ts b/frontend/src/types/semanticTypes.ts
index 3003faf205..19081c1855 100644
--- a/frontend/src/types/semanticTypes.ts
+++ b/frontend/src/types/semanticTypes.ts
@@ -1,7 +1,10 @@
import { create } from "@bufbuild/protobuf";
import { t } from "@/plugins/i18n";
import type { Algorithm } from "@/types/proto-es/v1/setting_service_pb";
-import { SemanticTypeSetting_SemanticTypeSchema } from "@/types/proto-es/v1/setting_service_pb";
+import {
+ type SemanticTypeSetting_SemanticType,
+ SemanticTypeSetting_SemanticTypeSchema,
+} from "@/types/proto-es/v1/setting_service_pb";
import buildInSemanticTypes from "./semantic-types.yaml";
interface BuildInSemantic {
@@ -9,18 +12,21 @@ interface BuildInSemantic {
algorithm: Algorithm;
}
-export const getSemanticTemplateList = () => {
- return (buildInSemanticTypes as BuildInSemantic[]).map((buildInSemantic) => {
- const key = buildInSemantic.id.split(".").join("-");
- return create(SemanticTypeSetting_SemanticTypeSchema, {
- id: buildInSemantic.id,
- title: t(
- `dynamic.settings.sensitive-data.semantic-types.template.${key}.title`
- ),
- description: t(
- `dynamic.settings.sensitive-data.semantic-types.template.${key}.description`
- ),
- algorithm: buildInSemantic.algorithm,
- });
- });
-};
+export const getSemanticTemplateList =
+ (): SemanticTypeSetting_SemanticType[] => {
+ return (buildInSemanticTypes as unknown as BuildInSemantic[]).map(
+ (buildInSemantic) => {
+ const key = buildInSemantic.id.split(".").join("-");
+ return create(SemanticTypeSetting_SemanticTypeSchema, {
+ id: buildInSemantic.id,
+ title: t(
+ `dynamic.settings.sensitive-data.semantic-types.template.${key}.title`
+ ),
+ description: t(
+ `dynamic.settings.sensitive-data.semantic-types.template.${key}.description`
+ ),
+ algorithm: buildInSemantic.algorithm,
+ });
+ }
+ );
+ };
diff --git a/frontend/src/types/sqlEditor/tree.ts b/frontend/src/types/sqlEditor/tree.ts
index 8fc28fe340..8bfb30932d 100644
--- a/frontend/src/types/sqlEditor/tree.ts
+++ b/frontend/src/types/sqlEditor/tree.ts
@@ -9,7 +9,9 @@ export type SQLEditorTreeFactor =
| "environment"
| `label:${string}`; // "label:xxxxx" to group by certain label key
-export type StatefulSQLEditorTreeFactor<F extends SQLEditorTreeFactor = any> = {
+export type StatefulSQLEditorTreeFactor<
+ F extends SQLEditorTreeFactor = SQLEditorTreeFactor,
+> = {
factor: F;
disabled: boolean;
};
@@ -25,30 +27,34 @@ export type LabelTarget = {
value: string;
};
-export type SQLEditorTreeNodeTarget<T extends SQLEditorTreeNodeType = any> =
- T extends "instance"
- ? Omit<InstanceResource, "$typeName">
- : T extends "environment"
- ? Environment
- : T extends "database"
- ? ComposedDatabase
- : T extends "label"
- ? LabelTarget
- : never;
+export type SQLEditorTreeNodeTarget<
+ T extends SQLEditorTreeNodeType = SQLEditorTreeNodeType,
+> = T extends "instance"
+ ? Omit<InstanceResource, "$typeName">
+ : T extends "environment"
+ ? Environment
+ : T extends "database"
+ ? ComposedDatabase
+ : T extends "label"
+ ? LabelTarget
+ : never;
export type SQLEditorTreeState = "UNSET" | "LOADING" | "READY";
-export type SQLEditorTreeNodeMeta<T extends SQLEditorTreeNodeType = any> = {
+export type SQLEditorTreeNodeMeta<
+ T extends SQLEditorTreeNodeType = SQLEditorTreeNodeType,
+> = {
type: T;
target: SQLEditorTreeNodeTarget<T>;
};
-export type SQLEditorTreeNode<T extends SQLEditorTreeNodeType = any> =
- TreeOption & {
- meta: SQLEditorTreeNodeMeta<T>;
- key: string;
- children?: SQLEditorTreeNode[];
- };
+export type SQLEditorTreeNode<
+ T extends SQLEditorTreeNodeType = SQLEditorTreeNodeType,
+> = TreeOption & {
+ meta: SQLEditorTreeNodeMeta<T>;
+ key: string;
+ children?: SQLEditorTreeNode[];
+};
export const isValidSQLEditorTreeFactor = (
str: string
diff --git a/frontend/src/types/sqlReview.test.ts b/frontend/src/types/sqlReview.test.ts
index 8e8a462322..2103dcfd1a 100644
--- a/frontend/src/types/sqlReview.test.ts
+++ b/frontend/src/types/sqlReview.test.ts
@@ -5,11 +5,37 @@ import sqlReviewProdTemplate from "./sql-review.prod.yaml";
import sqlReviewSampleTemplate from "./sql-review.sample.yaml";
import sqlReviewSchema from "./sql-review-schema.yaml";
+// Type for template rule data loaded from YAML
+interface TemplateRule {
+ type: string;
+ engine: string;
+ level: string;
+ payload?: Record<string, unknown>;
+}
+
+// Type for schema rule data loaded from YAML
+interface SchemaRule {
+ type: string;
+ engine: string;
+ category: string;
+ level?: string;
+ componentList?: unknown[];
+}
+
+// Type for template data loaded from YAML
+interface TemplateData {
+ id: string;
+ ruleList: TemplateRule[];
+}
+
describe("SQL Review YAML Templates Validation", () => {
- const templates = [
- { name: "sample", data: sqlReviewSampleTemplate },
- { name: "dev", data: sqlReviewDevTemplate },
- { name: "prod", data: sqlReviewProdTemplate },
+ const templates: { name: string; data: TemplateData }[] = [
+ {
+ name: "sample",
+ data: sqlReviewSampleTemplate as unknown as TemplateData,
+ },
+ { name: "dev", data: sqlReviewDevTemplate as unknown as TemplateData },
+ { name: "prod", data: sqlReviewProdTemplate as unknown as TemplateData },
];
templates.forEach(({ name, data }) => {
@@ -27,7 +53,7 @@ describe("SQL Review YAML Templates Validation", () => {
});
test("all rules must have required fields", () => {
- data.ruleList.forEach((rule: any, index: number) => {
+ (data.ruleList as TemplateRule[]).forEach((rule, index) => {
const ruleDesc = `rule[${index}] (${rule.type || "unknown"})`;
// Type is required
@@ -52,7 +78,7 @@ describe("SQL Review YAML Templates Validation", () => {
test("all rules must have valid level (ERROR or WARNING, not LEVEL_UNSPECIFIED)", () => {
const validLevels = ["ERROR", "WARNING"];
- data.ruleList.forEach((rule: any, index: number) => {
+ (data.ruleList as TemplateRule[]).forEach((rule, index) => {
const ruleDesc = `rule[${index}] (${rule.type})`;
expect(
validLevels.includes(rule.level),
@@ -71,7 +97,7 @@ describe("SQL Review YAML Templates Validation", () => {
});
test("all rules must be convertible to SQLReviewRule_Level enum", () => {
- data.ruleList.forEach((rule: any, index: number) => {
+ (data.ruleList as TemplateRule[]).forEach((rule, index) => {
const ruleDesc = `rule[${index}] (${rule.type})`;
const levelKey = rule.level as keyof typeof SQLReviewRule_Level;
const levelValue = SQLReviewRule_Level[levelKey];
@@ -90,13 +116,15 @@ describe("SQL Review YAML Templates Validation", () => {
});
describe("Schema validation", () => {
+ const schemaRules = sqlReviewSchema as unknown as SchemaRule[];
+
test("should be an array", () => {
- expect(Array.isArray(sqlReviewSchema)).toBe(true);
- expect(sqlReviewSchema.length).toBeGreaterThan(0);
+ expect(Array.isArray(schemaRules)).toBe(true);
+ expect(schemaRules.length).toBeGreaterThan(0);
});
test("schema rules should NOT have level field", () => {
- sqlReviewSchema.forEach((rule: any, index: number) => {
+ schemaRules.forEach((rule, index) => {
const ruleDesc = `schema rule[${index}] (${rule.type || "unknown"})`;
// Schema rules are just definitions, they should not have a level
@@ -108,7 +136,7 @@ describe("SQL Review YAML Templates Validation", () => {
});
test("schema rules must have required fields", () => {
- sqlReviewSchema.forEach((rule: any, index: number) => {
+ schemaRules.forEach((rule, index) => {
const ruleDesc = `schema rule[${index}] (${rule.type || "unknown"})`;
// Type is required
@@ -136,12 +164,14 @@ describe("SQL Review YAML Templates Validation", () => {
describe("Cross-template consistency", () => {
test("report template rules that don't exist in schema", () => {
const schemaRuleTypes = new Set(
- sqlReviewSchema.map((rule: any) => `${rule.engine}:${rule.type}`)
+ (sqlReviewSchema as unknown as SchemaRule[]).map(
+ (rule) => `${rule.engine}:${rule.type}`
+ )
);
const missingRules: string[] = [];
templates.forEach(({ name, data }) => {
- data.ruleList.forEach((rule: any) => {
+ data.ruleList.forEach((rule) => {
const ruleKey = `${rule.engine}:${rule.type}`;
if (!schemaRuleTypes.has(ruleKey)) {
missingRules.push(`${name}: ${ruleKey}`);
diff --git a/frontend/src/types/sqlReview.ts b/frontend/src/types/sqlReview.ts
index f3ca31d7b8..6aa2eb2628 100644
--- a/frontend/src/types/sqlReview.ts
+++ b/frontend/src/types/sqlReview.ts
@@ -164,13 +164,13 @@ const convertRuleTemplateV2Raw = (
};
export const ruleTemplateMapV2 = getRuleMapByEngine(
- convertRuleTemplateV2Raw(sqlReviewSchema as RuleTemplateV2Raw[])
+ convertRuleTemplateV2Raw(sqlReviewSchema as unknown as RuleTemplateV2Raw[])
);
// Build the frontend template list based on schema and template.
export const TEMPLATE_LIST_V2: SQLReviewPolicyTemplateV2[] = (function () {
interface PayloadObject {
- [key: string]: any;
+ [key: string]: unknown;
}
const templateList = [
sqlReviewSampleTemplate,
@@ -223,14 +223,15 @@ export const TEMPLATE_LIST_V2: SQLReviewPolicyTemplateV2[] = (function () {
level,
// Using template rule payload to override the component list.
componentList: ruleTemplate.componentList.map((component) => {
- if (rule.payload && rule.payload[component.key]) {
+ if (rule.payload && rule.payload[component.key] !== undefined) {
+ const payloadValue = rule.payload[component.key];
return {
...component,
payload: {
...component.payload,
- default: rule.payload[component.key],
+ default: payloadValue,
},
- };
+ } as RuleConfigComponent;
}
return component;
}),
@@ -288,9 +289,9 @@ export const convertPolicyRuleToRuleTemplate = (
}
// Extract payload value from proto oneof
- let payload: any = {};
+ let payload: Record<string, unknown> = {};
if (policyRule?.payload?.case) {
- payload = policyRule.payload.value;
+ payload = policyRule.payload.value as Record<string, unknown>;
}
const stringComponent = componentList.find(
diff --git a/frontend/src/types/v1/database.ts b/frontend/src/types/v1/database.ts
index 8804ab61e2..8acb352b37 100644
--- a/frontend/src/types/v1/database.ts
+++ b/frontend/src/types/v1/database.ts
@@ -46,7 +46,7 @@ export const unknownDatabase = (): ComposedDatabase => {
};
};
-export const isValidDatabaseName = (name: any): name is string => {
+export const isValidDatabaseName = (name: unknown): name is string => {
if (typeof name !== "string") return false;
const { instanceName, databaseName } = extractDatabaseResourceName(name);
return (
diff --git a/frontend/src/types/v1/environment.ts b/frontend/src/types/v1/environment.ts
index 3a1cf0a972..b3cd2eeeda 100644
--- a/frontend/src/types/v1/environment.ts
+++ b/frontend/src/types/v1/environment.ts
@@ -40,7 +40,7 @@ export const nullEnvironment = (): Environment => {
};
};
-export const isValidEnvironmentName = (name: any): name is string => {
+export const isValidEnvironmentName = (name: unknown): name is string => {
return (
typeof name === "string" &&
name.startsWith("environments/") &&
diff --git a/frontend/src/types/v1/instance.ts b/frontend/src/types/v1/instance.ts
index f73950f59a..48ee6383db 100644
--- a/frontend/src/types/v1/instance.ts
+++ b/frontend/src/types/v1/instance.ts
@@ -34,7 +34,7 @@ export const unknownInstanceResource = (): InstanceResource => {
});
};
-export const isValidInstanceName = (name: any): name is string => {
+export const isValidInstanceName = (name: unknown): name is string => {
return (
typeof name === "string" &&
name.startsWith("instances/") &&
diff --git a/frontend/src/types/v1/webTerminal.ts b/frontend/src/types/v1/webTerminal.ts
index 7aac52860a..89eca600f8 100644
--- a/frontend/src/types/v1/webTerminal.ts
+++ b/frontend/src/types/v1/webTerminal.ts
@@ -41,7 +41,7 @@ export type QueryEvents = Emittery<{
export type StreamingQueryController = {
status: Ref<"CONNECTED" | "DISCONNECTED">;
events: QueryEvents;
- abort(reason?: any): void;
+ abort(reason?: unknown): void;
};
export type WebTerminalQueryState = {
diff --git a/frontend/src/utils/naive-ui.ts b/frontend/src/utils/naive-ui.ts
index 535cc8a4b7..b68f3c5806 100644
--- a/frontend/src/utils/naive-ui.ts
+++ b/frontend/src/utils/naive-ui.ts
@@ -57,12 +57,14 @@ export const useAutoHeightDataTable = (
const layoutReady = computed(() => tableHeaderHeight.value > 0);
const virtualListRef = computed(() => {
- return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef
+ // biome-ignore lint/suspicious/noExplicitAny: accessing internal naive-ui refs
+ return (dataTableRef.value as any)?.$refs?.mainTableInstRef?.bodyInstRef // eslint-disable-line @typescript-eslint/no-explicit-any
?.virtualListRef as VirtualListInst | undefined;
});
const scrollerRef = computed(() => {
- const getter = (dataTableRef.value as any)?.$refs.mainTableInstRef.$refs
+ // biome-ignore lint/suspicious/noExplicitAny: accessing internal naive-ui refs
+ const getter = (dataTableRef.value as any)?.$refs.mainTableInstRef.$refs // eslint-disable-line @typescript-eslint/no-explicit-any
.bodyInstRef.virtualListContainer;
if (typeof getter === "function") {
return getter() as HTMLElement | undefined;
diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts
index d9242d593c..23f8eb42c8 100644
--- a/frontend/src/utils/util.ts
+++ b/frontend/src/utils/util.ts
@@ -136,7 +136,7 @@ export function isUrl(str: string): boolean {
// Performs inline swap, also handles negative index (counting from the end)
// arraySwap([1, 2, 3, 4], 1, 2) => [1, 3, 2, 4]
// arraySwap([1, 2, 3, 4], -1, -2) => [1, 2, 4, 3]
-export function arraySwap(arr: any[], oldIndex: number, newIndex: number) {
+export function arraySwap(arr: unknown[], oldIndex: number, newIndex: number) {
while (oldIndex < 0) {
oldIndex += arr.length;
}
@@ -267,9 +267,9 @@ export function getHighlightHTMLByRegExp(
export type Defer<T> = {
promise: Promise<T>;
resolve: (value: T | PromiseLike<T>) => void;
- reject: (reason?: any) => void;
+ reject: (reason?: unknown) => void;
};
-export function defer<T = any>() {
+export function defer<T = unknown>() {
const d = {} as Defer<T>;
d.promise = new Promise<T>((resolve, reject) => {
d.resolve = resolve;
@@ -329,7 +329,7 @@ export function semverCompare(
return semver[method](formattedV1, formattedV2);
}
-export function clearObject(obj: any) {
+export function clearObject(obj: Record<string, unknown>) {
const keys = Object.keys(obj);
keys.forEach((key) => delete obj[key]);
return obj;
@@ -384,7 +384,7 @@ export const keyboardShortcutStr = (str: string) => {
.join("+");
};
-export const isNullOrUndefined = (value: any) => {
+export const isNullOrUndefined = (value: unknown) => {
return value === null || value === undefined;
};
diff --git a/frontend/src/utils/v1/common.ts b/frontend/src/utils/v1/common.ts
index 520cade9cd..d261c67704 100644
--- a/frontend/src/utils/v1/common.ts
+++ b/frontend/src/utils/v1/common.ts
@@ -1,7 +1,11 @@
import { isEqual, snakeCase } from "lodash-es";
import { humanizeTs } from "../util";
-export const calcUpdateMask = (a: any, b: any, toSnakeCase = false) => {
+export const calcUpdateMask = (
+ a: Record<string, unknown>,
+ b: Record<string, unknown>,
+ toSnakeCase = false
+) => {
const updateMask = new Set<string>();
const aKeys = new Set(Object.keys(a));
const bKeys = new Set(Object.keys(b));
diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vue
index d2cdae4d94..baa92b7ba1 100644
--- a/frontend/src/views/Archive.vue
+++ b/frontend/src/views/Archive.vue
@@ -53,7 +53,7 @@ import { hasWorkspacePermissionV2 } from "@/utils";
const hashList = ["PROJECT", "INSTANCE"] as const;
export type TabHash = (typeof hashList)[number];
-const isTabHash = (x: any): x is TabHash => hashList.includes(x);
+const isTabHash = (x: unknown): x is TabHash => hashList.includes(x as TabHash);
type LocalTabType = "PROJECT" | "INSTANCE";
diff --git a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
index 6991384107..0284299382 100644
--- a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
@@ -241,8 +241,8 @@ const databaseHashList = [
"catalog",
] as const;
export type DatabaseHash = (typeof databaseHashList)[number];
-const isDatabaseHash = (x: any): x is DatabaseHash =>
- databaseHashList.includes(x);
+const isDatabaseHash = (x: unknown): x is DatabaseHash =>
+ databaseHashList.includes(x as DatabaseHash);
interface LocalState {
showTransferDatabaseModal: boolean;
diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vue
index 08c0276fde..08718dad83 100644
--- a/frontend/src/views/EnvironmentDashboard.vue
+++ b/frontend/src/views/EnvironmentDashboard.vue
@@ -13,7 +13,7 @@
v-for="(item, index) in tabItemList"
:key="item.id"
:name="item.id"
- :tab="() => renderTab(item.data, index)"
+ :tab="() => renderTab(item.data!, index)"
>
<EnvironmentDetail
ref="environmentDetailRefs"
@@ -80,16 +80,14 @@
item-key="id"
animation="300"
>
- <template
- #item="{ element, index }: { element: Environment; index: number }"
- >
+ <template #item="{ element, index }">
<div
- :key="element.id"
+ :key="(element as Environment).id"
class="flex items-center justify-between p-2 hover:bg-gray-100 rounded-xs cursor-grab"
>
<div class="flex items-center gap-x-2">
<span class="textinfo"> {{ index + 1 }}.</span>
- <EnvironmentV1Name :environment="element" :link="false" />
+ <EnvironmentV1Name :environment="(element as Environment)" :link="false" />
</div>
<GripVerticalIcon class="w-5 h-5 text-gray-500" />
</div>
@@ -227,12 +225,14 @@ watch(
{ immediate: true }
);
-const tabItemList = computed((): BBTabItem[] => {
- return environmentList.value.map((item, index: number): BBTabItem => {
- const title = `${index + 1}. ${item.title}`;
- const id = item.id;
- return { title, id, data: item };
- });
+const tabItemList = computed((): BBTabItem<Environment>[] => {
+ return environmentList.value.map(
+ (item, index: number): BBTabItem<Environment> => {
+ const title = `${index + 1}. ${item.title}`;
+ const id = item.id;
+ return { title, id, data: item };
+ }
+ );
});
const getEnvironmentCreate = () => {
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 9ada44aa69..534fcc8009 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -145,8 +145,8 @@ import {
const instanceHashList = ["overview", "databases", "users"] as const;
export type InstanceHash = (typeof instanceHashList)[number];
-const isInstanceHash = (x: any): x is InstanceHash =>
- instanceHashList.includes(x);
+const isInstanceHash = (x: unknown): x is InstanceHash =>
+ instanceHashList.includes(x as InstanceHash);
interface LocalState {
showCreateDatabaseModal: boolean;
diff --git a/frontend/src/views/SettingWorkspaceAuditLog.vue b/frontend/src/views/SettingWorkspaceAuditLog.vue
index 9f01208aef..a66bee9b85 100644
--- a/frontend/src/views/SettingWorkspaceAuditLog.vue
+++ b/frontend/src/views/SettingWorkspaceAuditLog.vue
@@ -152,7 +152,7 @@ const handleExport = async ({
reject,
}: {
options: ExportOption;
- reject: (reason?: any) => void;
+ reject: (reason?: unknown) => void;
resolve: (content: DownloadContent[]) => void;
}) => {
let pageToken = "";
diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vue
index 83cc57e506..a7f1e7267a 100644
--- a/frontend/src/views/SettingWorkspaceUsers.vue
+++ b/frontend/src/views/SettingWorkspaceUsers.vue
@@ -232,7 +232,8 @@ import { hasWorkspacePermissionV2 } from "@/utils";
const tabList = ["USERS", "GROUPS"] as const;
type MemberTab = (typeof tabList)[number];
-const isMemberTab = (tab: any): tab is MemberTab => tabList.includes(tab);
+const isMemberTab = (tab: unknown): tab is MemberTab =>
+ tabList.includes(tab as MemberTab);
const defaultTab: MemberTab = "USERS";
type LocalState = {
diff --git a/frontend/src/views/auth/MultiFactor.vue b/frontend/src/views/auth/MultiFactor.vue
index 023d62e59e..ffc09926a0 100644
--- a/frontend/src/views/auth/MultiFactor.vue
+++ b/frontend/src/views/auth/MultiFactor.vue
@@ -64,6 +64,7 @@
</template>
<script lang="ts" setup>
+import { create } from "@bufbuild/protobuf";
import { SmartphoneIcon } from "lucide-vue-next";
import { NButton, NCard, NInputOtp } from "naive-ui";
import { computed, reactive } from "vue";
@@ -71,6 +72,7 @@ import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
import { BBTextField } from "@/bbkit";
import { useAuthStore } from "@/store";
+import { LoginRequestSchema } from "@/types/proto-es/v1/auth_service_pb";
type MFAType = "OTP" | "RECOVERY_CODE";
@@ -109,17 +111,16 @@ const onOtpCodeFinish = async (value: string[]) => {
};
const challenge = async () => {
- const mfaContext: any = {};
+ const request = create(LoginRequestSchema, {
+ mfaTempToken: mfaTempToken.value,
+ });
if (state.selectedMFAType === "OTP") {
- mfaContext.otpCode = state.otpCodes.join("");
+ request.otpCode = state.otpCodes.join("");
} else if (state.selectedMFAType === "RECOVERY_CODE") {
- mfaContext.recoveryCode = state.recoveryCode;
+ request.recoveryCode = state.recoveryCode;
}
await authStore.login({
- request: {
- mfaTempToken: mfaTempToken.value,
- ...mfaContext,
- },
+ request,
redirect: true,
});
};
diff --git a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SchemaPane.vue b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SchemaPane.vue
index 967fe2d0f3..a780a7b68f 100644
--- a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SchemaPane.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SchemaPane.vue
@@ -484,7 +484,7 @@ watch(
);
// Handlers for flat list events
-const handleFlatListSelect = (table: any) => {
+const handleFlatListSelect = (table: { schema?: string }) => {
// Update connection schema if needed
const tab = currentTab.value;
if (tab && table.schema) {
diff --git a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/tree.ts b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/tree.ts
index c7d62f444a..7764b29623 100644
--- a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/tree.ts
+++ b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/tree.ts
@@ -93,7 +93,10 @@ export type RichFunctionMetadata = RichSchemaMetadata & {
function: string;
position: number;
};
-export type TextTarget<E extends boolean = any, S extends boolean = any> = {
+export type TextTarget<
+ E extends boolean = boolean,
+ S extends boolean = boolean,
+> = {
expandable: E;
id: string;
mockType?: NodeType; // mock as a node type if needed
@@ -138,7 +141,7 @@ export type NodeTarget<T extends NodeType = NodeType> = T extends "database"
: T extends "trigger"
? RichTriggerMetadata
: T extends "expandable-text"
- ? TextTarget<true, any>
+ ? TextTarget<true>
: T extends "error"
? ErrorTarget
: never;
diff --git a/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/dropdown.ts b/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/dropdown.ts
index 0ef73faa71..0004358669 100644
--- a/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/dropdown.ts
+++ b/frontend/src/views/sql-editor/AsidePanel/WorksheetPane/SheetList/dropdown.ts
@@ -108,12 +108,7 @@ export const useDropdown = (
}
const items: {
- icon: FunctionalComponent<
- LucideProps,
- Record<string, any>,
- any,
- Record<string, any>
- >;
+ icon: FunctionalComponent<LucideProps>;
key: DropdownOptionType;
label: string;
}[] = [];
diff --git a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/actions.tsx b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/actions.tsx
index ee2aba29a5..75bfb7968e 100644
--- a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/actions.tsx
+++ b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/actions.tsx
@@ -55,103 +55,99 @@ export const useDropdown = () => {
return [];
}
const { type, target } = node.meta;
- if (type === "project") {
+ // Don't show any context menu actions for disabled
+ // instances/databases
+ if (node.disabled) {
return [];
- } else {
- // Don't show any context menu actions for disabled
- // instances/databases
- if (node.disabled) {
- return [];
- }
+ }
- const items: DropdownOptionWithTreeNode[] = [];
+ const items: DropdownOptionWithTreeNode[] = [];
- if (isConnectableSQLEditorTreeNode(node)) {
- const database = node.meta.target as ComposedDatabase;
- const instance = instanceOfSQLEditorTreeNode(node);
- if (instance && instanceV1HasReadonlyMode(instance)) {
- items.push({
- key: "connect",
- label: t("sql-editor.connect"),
- icon: () => <LinkIcon class="w-4 h-4" />,
- onSelect: () => {
- setConnection({
- database,
- context: editorContext,
- newTab: false,
- });
- showConnectionPanel.value = false;
- },
- });
- items.push({
- key: "connect-in-new-tab",
- label: t("sql-editor.connect-in-new-tab"),
- icon: () => <LinkIcon class="w-4 h-4" />,
- onSelect: () => {
- setConnection({
- database,
- newTab: true,
- context: editorContext,
- });
- showConnectionPanel.value = false;
- },
- });
- }
- if (allowAdmin.value) {
- items.push({
- key: "connect-in-admin-mode",
- label: t("sql-editor.connect-in-admin-mode"),
- icon: () => <WrenchIcon class="w-4 h-4" />,
- onSelect: () => {
- setConnection({
- database,
- mode: "ADMIN",
- context: editorContext,
- newTab: false,
- });
- showConnectionPanel.value = false;
- },
- });
- }
+ if (isConnectableSQLEditorTreeNode(node)) {
+ const database = node.meta.target as ComposedDatabase;
+ const instance = instanceOfSQLEditorTreeNode(node);
+ if (instance && instanceV1HasReadonlyMode(instance)) {
+ items.push({
+ key: "connect",
+ label: t("sql-editor.connect"),
+ icon: () => <LinkIcon class="w-4 h-4" />,
+ onSelect: () => {
+ setConnection({
+ database,
+ context: editorContext,
+ newTab: false,
+ });
+ showConnectionPanel.value = false;
+ },
+ });
+ items.push({
+ key: "connect-in-new-tab",
+ label: t("sql-editor.connect-in-new-tab"),
+ icon: () => <LinkIcon class="w-4 h-4" />,
+ onSelect: () => {
+ setConnection({
+ database,
+ newTab: true,
+ context: editorContext,
+ });
+ showConnectionPanel.value = false;
+ },
+ });
}
- if (type === "database") {
- const database = target as ComposedDatabase;
+ if (allowAdmin.value) {
items.push({
- key: "view-database-detail",
- label: t("sql-editor.view-database-detail"),
- icon: () => <ExternalLinkIcon class="w-4 h-4" />,
+ key: "connect-in-admin-mode",
+ label: t("sql-editor.connect-in-admin-mode"),
+ icon: () => <WrenchIcon class="w-4 h-4" />,
onSelect: () => {
- const route = router.resolve({
- name: PROJECT_V1_ROUTE_DATABASE_DETAIL,
- params: {
- projectId: extractProjectResourceName(database.project),
- instanceId: extractInstanceResourceName(database.instance),
- databaseName: database.databaseName,
- },
+ setConnection({
+ database,
+ mode: "ADMIN",
+ context: editorContext,
+ newTab: false,
});
- const url = route.href;
- window.open(url, "_blank");
+ showConnectionPanel.value = false;
},
});
- if (instanceV1HasAlterSchema(database.instanceResource)) {
- items.push({
- key: "alter-schema",
- label: t("database.edit-schema"),
- icon: () => <SquarePenIcon class="w-4 h-4" />,
- onSelect: () => {
- const db = node.meta.target as ComposedDatabase;
- editorEvents.emit("alter-schema", {
- databaseName: db.name,
- schema: "",
- table: "",
- });
- showConnectionPanel.value = false;
+ }
+ }
+ if (type === "database") {
+ const database = target as ComposedDatabase;
+ items.push({
+ key: "view-database-detail",
+ label: t("sql-editor.view-database-detail"),
+ icon: () => <ExternalLinkIcon class="w-4 h-4" />,
+ onSelect: () => {
+ const route = router.resolve({
+ name: PROJECT_V1_ROUTE_DATABASE_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(database.project),
+ instanceId: extractInstanceResourceName(database.instance),
+ databaseName: database.databaseName,
},
});
- }
+ const url = route.href;
+ window.open(url, "_blank");
+ },
+ });
+ if (instanceV1HasAlterSchema(database.instanceResource)) {
+ items.push({
+ key: "alter-schema",
+ label: t("database.edit-schema"),
+ icon: () => <SquarePenIcon class="w-4 h-4" />,
+ onSelect: () => {
+ const db = node.meta.target as ComposedDatabase;
+ editorEvents.emit("alter-schema", {
+ databaseName: db.name,
+ schema: "",
+ table: "",
+ });
+ showConnectionPanel.value = false;
+ },
+ });
}
- return items;
}
+ return items;
});
const handleSelect = (key: string) => {
diff --git a/frontend/src/views/sql-editor/EditorCommon/ConnectChooser.vue b/frontend/src/views/sql-editor/EditorCommon/ConnectChooser.vue
index a6c58c0272..4410bc1135 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ConnectChooser.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ConnectChooser.vue
@@ -76,7 +76,7 @@ const popoverPaneDimensions = ref({
});
const overridePopoverPaneStyle = computed(() => {
- const style: Record<string, any> = {};
+ const style: Record<string, string> = {};
const { maxHeight, minWidth } = popoverPaneDimensions.value;
if (maxHeight > 0) {
style["--n-height"] = `${maxHeight}px`;
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
index f84932522b..2d88602bb2 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
@@ -62,7 +62,7 @@
<MaskingReasonPopover
v-if="getMaskingReason && getMaskingReason(columnIndex)"
- :reason="getMaskingReason(columnIndex)"
+ :reason="getMaskingReason(columnIndex)!"
class="ml-0.5 shrink-0"
/>
<SensitiveDataIcon
@@ -214,6 +214,7 @@ import { useWindowSize, watchDebounced } from "@vueuse/core";
import { NPerformantEllipsis, NVirtualList } from "naive-ui";
import { nextTick, ref } from "vue";
import { type ComposedDatabase, DEBOUNCE_SEARCH_DELAY } from "@/types";
+import type { MaskingReason } from "@/types/proto-es/v1/sql_service_pb";
import { type QueryRow } from "@/types/proto-es/v1/sql_service_pb";
import { type SearchParams } from "@/utils";
import BinaryFormatButton from "./common/BinaryFormatButton.vue";
@@ -242,7 +243,7 @@ const props = defineProps<{
setIndex: number;
activeRowIndex: number;
isSensitiveColumn: (index: number) => boolean;
- getMaskingReason?: (index: number) => any;
+ getMaskingReason?: (index: number) => MaskingReason | undefined;
database: ComposedDatabase;
sortState?: SortState;
search: SearchParams;
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts
index 0b1e3303e0..7895d92a63 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/common/selection-logic.ts
@@ -260,9 +260,9 @@ export const provideSelectionContext = ({
}
copying.value = true;
copyTextToClipboard(values)
- .catch((err: any) => {
+ .catch((err: unknown) => {
const errors = [t("common.failed")];
- if (err && err instanceof Error) {
+ if (err instanceof Error) {
errors.push(err.message);
}
pushNotification({
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
index 9f85f38f29..a2f6ceaf98 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
@@ -349,7 +349,7 @@ const handleExportBtnClick = async ({
}: {
statement: string;
options: ExportOption;
- reject: (reason?: any) => void;
+ reject: (reason?: unknown) => void;
resolve: (content: DownloadContent[]) => void;
}) => {
const admin = tabStore.currentTab?.mode === "ADMIN";
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index 59620b3e5a..0a66e4f0d2 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -306,7 +306,7 @@ defineEmits<{
event: "export",
option: {
resolve: (content: DownloadContent[]) => void;
- reject: (reason?: any) => void;
+ reject: (reason?: unknown) => void;
options: ExportOption;
statement: string;
}
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue
index be51d0bb83..eced76564a 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/VirtualDataBlock.vue
@@ -40,7 +40,7 @@
{{ column.name }}
<MaskingReasonPopover
v-if="getMaskingReason && getMaskingReason(columnIndex)"
- :reason="getMaskingReason(columnIndex)"
+ :reason="getMaskingReason(columnIndex)!"
class="ml-0.5 shrink-0"
/>
<SensitiveDataIcon
@@ -74,7 +74,10 @@ import { NVirtualList } from "naive-ui";
import { computed, ref } from "vue";
import { CopyButton } from "@/components/v2";
import { type ComposedDatabase } from "@/types";
-import type { QueryRow } from "@/types/proto-es/v1/sql_service_pb";
+import type {
+ MaskingReason,
+ QueryRow,
+} from "@/types/proto-es/v1/sql_service_pb";
import { type SearchParams } from "@/utils";
import { useBinaryFormatContext } from "./DataTable/common/binary-format-store";
import MaskingReasonPopover from "./DataTable/common/MaskingReasonPopover.vue";
@@ -92,7 +95,7 @@ const props = defineProps<{
setIndex: number;
activeRowIndex: number;
isSensitiveColumn: (index: number) => boolean;
- getMaskingReason?: (index: number) => any;
+ getMaskingReason?: (index: number) => MaskingReason | undefined;
database: ComposedDatabase;
search: SearchParams;
}>();
@@ -126,7 +129,7 @@ const getContent = (rowIndex: number): string => {
);
return obj;
},
- {} as Record<string, any>
+ {} as Record<string, unknown>
);
return JSON.stringify(object, null, 4);
diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue
index d01d801d45..6dc5cd6f2c 100644
--- a/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue
@@ -118,10 +118,7 @@ watch(
) {
return;
}
- if (
- !schema ||
- database.schemas.findIndex((s: any) => s.name === schema) < 0
- ) {
+ if (!schema || database.schemas.findIndex((s) => s.name === schema) < 0) {
selectedSchemaName.value = first(database.schemas)?.name;
}
},
diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue
index 05e5cd03de..fb47dbd469 100644
--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue
@@ -276,7 +276,7 @@ const handleExportBtnClick = async ({
resolve,
}: {
options: ExportOption;
- reject: (reason?: any) => void;
+ reject: (reason?: unknown) => void;
resolve: (content: DownloadContent[]) => void;
}) => {
const contents: DownloadContent[] = [];
diff --git a/frontend/src/yaml.d.ts b/frontend/src/yaml.d.ts
index 6383136f48..63a41dc412 100644
--- a/frontend/src/yaml.d.ts
+++ b/frontend/src/yaml.d.ts
@@ -1,4 +1,4 @@
declare module "*.yaml" {
- const data: any;
+ const data: Record<string, unknown>;
export default data;
}