Closed tony closed 3 years ago
You're not really saying what's not working, or which command line you are talking about. But to answer your question, yes, I use this with the module style in my editor all of the time and it gives the same results as running prettier from the command line.
prettier
, it works.style
in package.json
isn't obeyed. It overwrites the custom style (I suppose with style: 'module'
: It's not apparent whyAre there any commands you know where I could provide more diagnostic information? I'd be happy to provide more info!
It spent 2+ hours reading through the code of this and import-sort. It's not obvious where and how settings get applied to import-sort
. I think the issue stems from import-sort's configuration having a lot of magic.
I use this with the module style in my editor all of the time and it gives the same results as running prettier from the command line.
That's good!
Any more details? Editor? What sort of setup is involved? Just running prettier
via a plugin, or does it run import-sort
separately after?
What does the project configuration look like (between this plugin and prettier)?
well I'm using it in IntelliJ rather than VSCode, I've tested it in VSCode but don't actively use it.
That said, there are a couple of things that might be worth digging into related to working directly.
I'm pretty sure that the VSCode plugin assumes that the package.json and the node_modules will be loaded from the root folder of the project - if that's not the case for you, then you'll likely need to do something about that.
I'm pretty sure that the VSCode plugin assumes that the package.json and the node_modules will be loaded from the root folder of the project - if that's not the case for you, then you'll likely need to do something about that.
I verified that - it looks fine, I believe.
This really looks like a PR needs to be made for the import-sort-config package, it needs to somehow:
In order to solve the first part I will take a look at how eslint/babel/prettier/etc resolves their configs. I'm assuming hopefully they have a sane way of doing that.
As for what to do with this card - do you want to close it? Keep it open to see if anyone else comes by with input?
I'll leave it open for now - as you said it might help someone. But yes, all in all there's very little in the plugin and most everything else is in the import-sort package itself.
When I tried this with vim and VSCode, the settings for
importSort
give different results than running vim through CLII think it could have to do with #11 but not sure.
We use the https://github.com/unsplash/import-sort-style-unsplash as an import style, e.g.
Has anyone else had luck getting the settings to work with their editor?