You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are defineEmits and defineProps macros in script setup.
It would be nice to have a rule that moves these macros on top of the file.
What category should the rule belong to?
[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
<!-- ✓ GOOD -->
<script setup>
defineEmits(/* ... */)
defineProps(/* ... */)
/* some code here */
</script>
<!-- ✗ BAD -->
<script setup>
/* some code here */
const bar = ref()
/* some code here */
defineEmits(/* ... */)
/* some code here */
defineProps(/* ... */)
</script>
Additional context
We write code this way in my company. Maybe it's a convenient way to define props/emits on the top.
If it would be helpful I'd like to create this eslint rule.
The text was updated successfully, but these errors were encountered:
edikdeisling
added a commit
to edikdeisling/eslint-plugin-vue
that referenced
this issue
Apr 19, 2022
Please describe what the rule should do:
There are
defineEmits
anddefineProps
macros in script setup.It would be nice to have a rule that moves these macros on top of the file.
What category should the rule belong to?
[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
<!-- ✓ GOOD --> <script setup> defineEmits(/* ... */) defineProps(/* ... */) /* some code here */ </script>
<!-- ✗ BAD --> <script setup> /* some code here */ const bar = ref() /* some code here */ defineEmits(/* ... */) /* some code here */ defineProps(/* ... */) </script>
Additional context
We write code this way in my company. Maybe it's a convenient way to define props/emits on the top.
If it would be helpful I'd like to create this eslint rule.
The text was updated successfully, but these errors were encountered: