Does not Sort in One Go
FlorianWendelborn opened this issue · 12 comments
In very large and nested type definitions, I’ve noticed that this plugin needs up to 5 runs in order to fix all reported sorting issues. First time it finds ~3000, then ~500, then ~50, then 1, then 0.
This wouldn’t be a big deal for manually written code as it rarely changes in significant ways. The file in question is an auto-generated typescript definition file for an entire OpenAPI specification though
I'd happily accept a PR addressing the issue
@FlorianWendelborn did you start on a PR for fixing this? I'm experiencing the same problem with linting OpenAPI generated type files.
I have the same problem, is anyone working on it ?
I’m not working on it as I no longer need this particular solution. It’s still a good improvement though unless it’s already fixed so I’m not closing it
I had a similar problem with an autogenerated TypeScript file from a GraphQL schema and found a workaround. Running the eslint -- fix
command in a bash until
loop ended up doing the trick for me. Here's the script in my package.json
:
"scripts": {
"eslint-gql": "bash -c \"until eslint 'types/api/graphql.ts' --fix --cache; do echo \\\"linting again...\\\"; done\""
}
Not the most elegant solution, but it'll work for now. Hope it helps!
I've started working on this. Too much of a pet peeve to introduce to my repo, everyone will hate me if they have to save 5 times
So far I've added a test with ~400 entries, 150 to be sorted. Will be a good baseline to go from