Closed rrd108 closed 2 months ago
Would we assume the correct order for this is:
<script setup></script>
<template></template>
<style></style>
Or how could we approach this rule?
Yes, choose the opiniated order above.
Hi @rrd108 I have a question, which interface / type should I use to handle all blocks? script, template and style
?
I'm trying the SFCBlock
type but I'm not sure here what to send as first parameter here:
Because the checkRules
function receives SFCDescriptor
I think because of not using the correct struct, I'm having issues trying to test the rule with a project I have (the tests pass but with my own components doesnt report the rule)
In rulesCheck.ts
we execute all the checks. There you can see we use script
, template
, styles
of SFCDescriptor
, or the SFCDescriptor
itself, according the need.
As here we want to check the order of the blocks, I guess source
of SFCDescriptor
is the one to use here.
Will it work for this?
Will it work for this?
That was it! thanks
PR created 🚀 #78
https://vuejs.org/style-guide/rules-recommended.html#single-file-component-top-level-element-order