From fa46f982eb9e3cfc056afeb0c4a35032d5fd7b27 Mon Sep 17 00:00:00 2001
From: Thomas Wang <55052188+cxzlw@users.noreply.github.com>
Date: Fri, 29 Nov 2024 23:17:28 +0800
Subject: [PATCH] fix: pass eslint (#46)
* fix: @typescript-eslint/no-empty-object-type
* fix: vue/no-dupe-keys
* fix: use @ts-expect-error instead of @ts-ignore
* fix: irregular space
* fix: @typescript-eslint/no-empty-object-type
* fix: v-for and v-if related errors
* fix: add eslint disable for typst
---
eslint.config.js | 2 +
extensions/chart/src/widgets/bubbleChart.vue | 23 ++--
extensions/chart/src/widgets/scatterChart.vue | 23 ++--
extensions/geometry/src/dot.vue | 43 +++----
extensions/layout/src/container.vue | 6 +-
extensions/math/src/math-function.vue | 6 +-
extensions/math/src/number-axis.vue | 92 ++++++++++----
extensions/math/src/number-plane.vue | 120 +++++++++---------
extensions/table/src/table-item.vue | 6 +-
extensions/typst/src/index.vue | 34 +++--
packages/app/src/components/Preview.vue | 40 +++---
packages/client/entry.ts | 19 ++-
12 files changed, 228 insertions(+), 186 deletions(-)
diff --git a/eslint.config.js b/eslint.config.js
index 2eff106..91cf0e0 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -23,6 +23,8 @@ export default [
"@typescript-eslint/no-explicit-any": "off",
"vue/multi-word-component-names": "off",
"@typescript-eslint/no-unused-vars": "warn",
+ // 这条规则被类型检查器替代
+ "no-undef": "off",
},
},
];
diff --git a/extensions/chart/src/widgets/bubbleChart.vue b/extensions/chart/src/widgets/bubbleChart.vue
index a970b97..aeb420d 100644
--- a/extensions/chart/src/widgets/bubbleChart.vue
+++ b/extensions/chart/src/widgets/bubbleChart.vue
@@ -1,24 +1,21 @@
@@ -27,6 +24,4 @@ options.style = {
-
+
diff --git a/extensions/chart/src/widgets/scatterChart.vue b/extensions/chart/src/widgets/scatterChart.vue
index 0909e96..eee7544 100644
--- a/extensions/chart/src/widgets/scatterChart.vue
+++ b/extensions/chart/src/widgets/scatterChart.vue
@@ -1,24 +1,21 @@
@@ -27,6 +24,4 @@ options.style = {
-
+
diff --git a/extensions/geometry/src/dot.vue b/extensions/geometry/src/dot.vue
index 1724b21..29429fa 100644
--- a/extensions/geometry/src/dot.vue
+++ b/extensions/geometry/src/dot.vue
@@ -1,42 +1,41 @@
-
+
{{ options.tag }}
diff --git a/extensions/layout/src/container.vue b/extensions/layout/src/container.vue
index ef942cd..f5e0342 100644
--- a/extensions/layout/src/container.vue
+++ b/extensions/layout/src/container.vue
@@ -30,7 +30,7 @@ const children = useChildren();
const mountedFlag = ref(false);
-const width: ComputedRef = computed(() => {
+const _width: ComputedRef = computed(() => {
if (!mountedFlag.value) return 0;
if (options.width) return options.width;
const counter: number[] = [];
@@ -39,7 +39,7 @@ const width: ComputedRef = computed(() => {
});
return Math.max(...counter);
});
-const height: ComputedRef = computed(() => {
+const _height: ComputedRef = computed(() => {
if (!mountedFlag.value) return 0;
if (options.height) return options.height;
const counter: number[] = [];
@@ -94,7 +94,7 @@ const paddingRight = computed(
height: `${height}px`,
}"
>
-
+
diff --git a/extensions/math/src/math-function.vue b/extensions/math/src/math-function.vue
index 3c6ddad..1a72ba7 100644
--- a/extensions/math/src/math-function.vue
+++ b/extensions/math/src/math-function.vue
@@ -1,8 +1,8 @@
- {{ (options.trend ?? (x => (x).toString()))((i + options.domain[0]) / 2) }} π
+ {{
+ (options.trend ?? ((x) => x.toString()))((i + options.domain[0]) / 2)
+ }}
+ π
- {{ (options.trend ?? (x => x.toString()))(i + options.domain[0] - 1) }}
+ {{ (options.trend ?? ((x) => x.toString()))(i + options.domain[0] - 1) }}
-import type { Growable, WidgetOptions } from '@vue-motion/lib'
-import { Line, Text, widget } from '@vue-motion/lib'
-import { defineWidget } from '@vue-motion/core'
-import { NumberAxis } from '.'
+import { defineWidget } from "@vue-motion/core";
+import type { Growable, WidgetOptions } from "@vue-motion/lib";
+import { Line, Text, widget } from "@vue-motion/lib";
+import { NumberAxis } from ".";
export interface NumberPlaneOptions extends WidgetOptions, Growable {
- intervalX?: number
- trendX?: (count: number) => string
- tipX?: string // Arrow tip color or 'none'
- trimX?: string // Arrow trim color or 'none'
- fontColorX?: string // Font color
- fontSizeX?: number // Font size
- domainX: [number, number]
- intervalY?: number
- trendY?: (count: number) => string
- tipY?: string // Arrow tip color or 'none'
- trimY?: string // Arrow trim color or 'none'
- fontColorY?: string // Font color
- fontSizeY?: number // Font size
- domainY: [number, number]
- baseUnit?: 'number' | 'radian' | 'degree'
- grid?: boolean
- gridColor?: string
- gridWidth?: number
- yRotation?: number
+ intervalX?: number;
+ trendX?: (count: number) => string;
+ tipX?: string; // Arrow tip color or 'none'
+ trimX?: string; // Arrow trim color or 'none'
+ fontColorX?: string; // Font color
+ fontSizeX?: number; // Font size
+ domainX: [number, number];
+ intervalY?: number;
+ trendY?: (count: number) => string;
+ tipY?: string; // Arrow tip color or 'none'
+ trimY?: string; // Arrow trim color or 'none'
+ fontColorY?: string; // Font color
+ fontSizeY?: number; // Font size
+ domainY: [number, number];
+ baseUnit?: "number" | "radian" | "degree";
+ grid?: boolean;
+ gridColor?: string;
+ gridWidth?: number;
+ yRotation?: number;
}
-const props = defineProps()
-const options = defineWidget(props)
+const props = defineProps();
+const options = defineWidget(props);
-const Yrotation = options.yRotation ?? 90
-const domain = [options.domainX.sort(), options.domainY.sort()]
+const Yrotation = options.yRotation ?? 90;
+const domain = [options.domainX.sort(), options.domainY.sort()];
@@ -69,37 +69,39 @@ const domain = [options.domainX.sort(), options.domainY.sort()]
>
0
-
-
+
+
+
+
diff --git a/extensions/table/src/table-item.vue b/extensions/table/src/table-item.vue
index 81615c0..3b2073c 100644
--- a/extensions/table/src/table-item.vue
+++ b/extensions/table/src/table-item.vue
@@ -30,7 +30,7 @@ const children = useChildren();
const mountedFlag = ref(false);
-const width: ComputedRef = computed(() => {
+const _width: ComputedRef = computed(() => {
if (!mountedFlag.value) return 0;
if (options.width) return options.width;
const counter: number[] = [];
@@ -39,7 +39,7 @@ const width: ComputedRef = computed(() => {
});
return Math.max(...counter);
});
-const height: ComputedRef = computed(() => {
+const _height: ComputedRef = computed(() => {
if (!mountedFlag.value) return 0;
if (options.height) return options.height;
const counter: number[] = [];
@@ -99,7 +99,7 @@ const paddingRight = computed(
height: `${height}px`,
}"
>
-
+
diff --git a/extensions/typst/src/index.vue b/extensions/typst/src/index.vue
index b32a8d3..bac5786 100644
--- a/extensions/typst/src/index.vue
+++ b/extensions/typst/src/index.vue
@@ -1,30 +1,36 @@
+
diff --git a/packages/app/src/components/Preview.vue b/packages/app/src/components/Preview.vue
index 8f623af..c64bb13 100644
--- a/packages/app/src/components/Preview.vue
+++ b/packages/app/src/components/Preview.vue
@@ -1,38 +1,44 @@
diff --git a/packages/client/entry.ts b/packages/client/entry.ts
index e64a8e7..dc4e7ef 100644
--- a/packages/client/entry.ts
+++ b/packages/client/entry.ts
@@ -1,12 +1,11 @@
-import { createApp } from 'vue'
-// import './out.css'
-/** @ts-ignore */
-import App from 'virtual:user-main'
-/** @ts-ignore */
-import router from 'virtual:router'
-/** @ts-ignore */
-import player from 'virtual:player'
+import { createApp } from "vue";
+/** @ts-expect-error virtual-import */
+import player from "virtual:player";
+/** @ts-expect-error virtual-import */
+import router from "virtual:router";
+/** @ts-expect-error virtual-import */
+import App from "virtual:user-main";
-console.log(player)
+console.log(player);
-createApp(App).use(router).use(player).mount('#app')
+createApp(App).use(router).use(player).mount("#app");