Skip to content

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

chore: fix eslint warning (#2478)

boojack90ede3571979
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 606c4b3303..237e327b12 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -14,10 +14,10 @@ module.exports = {
"plugin:prettier/recommended",
],
rules: {
- "no-empty-pattern": "warn",
- "no-useless-escape": "warn",
+ "no-empty-pattern": "error",
+ "no-useless-escape": "error",
"prettier/prettier": [
- "warn",
+ "error",
{
useTabs: false,
tabWidth: 2,
@@ -26,17 +26,17 @@ module.exports = {
printWidth: 80,
},
],
- "@typescript-eslint/no-empty-interface": "warn",
- "@typescript-eslint/no-explicit-any": "off",
- "@typescript-eslint/no-non-null-assertion": "off",
+ "@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-unused-vars": [
- "warn",
+ "error",
{ varsIgnorePattern: "^_", args: "none" },
],
- "vue/no-mutating-props": "warn",
- "vue/multi-word-component-names": "warn",
- "vue/no-unused-components": "warn",
- "vue/no-useless-template-attributes": "warn",
+ "vue/no-mutating-props": "error",
+ "vue/no-unused-components": "error",
+ "vue/no-useless-template-attributes": "error",
+ "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-non-null-assertion": "off",
+ "vue/multi-word-component-names": "off",
},
ignorePatterns: [
"node_modules",
diff --git a/frontend/src/components/DataSourceConnectionPanel.vue b/frontend/src/components/DataSourceConnectionPanel.vue
index df7401ea68..7a07e061e6 100644
--- a/frontend/src/components/DataSourceConnectionPanel.vue
+++ b/frontend/src/components/DataSourceConnectionPanel.vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-mutating-props -->
<template>
<!-- Description list -->
<form class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
diff --git a/frontend/src/components/DataSourceCreateForm.vue b/frontend/src/components/DataSourceCreateForm.vue
index 36cbd2757c..940c770b75 100644
--- a/frontend/src/components/DataSourceCreateForm.vue
+++ b/frontend/src/components/DataSourceCreateForm.vue
@@ -151,6 +151,7 @@ export default defineComponent({
// If database is specified, then we just show that database instead of the database select
database: {
type: Object as PropType<Database>,
+ default: undefined,
},
},
emits: ["create", "cancel"],
diff --git a/frontend/src/components/DataSourceSelect.vue b/frontend/src/components/DataSourceSelect.vue
index 67c89dbeec..d0ee4d8c20 100644
--- a/frontend/src/components/DataSourceSelect.vue
+++ b/frontend/src/components/DataSourceSelect.vue
@@ -45,9 +45,11 @@ export default defineComponent({
props: {
selectedId: {
type: Number,
+ default: undefined,
},
database: {
type: Object as PropType<Database>,
+ default: undefined,
},
disabled: {
default: false,
diff --git a/frontend/src/components/DataSourceTable.vue b/frontend/src/components/DataSourceTable.vue
index cdda75f47f..ba596e7016 100644
--- a/frontend/src/components/DataSourceTable.vue
+++ b/frontend/src/components/DataSourceTable.vue
@@ -120,6 +120,7 @@ export default defineComponent({
// If database is specified, then we just list the data source for that database.
database: {
type: Object as PropType<Database>,
+ default: undefined,
},
},
setup(props) {
diff --git a/frontend/src/components/Issue/IssueStatusIcon.vue b/frontend/src/components/Issue/IssueStatusIcon.vue
index 0f4877ed3a..7fe7cf0852 100644
--- a/frontend/src/components/Issue/IssueStatusIcon.vue
+++ b/frontend/src/components/Issue/IssueStatusIcon.vue
@@ -54,6 +54,7 @@ export default defineComponent({
// Specify taskStatus if we want to show the task specific status when issueStatus is OPEN.
taskStatus: {
type: String as PropType<TaskStatus>,
+ default: undefined,
},
size: {
type: String as PropType<SizeType>,
diff --git a/frontend/src/components/MemberSelect.vue b/frontend/src/components/MemberSelect.vue
index 672c9ba09e..de6c6a0613 100644
--- a/frontend/src/components/MemberSelect.vue
+++ b/frontend/src/components/MemberSelect.vue
@@ -31,17 +31,10 @@
<span class="truncate">{{ item.name }}</span>
</span>
</template>
- <template #placeholder="{ placeholder }: { placeholder: string }">
- <!--TODO(tianzhou): Have to set a fixed width, otherwise the width would change based on the selected text.
- Likely, there is a better solution, while the author doesn't want to fight with CSS for now.
- The specific value and breakpoint is to make it align with other select in the issue sidebar.
- -->
- <!-- Add my-0.5 padding to avoid flickering when switching to assignee -->
- <span class="flex my-0.5 lg:40 xl:w-44">
- <span class="truncate" :class="required ? 'text-error' : ''">{{
- $t(placeholder)
- }}</span>
- </span>
+ <template #placeholder>
+ <span class="leading-6 truncate" :class="required ? 'text-error' : ''">{{
+ $t(placeholder)
+ }}</span>
</template>
</BBComboBox>
</template>
diff --git a/frontend/src/components/RepositoryForm.vue b/frontend/src/components/RepositoryForm.vue
index 4f76d56d12..23d90cd8d8 100644
--- a/frontend/src/components/RepositoryForm.vue
+++ b/frontend/src/components/RepositoryForm.vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-mutating-props -->
<template>
<div class="space-y-4">
<div>
diff --git a/frontend/src/components/VCSProviderBasicInfoPanel.vue b/frontend/src/components/VCSProviderBasicInfoPanel.vue
index 20ddb61596..d7c67aa535 100644
--- a/frontend/src/components/VCSProviderBasicInfoPanel.vue
+++ b/frontend/src/components/VCSProviderBasicInfoPanel.vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-mutating-props -->
<template>
<div class="textlabel">
{{ $t("version-control.setting.add-git-provider.choose") }}
@@ -174,6 +175,7 @@ export default defineComponent({
});
const changeUrl = (value: string) => {
+ // eslint-disable-next-line vue/no-mutating-props
props.config.instanceUrl = value;
if (state.urlValidationTimer) {
@@ -201,12 +203,16 @@ export default defineComponent({
// FIXME: Unexpected mutation of "config" prop. Do we care?
const changeType = () => {
if (props.config.type == "GITLAB_SELF_HOST") {
+ // eslint-disable-next-line vue/no-mutating-props
props.config.instanceUrl = "";
+ // eslint-disable-next-line vue/no-mutating-props
props.config.name = t(
"version-control.setting.add-git-provider.gitlab-self-host"
);
} else if (props.config.type == "GITHUB_COM") {
+ // eslint-disable-next-line vue/no-mutating-props
props.config.instanceUrl = "https://github.com";
+ // eslint-disable-next-line vue/no-mutating-props
props.config.name = "GitHub.com";
}
};
diff --git a/frontend/src/layouts/InstanceLayout.vue b/frontend/src/layouts/InstanceLayout.vue
index 3b1fad48c3..ae4830e63c 100644
--- a/frontend/src/layouts/InstanceLayout.vue
+++ b/frontend/src/layouts/InstanceLayout.vue
@@ -31,9 +31,11 @@ export default {
},
databaseSlug: {
type: String,
+ default: "",
},
dataSourceSlug: {
type: String,
+ default: "",
},
},
};
diff --git a/frontend/src/views/sql-editor/AsidePanel/QueryHistoryContainer.vue b/frontend/src/views/sql-editor/AsidePanel/QueryHistoryContainer.vue
index c18f38a8fe..70c6cb8536 100644
--- a/frontend/src/views/sql-editor/AsidePanel/QueryHistoryContainer.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/QueryHistoryContainer.vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-v-html -->
<template>
<div
class="relative p-2 space-y-2 w-full h-full flex flex-col justify-start items-start"
diff --git a/frontend/src/views/sql-editor/AsidePanel/SheetContainer.vue b/frontend/src/views/sql-editor/AsidePanel/SheetContainer.vue
index 73d0e1b86b..ab23a6fac0 100644
--- a/frontend/src/views/sql-editor/AsidePanel/SheetContainer.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/SheetContainer.vue
@@ -1,3 +1,4 @@
+<!-- eslint-disable vue/no-v-html -->
<template>
<div
class="relative p-2 space-y-2 w-full h-full flex flex-col justify-start items-start"
@@ -14,23 +15,23 @@
</div>
<div class="w-full flex flex-col justify-start items-start overflow-y-auto">
<div
- v-for="query in data"
- :key="query.id"
+ v-for="sheet in sheetList"
+ :key="sheet.id"
class="w-full px-1 pr-2 py-2 border-b flex flex-col justify-start items-start cursor-pointer"
:class="`${
- tabStore.currentTab.sheetId === query.id
+ tabStore.currentTab.sheetId === sheet.id
? 'bg-gray-100 rounded border-b-0'
: ''
}`"
- @click="handleSheetClick(query)"
+ @click="handleSheetClick(sheet)"
>
<div class="pb-1 w-full flex flex-row justify-between items-center">
<div
class="w-full mr-2"
- @dblclick="handleEditSheet(query.id, query.name)"
+ @dblclick="handleEditSheet(sheet.id, sheet.name)"
>
<input
- v-if="state.editingSheetId === query.id"
+ v-if="state.editingSheetId === sheet.id"
ref="queryNameInputerRef"
v-model="state.currentSheetName"
type="text"
@@ -39,12 +40,12 @@
@keyup.enter="handleSheetNameChanged"
@keyup.esc="handleCancelEdit"
/>
- <span v-else class="text-sm" v-html="query.formatedName"></span>
+ <span v-else class="text-sm" v-html="sheet.formatedName"></span>
</div>
<NDropdown
trigger="click"
:options="actionDropdownOptions"
- @select="(key: string) => handleActionBtnClick(key, query)"
+ @select="(key: string) => handleActionBtnClick(key, sheet)"
@clickoutside="handleActionBtnOutsideClick"
>
<NButton text @click.stop>
@@ -59,7 +60,7 @@
<p
class="max-w-full text-gray-400 break-words font-mono truncate"
style="font-size: 10px"
- v-html="query.formatedStatement"
+ v-html="sheet.formatedStatement"
></p>
</div>
</div>
@@ -116,7 +117,7 @@ const state = reactive<State>({
const queryNameInputerRef = ref<HTMLInputElement>();
-const data = computed(() => {
+const sheetList = computed(() => {
const filterSheetList =
sqlEditorStore.sharedSheet.id !== UNKNOWN_ID
? [...sheetStore.sheetList, sqlEditorStore.sharedSheet]
@@ -202,7 +203,7 @@ const handleSheetNameChanged = () => {
const handleDeleteSheet = () => {
if (state.currentActionSheet) {
- sheetStore.deleteSheet(state.currentActionSheet.id);
+ sheetStore.deleteSheetById(state.currentActionSheet.id);
if (tabStore.currentTab.sheetId === state.currentActionSheet.id) {
tabStore.updateCurrentTab({