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
Converted no-unnecessary-generics from TSLint to ESLint #539
Converted no-unnecessary-generics from TSLint to ESLint #539
Conversation
Bump @sandersn - is there any chance this & the other open TSLint->ESLint PRs be looked at soon, please? |
"strict": true, | ||
"target": "esnext" | ||
}, | ||
"files": ["file.ts"] |
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.
does this require a real 'file.ts' to exist? A quick read of the documentation suggests 'yes'.
Edit: But...all tests pass, so maybe not.
`function example<T>(a: T[]): T;`, | ||
`function example<T>(a: Set<T>): T;`, | ||
`function example<T>(a: Set<T>, b: T[]): void;`, | ||
`function example<T>(a: Map<T, T>): void;`, |
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.
missing the last example function example<T, U extends T>(t: T, u: U): U
|
||
return soleUse ? { type: "sole", soleUse } : { type: "never" }; | ||
|
||
function recurse(node: ts.Node): void { |
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.
function recurse(node: ts.Node): void { | |
function recur(node: ts.Node): void { |
The original verb form is 'recur'. But you can't have the noun form be *recurion, because, roughly, it violates a constraint on the pronunciation of the -ion suffix. 's' turns out to be the cheapest insertion that satisfies the constraint, giving you 'recursion'.
However, the noun 'recursion' gets used a lot more than the verb 'recur', so people end up treating that form as primary and creating the verb 'recurse' from 'recursion'. Chomskyan linguistics doesn't have a good explanation for this last part since it's not concerned with statistics or language change.
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.
Haha, as much as I love discussion Chomskyan linguistics in PRs, this was the established convention in TSLint back in the day.
Whew! Finally got a clean local run -- looots of exemptions on this one, in varying syntaxes. I'm going merge this now. |
Continues the work from #489.
Deduplicates the
typescript
package dependency versions by switching them all to the stable 4.7.4 (which was already being used). Without deduped versions, there are type errors like:Also adds a
tsconfig.json
to thedtslint
tests directory so that ESLint rules using type information can be tested. https://typescript-eslint.io/docs/development/custom-rules#testing-typed-rules