eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

Add suggestions to `vue/no-export-in-script-setup`

Open chouchouji opened this issue 9 months ago • 1 comments

Tell us about your environment

  • ESLint version: 8.44.0
  • eslint-plugin-vue version: 9.17.0
  • Vue version: 3.3.4
  • Node version: 18.17.0

The problem you want to solve.

Can we add fixer to autofix this code for vue/no-export-in-script-setup rule?

Image

Your take on the correct solution to problem.

Additional context

If you think so, I am pleased to submit a pr. Thanks!

chouchouji avatar Feb 21 '25 09:02 chouchouji

In #2701, the rule was already improved to only report the export keyword for statements that might be relevant for local code, e.g.:

export const foo = 'bar'
console.log(foo)

As a potential follow-up improvement, a PR would be welcome that adds suggestions that remove the reported code (i.e. the whole statement for export * from 'foo' and only the export keyword for export const foo = 'bar'). For more context, see https://github.com/vuejs/eslint-plugin-vue/pull/2701#discussion_r1981066376.

Autofixes are considered too dangerous for this rule to break other code.

FloEdelmann avatar Mar 05 '25 13:03 FloEdelmann