Hi all!
I've been looking into this Definitely Typed pull request and picking through the issues with @JoshuaKGoldberg. We encountered an interesting case with the no-unnecessary-generics rule which we think could be better. Consider:
<TElement extends HTMLElement = HTMLElement>(
html: JQuery.htmlString,
ownerDocument_attributes?: Document | JQuery.PlainObject,
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
): JQuery<TElement>;
You'll note that we have an eslint-disable-next-line just before the last line; the ReturnType of the method. Without this in place the red squigglies would be under:
JQuery<TElement>
~~~~~~~~
This isn't the useful place to have this report. Perhaps the better place would be the first mention of TElement, like so:
<TElement extends HTMLElement = HTMLElement>(
~~~~~~~~
Looking at
|
node: parserServices.tsNodeToESTreeNodeMap.get(res.soleUse), |
it seems this is intentional.
Is this good? What do you think?
Hi all!
I've been looking into this Definitely Typed pull request and picking through the issues with @JoshuaKGoldberg. We encountered an interesting case with the
no-unnecessary-genericsrule which we think could be better. Consider:You'll note that we have an
eslint-disable-next-linejust before the last line; the ReturnType of the method. Without this in place the red squigglies would be under:This isn't the useful place to have this report. Perhaps the better place would be the first mention of
TElement, like so:Looking at
DefinitelyTyped-tools/packages/eslint-plugin/src/rules/no-unnecessary-generics.ts
Line 57 in 822dadb
Is this good? What do you think?