Closed sitch closed 1 year ago
Yeah that sounds reasonable, would you like to submit a PR?
Also ran into this. Came around it by removing the plugins
from options for now. (Which also disables this plugin).
Was also thinking the optional chain is the right fix. 👍
@IanVS happy to send a PR.
When using prettier to directly format a string, i.e.:
This raises an error because
filePath
isn't always available for the check:https://github.com/IanVS/prettier-plugin-sort-imports/blob/e20a9fd14a2d261d6c8602675ff0183010098b26/src/utils/normalize-plugin-options.ts#L91
Should be able to just use an option chain on that value
filepath?.endsWith(".ts")