Skip to content

[no-export-in-script-setup] allow to export typescript interfaces/types #1696

Closed
@stafyniaksacha

Description

@stafyniaksacha

What rule do you want to change?

https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-export-in-script-setup.js
https://eslint.vuejs.org/rules/no-export-in-script-setup.html

Does this change cause the rule to produce more or fewer warnings?

no

How will the change be implemented? (New option, new default behavior, etc.)?
A new option should be enough, but I think it should be enabled by default

Please provide some example code that this change will affect:

<script setup lang="ts">
import { ref } from 'vue'

// this should be allowed
export type ComponentItem = {
  name: string,
}

// this should be allowed too
export interface ComponentProps {
  items: ComponentItem[]
}

const props = withDefaults(defineProps<ComponentProps>(), {
  items: () => [],
})
</script>

What does the rule currently do for this code?
The rules reject the export, regardless what is exported

What will the rule do after it's changed?
When lang of script is set to ts, allow exporting either type or interface

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions