vue/prefer-define-options
eslint-plugin-vue
Safe autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/prefer-define-options": "error",
},
},
];<script>
export default {
name: "MyComponent",
inheritAttrs: false,
};
</script>
<script setup>
const props = defineProps(["title"]);
</script><script setup>
defineOptions({
name: "MyComponent",
inheritAttrs: false,
});
const props = defineProps(["title"]);
</script><script>
export default {
name: "MyComponent",
};
</script>Examples from the Biome documentation.
vue/prefer-define-options
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/prefer-define-options": "error",
},
},
];Oxlint does not have this rule.
nursery/useVueDefineOptions
nursery · since 2.6.4
{
"linter": {
"rules": {
"nursery": {
"useVueDefineOptions": "error"
}
}
}
}Enforce using v-model instead of :prop/@update:prop pair
Enforce or forbid the use of the scoped and module attributes in SFC top level style tags
Disallow importing Vue compiler macros