prettier-plugin-sort-imports icon indicating copy to clipboard operation
prettier-plugin-sort-imports copied to clipboard

Not sorting imports in .vue files

Open fbjorn opened this issue 3 years ago • 4 comments

Hi, I have a following config:

{
  "importOrder": [
    "^vue/(.*)$",
    "^[^@v](.*)$",
    "^@(.*)$",
    "^[./]"
  ],
  "importOrderSeparation": true,
}

And an App.vue file (already formatted with prettier):

<script>
import Vue from 'vue'
import TheNavBar from '@/components/TheNavBar'
import dayjs from 'dayjs'
</script>

When I copy its content to .ts file, it gets formatted as expected:

import Vue from 'vue'

import dayjs from 'dayjs'

import TheNavBar from '@/components/TheNavBar'

Is it possible to somehow enable .vue files support?

fbjorn avatar Apr 23 '21 13:04 fbjorn

Hey @fbjorn thanks for reporting this. Could you please provide a sample repo, it surely makes investigating this easier.

byara avatar Jun 13 '21 09:06 byara

@byara sure, I created a repo: https://github.com/fbjorn/vue-prettier-plugin-sort-imports-example

It's bare minimal, but demonstrates that plugins sorts .ts file correctly, but does nothing for a .vue

fbjorn avatar Jun 17 '21 10:06 fbjorn

Hi, We do not support the vue as of now. It is in our roadmap for version 4.

ayusharma avatar Aug 06 '21 14:08 ayusharma

I'm looking forward to Vue support! :rocket:

muety avatar Nov 18 '21 15:11 muety

I've added the base support for .vue files; i've successfully applied the patch via yarn patch and working successfully in a large project.

blake-newman avatar Oct 10 '22 15:10 blake-newman