-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [no-unsafe-call] check calls of Function #10010
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): [no-unsafe-call] check calls of Function #10010
Conversation
Thanks for the PR, @kirkwaiblinger! 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. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit d1e954c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10010 +/- ##
=======================================
Coverage 88.69% 88.70%
=======================================
Files 426 426
Lines 14829 14843 +14
Branches 4313 4318 +5
=======================================
+ Hits 13153 13166 +13
- Misses 1533 1534 +1
Partials 143 143
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -55,7 +55,7 @@ export function parseTSConfig(code?: string): TSConfig { | |||
const moduleRegexp = /(module\.exports\s*=)/g; | |||
|
|||
function constrainedScopeEval(obj: string): unknown { | |||
// eslint-disable-next-line @typescript-eslint/no-implied-eval | |||
// eslint-disable-next-line @typescript-eslint/no-implied-eval, @typescript-eslint/no-unsafe-call |
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.
To be clear,
// this is the no-implied-eval violation
const yoloFunction = Function('inline function');
// this is the no-unsafe-call violation
yoloFunction();
They just happen to be on the same line here. So, this isn't a case of these rules stepping on each others' toes IMO.
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.
Awesome. Just some comments on testing/style, nothing major.
} | ||
// etc | ||
} | ||
``` |
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.
[Praise] Great example, really clear and concise.
return; | ||
} | ||
} else { | ||
// eslint-disable-next-line no-lonely-if |
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.
y?
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.
oh. I'll revert that.
This is just my personal vendetta; I really, really dislike no-lonely-if. IMO if/elseif should only be used for conditions which can be safely reorded, which is incompatible with no-lonely-if
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.
Sweet!
PR Checklist
Overview
Function
type in existing rule.Function
typed" rather than "any
typed"