smeijer / unimported

Find and fix dangling files and unused dependencies in your JavaScript projects.
MIT License
1.97k stars 71 forks source link

Support Vue SFC Syntax - multi-line <script> tag #162

Closed subdavis closed 8 months ago

subdavis commented 1 year ago

Similar to #159

Works properly

<script lang="ts" setup>
/** This code will get parsed! */
<script>

Does not work

Common tools like prettier with singleAttributePerLine will format a Vue SFC like this.

<script
  lang="ts"
  setup
>
/** This code will not get parsed */
<script>

solution

Unfortunately because the regex works line-by-line, it's not possible to simply fix the script regex. The change needed to fix this bug requires a more complicated change to how script extraction works.

smeijer commented 1 year ago

Can you submit a pull request? I'd be happy to add support for that. Even tho I'm a bit surprised by that syntax. 😅

smeijer commented 8 months ago

This project is being archived. Please check the readme for more info.