Skip to content

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

Closed
@hanneskuettner

Description

@hanneskuettner

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/reka-ui#313 for references.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions