IanVS / prettier-plugin-sort-imports

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

Account for missing filepath #104

Closed IanVS closed 1 year ago

IanVS commented 1 year ago

Fixes https://github.com/IanVS/prettier-plugin-sort-imports/issues/103

We were using a type which indicated that filepath would not be undefined, but perhaps that's the wrong type to be using. At any rate, I've adjusted our code to handle a missing filepath when prettier is used on text rather than a file.

The types we are using: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/748cf8849b6c67026557632fc1fe2ebbbef0700c/types/prettier/index.d.ts#L288