unjs / mlly

๐Ÿค Common ECMAScript module utils
MIT License
471 stars 36 forks source link

fix(parseStaticImport): omit empty import names #232

Closed patzick closed 9 months ago

patzick commented 9 months ago

๐Ÿ”— Linked issue

-

โ“ Type of change

๐Ÿ“š Description

Hey @pi0, the last release is causing problems for imports formatted by prettier, where the comma is added at the end, like

import {
  something,
  somethingElse,
} from "package"

that causes errors in unimport: image

This PR fixes that and adds a test to make sure we're covering that case. Cheers!

๐Ÿ“ Checklist

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.27%. Comparing base (226a47b) to head (6cbcf1b). Report is 15 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #232 +/- ## ========================================== - Coverage 88.04% 87.27% -0.78% ========================================== Files 8 8 Lines 1062 1092 +30 Branches 188 199 +11 ========================================== + Hits 935 953 +18 - Misses 127 139 +12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.