Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import/first causes .vue files with both <script> and <script setup> to break #2

Open
hanneskuettner opened this issue Jan 13, 2025 · 0 comments

Comments

@hanneskuettner
Copy link
Member

hanneskuettner commented Jan 13, 2025

The import/first rule causes Vue components that have both <script> and <script setup> tags to break because of the auto fix.

With the rule this code

<script lang="ts">
export const myVar = {};
</script>

<script lang="ts" setup>
import foo from './foo.vue'

</script>

would be "fixed" into this

<script lang="ts">
</script>

<script lang="ts" setup>
import foo from './foo.vue'

export const myVar = {};
</script>

which breaks the export, since Vue SFC components can't export anything other than types from the script setup block.

See vuejs/eslint-plugin-vue#1577 and unovue/radix-vue#313 for references.

I suggest disabling this rule for **/*.vue files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant