IanVS / prettier-plugin-sort-imports

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

Allow disabling plugin by setting importOrder to `[]` #161

Closed IanVS closed 4 months ago

IanVS commented 4 months ago

Closes https://github.com/IanVS/prettier-plugin-sort-imports/issues/159

This changes up how we handle importOrder: [] in the prettier config. Previously, we would have applied our default config, such that builtins, node modules, and relative imports would be sorted. Now, it effectively disables the plugin so that no sorting takes place.

This could be seen as a breaking change, but instead I see it as a bug fix. It doesn't make sense that using an explicit empty array for the setting causes a fallback to be used.

Additionally, this gives users more control over disabling the plugin and turning it on only for certain subfolders or types of files, as shown in the referenced issue and documented in the readme in this PR.

IanVS commented 4 months ago

Thanks for the reviews!