What's Changed
This project began as a fork because I wanted a plugin that would not move side-effect imports around and mess with my CSS cascade. So its first and most distinguishing feature is that side-effect imports do not move, and other imports are not sorted across them.
This works fine in most cases, but some people have side-effect imports that they know can be sorted safely. For those, there is now an "escape hatch" option named importOrderSafeSideEffects
. It is an array of glob pattern strings (similar to importOrder
) which, when they match against a side-effect import, allow that import to be sorted as if it were a standard import.
Suggestions for safe use:
- Use
^
at the start of your pattern and$
at the end, to avoid accidentally matching part of an import name. For example,"^server-only$"
, to avoid matching againstimport "not-server-only"
. - Use extreme caution if matching against relative files or CSS files. If you decide to sort CSS imports and a file ever imports more than one CSS file, your cascade may change.
- You can still use
// prettier-ignore
to stop sorting a particular import that would otherwise be sorted.
Feedback on this feature is welcome.
Features
Internal
Full Changelog: v4.6.3...v4.7.0