Closed stormwarning closed 6 years ago
The custom style should be installed locally, the CLI version works because it's installed globally but the one used by the editor plugin is not.
I'd keep this issue open to improve the error message though.
Ah that makes sense. Is it possible to have the plugin check for a global install if it's not found locally, or would that be an "upstream" issue? I had a look through the code but I couldn't quite suss out where I'd make that change if I was going to submit a PR.
The parser and the style are provided here by the import-sort-config library. So I think you can open a PR to it in that case.
Thanks in any case for the report, sorry for the late response.
I'm also facing this issue when saving files. Is this error provoked by a bad configuration or something else? I have just installed the extension on my vs code and set this configs on my package.json: "importSort": { ".js, .jsx, .es6, .es": { "parser": "babylon", "style": "eslint", "options": {} }, ".ts, .tsx": { "parser": "typescript", "style": "tslint", "options": {} } },
@jgomesmv Without a deeper look I think this is related to the new version of import-sort
, I need to check that when I have time. Can you please create an issue for your problem in particular?
After some digging we have fixed the problem.
You need to change your import sort configuration on package.json file. The ts style must be changed from tslint to eslint. Just like:
Is it possible to improve the error message?
Good catch, I didn't see that
I get the above error when running
Sort imports
in VS Code.I have the following in my
package.json
I have
import-sort
and the custom sort style installed globally, rather than in the project dependencies, however it works as expected when running the CLI version so it seems like it should work with the editor plugin too.