-
Notifications
You must be signed in to change notification settings - Fork 166
test: run additional lint checks only on modified files #2586
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
@brian-smith-tcril @arbrandes Thoughts on this? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2586 +/- ##
==========================================
+ Coverage 94.78% 94.79% +0.01%
==========================================
Files 1225 1226 +1
Lines 27399 27490 +91
Branches 5992 6029 +37
==========================================
+ Hits 25969 26060 +91
Misses 1372 1372
Partials 58 58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I'm split on this one. The benefits are obvious, but I have a few concerns: Pros:
Cons:
I think ideally I'd want to see changes come in as 2 PRs
That way reviews would stay focused. In the case I had concerns with the best practice cleanup but not the new fix/feature, I'd be able to:
This follows a pattern I've used in another project I've worked on where some code is absurdly undocumented (functions named I'm not opposed to implementing this rule as it stands in this PR, but I'd like to think about ways to mitigate this change encouraging PRs to move from "do X" to "do X and Y." |
|
@brian-smith-tcril I guess I haven't been as concerned with the commit history, especially since we usually squash PRs and there has been a decent amount of "drive-by" cleanups going on in this repo. I do agree it would be nicer to separate the cleanups into their own PRs, but that might be too much to ask from contributors who just came to fix a bug (etc.) and weren't expecting to be roped into doing a separate cleanup PR. Another option could be to turn on additional lint checks for TypeScript files only. I suspect that many of the extra lints are already passing in TypeScript files since they're newer and using newer patterns. Ideally I would also include a check that PRs never add new JS(X) files. This wouldn't help improve the current codebase, but would ensure that newer code at least is following all the best practices. |
Description
We've had a "Best Practices Checklist" in our PR template for a while, but I'd like to start using linters to enforce the best practices more. However, that is tough with such a huge codebase where there's a lot of code to refactor.
This PR introduces a new way of running additional, stricter lint rules that only apply to modified files. The idea is that contributors will be expected to make these refactors as they go, improving any code that they happen to touch in their PRs.
For this initial version, the diff check only rejects
injectIntl,defaultProps, andconnect()as they are all quite easy to refactor. Later, I'd also like to banpropTypesfrom modified code, although that can require a more significant refactor (to TypeScript) so I'm holding off on it for now.If this experiment is successful, we may wish to extend it to all repos.
Testing instructions
Check out this branch, modify some files (including .jsx files with
defaultProps), then runnpm run lint:diffOther information
Private ref MNG-4670.
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypes,defaultProps, andinjectIntlpatterns are not used in any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'