-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sort keys and sort imports lint rules, and enable fix+format on save #1209
Conversation
@justinhaaheim is attempting to deploy a commit to the Facebook Open Source Team on Vercel. To accomplish this, @justinhaaheim needs to request access to the Team. Afterwards, an owner of the Team is required to accept their membership request. If you're already a member of the respective Vercel Team, make sure that your Personal Vercel Account is connected to your GitHub account. |
Open to other opinions here, but I wasn't having a particularly difficult time without this rule. I'm not a fan of the way it reorganized some of the keys in various contexts. For instance, in a hypothetical interface that contains "prev" and "next" keys, I think it makes sense for those two to be next to each other. I like the change to auto-lint on save, but the sorting I would prefer to hold off on. |
@acywatson In my mind the benefit of this rule is that keys are in a predictable order. You always know where they're going to be, everything is consistent, and there's no mental friction about "where do I add this new key..." in an object. Putting keys in a logical order ( If there is a case where logical order makes sense, I'd say that's a good candidate for block disabling of this lint rule in that specific case. |
I think we should give this a go and see how it works out. I'm not super happy about the current situation of some modules, where type imports are randomly scattered through the imports in the heading, so it might not be too much of an issue. Are the others up for trying it out? |
An owner of the Facebook Open Source Team on Vercel accepted @justinhaaheim's request to join. @justinhaaheim's commit is now being deployed. |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/fbopensource/lexical/AVrPAoSnkSzwWYPVSCFYLR49b1hG |
380d784
to
fd531a4
Compare
60c39f2
to
426f8d8
Compare
@zurfyx do you have feelings about this, either way?
Does this affect import order? I thought it was just keys in objects and interfaces. |
I'll add the sort imports lint rule too. This PR enables the auto fixing of that on save. |
426f8d8
to
76207fb
Compare
Sort imports is now added in as well. I'll rebase tonight, run eslint & prettier on the whole repo and then merge. |
76207fb
to
44be90c
Compare
44be90c
to
f16b1ad
Compare
f16b1ad
to
ff2c7ae
Compare
Bump version of flowtype eslint plugin to fix bugs with autofixing
ff2c7ae
to
2568270
Compare
…ave (#1209) * Add sort keys rule and update configs so it works Bump version of flowtype eslint plugin to fix bugs with autofixing * Add sort imports fixable lint rule * Run lint fix and prettier on whole repo * Fix unit tests broken by key sorting
This adds lint rules to sort keys (including in flow type defs). It updates the vscode settings to run lint fixes and then formatting on save, which is the way fb vscode works on www.
I have another branch that actually runs all the fixes, which I kept separate from this for clarity.
EDIT: here's that PR: #1210