Description
Please describe what the rule should do:
The rule should enforce that if there's a <script>
, the setup
attribute should be on it.
What category should the rule belong to?
- 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:
Should also warn against non-setup
<script>
in a codebase that uses setup
:
<script>
export default {
mounted() {...}
}
</script>
I also saw a case where a dev was confused why they couldn't use <Component>
, and it was because they forgot to add setup
to <script>
:
<script>
import Component from './component.vue';
</script>
(In this case, it might also make sense to propose a separate rule that checks for <script>
tags with no default exports)
Additional context
For implementation, I was wondering if it might make sense to update block-lang
to something like block-attrs
where both lang
& setup
could be specified as required attributes.