1.0.10 ā¢ Published 1 year ago
eslint-plugin-gdx-lint v1.0.10
gdx-lint/vue-setup-sorting
Rule that warns if Vue setup script sorted in a wrong way.
š§ This rule is NOT automatically fixable by the --fix
CLI option.
Fail
const fuf = computed(() => store.payment.fuf);
const some = ref(''); // `some` should appear after Const, Props, Emit, ref in the script tag.
Pass
const MAGIC_NUMBER = 100000000000;
defineProps();
defineEmits();
const some = ref('');
const fuf = computed<string>(() => store.payment.fuf);
function someFunction(): void {
// ...
}
const { doSomeLogic } = useSomeHook();
onMounted(() => someFunction());
someFunction();
Options
This rule supports the following options:
order: [array]
:
The default order is ["const", "props", "emits", "ref", "computed", "function", "hook", "lifeCycleHook"]
.
You can set the options like this:
"gdx-lint/vue-setup-sorting": [
1, // warning
{
"order": [
"const",
"props",
"emits",
"ref",
"computed",
"function",
"hook",
"lifeCycleHook"
]
}
]