amatiasq / vsc-sort-imports

Sort ES6 imports automatically.
ISC License
58 stars 24 forks source link

Use the sort order in .eslintrc or allow setting of eslint rules #29

Closed stevensacks closed 2 years ago

stevensacks commented 6 years ago

This is my .eslintrc for sorting

        "sort-imports": [
            "warn",
            {
                "ignoreCase": true,
                "memberSyntaxSortOrder": ["multiple", "single", "all", "none"]
            }
        ],

It's different than the default, which is ["none", "all", "multiple", "single"].

I suggest either reading from eslintrc (or an option to do so), or add the following additional settings:

sort-imports.eslint.ignoreCase: true/false
sort-imports.eslint.ignoreMemberSort: true/false
sort-imports.eslint.memberSyntaxSortOrder: // see above for the 4 choices

If sort-imports.default-sort-style is not eslint, you can ignore those extra settings.

Thoughts?

amatiasq commented 6 years ago

I agree this would be an awesome feature, it will be quite complex to implement dough and I don't have much time for it, but if you find time PRs are always welcome.

I guess the way to implement it would be to create a import-sort style that generates different configurations by reading the .eslintrc file.

drackp2m commented 3 years ago

I have the same problem as @stevensacks. Unfortunately more than two years have passed and the issue is still open and the feature was not added to the plugin. The truth is that it is a shame, because it is the best of all the ones I found.

I checked the code a little bit above, and I don't dare to touch anything.

amatiasq commented 3 years ago

I checked the code a little bit above, and I don't dare to touch anything.

Then it will not change, I've moved to other projects and AFAIK there is no active development here. If you ever dare to change it I'll be here to assist you.

drackp2m commented 3 years ago

That's fine, knowing that it's not going to get better on its own, maybe when I also have fewer things to do I'll review it more in depth and ask you some questions to try not to break anything, and then do a PR. =)

daidodo commented 2 years ago

Sorry to hijack but just walk by and can't help to share that this extension is doing exactly what you ask for. (@drackp2m) https://github.com/daidodo/format-imports/wiki/ESLint-Compatibility#sort-imports

stevensacks commented 2 years ago

I have long since abandoned this for simple-import-sort