-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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-base-to-string] add checkArrayJoin option #10287
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR, @yeonjuan! 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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10287 +/- ##
==========================================
+ Coverage 86.56% 86.61% +0.04%
==========================================
Files 431 432 +1
Lines 15188 15176 -12
Branches 4418 4428 +10
==========================================
- Hits 13148 13144 -4
+ Misses 1683 1675 -8
Partials 357 357
Flags with carried forward coverage won't be shown. Click here to find out more.
|
IMO: this doesn't have to be an option. I can't think of a case where someone checks all other cases but wants to allow |
@@ -30,6 +32,8 @@ export default createRule<Options, MessageIds>({ | |||
requiresTypeChecking: true, | |||
}, | |||
messages: { | |||
baseArrayJoin: | |||
"Using `join()` for {{name}} use Object's default stringification format ('[object Object]') when stringified.", |
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.
should this message have the certainty
too?
"Using `join()` for {{name}} use Object's default stringification format ('[object Object]') when stringified.", | |
"Using `join()` for {{name}} {{certainty}} use Object's default stringification format ('[object Object]') when stringified.", |
Otherwise "Using join() for {} use..." is ungrammatical and should be fixed?
"Using `join()` for {{name}} use Object's default stringification format ('[object Object]') when stringified.", | |
"Using `join()` for {{name}} uses Object's default stringification format ('[object Object]') when stringified.", |
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.
(test) could you add maybe one or two tests around arrays that aren't literals (eg passed in as parameters) as well as as generic parameters?
node: TSESTree.Expression, | ||
): void { | ||
const memberExpr = node.parent as TSESTree.MemberExpression; | ||
const type = services.getTypeAtLocation(memberExpr.object); |
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.
wondering if we need getConstrainedTypeAtLocation
here in order to handle generics nicely?
@Josh-Cena @kirkwaiblinger Thank you for your review. I've fixed it. |
PR Checklist
Overview