ggascoigne / prettier-plugin-import-sort

Prettier plugin to pass javascript and typescript through import-sort
MIT License
110 stars 11 forks source link

Fix configuration path when outside project directory #1

Closed bespokebob closed 5 years ago

bespokebob commented 5 years ago

When running the plugin from an editor, the current working directory may not be the same as the project directory. Filepath never seems to be passed in as an option, so just fake it with the extension and resolve the directory name to the project directory this is running in. Note: this assumes that this plugin is installed in a node_modules folder of a project, not globally.

richardaum commented 4 years ago

Filepath never seems to be passed in as an option

I think it depends on the editor. By debugging VSCode, it provides the file path value properly.

bespokebob commented 4 years ago

Filepath never seems to be passed in as an option

I think it depends on the editor. By debugging VSCode, it provides the file path value properly.

This issue was over a year ago. It was definitely causing me trouble at the time, but there's no telling what has changed in VSCode and Prettier internals since then.