-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): add extension rule init-declarations
#1814
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
feat(eslint-plugin): add extension rule init-declarations
#1814
Conversation
Thanks for the PR, @anikethsaha! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
@bradzacher similar for |
make sure you validate your code locally and fix the errors. |
Codecov Report
@@ Coverage Diff @@
## master #1814 +/- ##
==========================================
- Coverage 94.38% 94.36% -0.03%
==========================================
Files 165 166 +1
Lines 7592 7608 +16
Branches 2178 2185 +7
==========================================
+ Hits 7166 7179 +13
Misses 183 183
- Partials 243 246 +3
|
@bradzacher looks like there is some auth issue, I cant push to this branch after reading |
Make sure your local is up to date with the remote before pushing, or try force pushing if you want to overwrite the remote. |
I did rebase and after that its coming. Its up to date with upstream |
Co-Authored-By: Brad Zacher <brad.zacher@gmail.com>
Co-Authored-By: Brad Zacher <brad.zacher@gmail.com>
912e01f
to
25a7915
Compare
@bradzacher I did add some more tests but the diff coverage is still the same as before adding them |
https://codecov.io/gh/typescript-eslint/typescript-eslint/pull/1814/diff The lines marked with yellow are branches that haven't been tested. I.e. looking at your code + tests, you've got code that handles |
@bradzacher I don't know how to particularly test those lines. I did add some test cases to cover those conditions. |
In codecov, yellow means that one branch of a conditional check has been tested, but not the other branch. So looking at the code in question: if (
node.parent?.type === AST_NODE_TYPES.TSModuleBlock &&
node.parent?.parent?.type === AST_NODE_TYPES.TSModuleDeclaration &&
node.parent?.parent?.declare
) {
return;
} What is this (this is not me trying to be snarky here - I'm trying to drop a hint without giving you the answer 😄) Another thing I see you doing in your code a lot is you're using unnecessary optional chains eg you've got |
😅 I will give another try 👍 |
9a9fff7
to
44f4f16
Compare
@bradzacher anything missing, a hint would be great |
Those test are sufficient - the reason codecov is reporting lower is because of the optional chain. The branch target isn't a hard merge blocker. It's a guideline to help ensure people do enough tests and help me review that the tests cover the cases. |
I doubted that. idk even codecov supports the optional chaining or not
cool, 👍 |
init-declarations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks!
fixes #1811