Home > Mobile >  Vue: Auto-format/lint: move <script> before <template> tags
Vue: Auto-format/lint: move <script> before <template> tags

Time:09-19

Is there a way to configure ESLint/Prettier or similar tooling to automatically refactor .vue files in a way that <script> tag will be moved to the beginning of the file above the <template> tag?

From:

<template>
  …
</template>

<script>
  …
</script>

To:

<script>
  …
</script>

<template>
  …
</template>

CodePudding user response:

There is a eslint rule for that: vue/component-tags-order

  • Related