daidodo / format-imports-vscode

Format imports and exports for JavaScript and TypeScript in VS Code.
https://marketplace.visualstudio.com/items?itemName=dozerg.tsimportsorter
MIT License
62 stars 5 forks source link

Suggestion: create usable eslint rule for sorting to validate PRs #100

Open FFdhorkin opened 1 year ago

FFdhorkin commented 1 year ago

Is your feature request related to a problem? Please describe. I've been using the vscode extension for a few years and like it, but we have inconsistent adoption between team members and no way to enforce the rules.

Describe the solution you'd like I'd like a plugin for eslint that provides the same sorting options (or at least verification thereof), but can be used to verify the rules are applied properly for PRs

Describe alternatives you've considered I saw this Medium post earlier today, which talked about creating a custom rule for import grouping: https://medium.com/@pryvalov.bogddan/creating-custom-eslint-rule-grouping-up-imports-by-type-252a59ae5b02

It looks more straightforward to do that than I was expecting, and I was tempted to reinvent the wheel, but thought I'd create a suggestion here first

Additional context N/A

daidodo commented 11 months ago

Thanks for the feedback!

The plugin uses format-imports to do the job. There are 2 ways to validate whether some code follows the rules of the plugin:

At the moment, I'm busy on other things so please go ahead if you want to try. Hope the above info is helpful!