You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great library! I am using it to add some determinism to our tsconfig files in our monorepo. One thing that would be helpful for us is a faster way to check if a file is already sorted. We run checks in CI to verify that files are in the right state, and while we can just "always sort" it is a little slow compared to our other "checks."
I was thinking that it would be easiest to implement something like this in the core library. I am willing to open a PR if you have suggestions for where and how to implement this.
There should probably be a corresponding flag on the CLI package, too.
The text was updated successfully, but these errors were encountered:
I think an isSorted() export could make sense, with e.g. a --check flag on the CLI 👍 The simplest way I can think of would be to basically go through the parsed data like the sorter does, but only comparing fields with their next sibling. If we encounter a value that should be before it's sibling, we exit early.
Since the comments are irrelevant to the order of the fields, there is a possibility that it would be faster to just strip all comments and use a regular JSON.parse, but I'm not sure if that would be worth it.
If you're keen then a PR is of course super welcome! ⭐
Thanks for the great library! I am using it to add some determinism to our tsconfig files in our monorepo. One thing that would be helpful for us is a faster way to check if a file is already sorted. We run checks in CI to verify that files are in the right state, and while we can just "always sort" it is a little slow compared to our other "checks."
I was thinking that it would be easiest to implement something like this in the core library. I am willing to open a PR if you have suggestions for where and how to implement this.
There should probably be a corresponding flag on the CLI package, too.
The text was updated successfully, but these errors were encountered: