IanVS / prettier-plugin-sort-imports

An opinionated but flexible prettier plugin to sort import statements
Apache License 2.0
984 stars 25 forks source link

Formatting Vue SFC files error with @vue/compiler-sfc@2.7.16 #162

Closed shalldie closed 3 months ago

shalldie commented 6 months ago

Your Environment

Describe the bug

An error appear with @vue/compiler-sfc@2.7.16,but works well with @vue/compiler-sfc@3.4.21

To Reproduce

I made a respository which can reproduce this. https://github.com/shalldie/sort-import-err-in-compiler-sfc-2.7.16

And here's the steps (also in README.md):

Steps to reproduce

Case @vue/compiler-sfc@2.7.16

Now is @vue/compiler-sfc@2.7.16

  1. pnpm i
  2. format the file src/App.vue
  3. it shows error:
TypeError: Cannot read properties of undefined (reading 'match')

Case @vue/compiler-sfc@3.4.21

  1. Edit package.json to change the version to @vue/compiler-sfc@3.4.21
  2. run pnpm i
  3. format the file src/App.vue
  4. It works well.

Contribute to @ianvs/prettier-plugin-sort-imports

IanVS commented 3 months ago

@shalldie I've released version 4.3.0 which fixes the bug you reported here. Please try it out and let me know if it's working correctly for you now. And thanks for the report with the reproduction, that was very helpful!

shalldie commented 3 months ago

@shalldie I've released version 4.3.0 which fixes the bug you reported here. Please try it out and let me know if it's working correctly for you now. And thanks for the report with the reproduction, that was very helpful!

4.3.0 does a good work !