diff --git a/oxlint.json b/oxlint.json index 4037bc44c..7b2f41899 100644 --- a/oxlint.json +++ b/oxlint.json @@ -1,6 +1,6 @@ { "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["typescript", "import", "unicorn"], + "plugins": ["typescript", "import", "unicorn", "vue"], "env": { "browser": true, "es2024": true @@ -17,7 +17,20 @@ "import/no-self-import": "error", "unicorn/no-instanceof-array": "error", - "unicorn/no-typeof-undefined": "error" + "unicorn/no-typeof-undefined": "error", + + "vue/no-arrow-functions-in-watch": "error", + "vue/no-deprecated-destroyed-lifecycle": "error", + "vue/no-export-in-script-setup": "error", + "vue/no-lifecycle-after-await": "error", + "vue/no-import-compiler-macros": "error", + "vue/prefer-import-from-vue": "error", + "vue/valid-define-emits": "error", + "vue/valid-define-props": "error", + "vue/no-required-prop-with-default": "error", + "vue/define-emits-declaration": "error", + "vue/define-props-destructuring": "error", + "vue/require-typed-ref": "error" }, "overrides": [ { diff --git a/src/components/AppSelect.vue b/src/components/AppSelect.vue index 6240f62f9..c164ca4b3 100644 --- a/src/components/AppSelect.vue +++ b/src/components/AppSelect.vue @@ -13,7 +13,7 @@ import { import { selectContent, selectItem, selectTrigger } from '@/components/ui/select' -defineProps<{ +const { options, placeholder } = defineProps<{ options: { value: T; label: string }[] placeholder?: string }>() diff --git a/src/components/ColorInput.vue b/src/components/ColorInput.vue index 364ef031e..e6d19873e 100644 --- a/src/components/ColorInput.vue +++ b/src/components/ColorInput.vue @@ -4,13 +4,10 @@ import { colorToHexRaw, parseColor } from '@open-pencil/core' import type { Color } from '@/types' -const props = withDefaults( - defineProps<{ - color: Color - editable?: boolean - }>(), - { editable: false } -) +const { color, editable = false } = defineProps<{ + color: Color + editable?: boolean +}>() const emit = defineEmits<{ update: [color: Color] @@ -18,8 +15,8 @@ const emit = defineEmits<{ function onHexChange(e: Event) { const hex = (e.target as HTMLInputElement).value - const color = parseColor(hex.startsWith('#') ? hex : `#${hex}`) - emit('update', { ...color, a: props.color.a }) + const parsed = parseColor(hex.startsWith('#') ? hex : `#${hex}`) + emit('update', { ...parsed, a: color.a }) } diff --git a/src/components/ColorPicker.vue b/src/components/ColorPicker.vue index 6ff7032f3..6d2f6fbb4 100644 --- a/src/components/ColorPicker.vue +++ b/src/components/ColorPicker.vue @@ -7,7 +7,7 @@ import HsvColorArea from './HsvColorArea.vue' import type { Color } from '@/types' -const props = defineProps<{ +const { color } = defineProps<{ color: Color }>() @@ -15,7 +15,7 @@ const emit = defineEmits<{ update: [color: Color] }>() -const swatchColor = computed(() => colorToCSS(props.color)) +const swatchColor = computed(() => colorToCSS(color))