Skip to content

feat(eslint-plugin): add prefer-function-type rule #222

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

Merged

Conversation

uniqueiniquity
Copy link
Contributor

Add rule equivalent to TSLint's 'callable-types'.

@bradzacher
Copy link
Member

@armano2 / @JamesHenry - why do we "support" implements on interfaces?

Typescript errors out if you try it?
https://www.typescriptlang.org/play/#src=interface%20Bar%20%7B%0D%0A%0D%0A%7D%0D%0A%0D%0Ainterface%20Foo%20implements%20Bar%20%7B%0D%0A%20%20%0D%0A%7D

@armano2
Copy link
Collaborator

armano2 commented Feb 6, 2019

we errors on them to, if user sets errorOnTypeScriptSyntacticAndSemanticIssues but right now we are outputting ast with "invalid" nodes to, this should not be handled in this rule, and it should be ignored during linting

@armano2
Copy link
Collaborator

armano2 commented Feb 6, 2019

you can find a little more info here: #185 (comment)

@armano2
Copy link
Collaborator

armano2 commented Feb 6, 2019

if we are going to be able to get semantic errors in "cheap" way without creating program, i'm going to cleanup AST from all invalid nodes, right now prettier expects that we are going to output ast as is, and they can rebuild it without changing functionality only style

@j-f1
Copy link
Contributor

j-f1 commented Feb 6, 2019

Should this have a different name? Perhaps prefer-function-type?

@uniqueiniquity
Copy link
Contributor Author

@j-f1 I'm open for naming suggestions. I was just matching TSLint's name, since I don't have a good sense of the ESLint rule naming conventions

@bradzacher
Copy link
Member

(hint: we don't really have any solid naming conventions yet 😅 )

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but now that it's been pointed out, I agree the name could be a lot clearer

@bradzacher
Copy link
Member

Code LGMT - change the name and we're good to go

@JamesHenry
Copy link
Member

Apologies for the conflicts, we decided to remove the counts from the ROADMAP here: #225

They are too awkward to maintain manually, so this is the last time you will have to deal with syncing that up!

armano2
armano2 previously approved these changes Feb 7, 2019
Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

Merging #222 into master will increase coverage by 0.04%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   96.79%   96.83%   +0.04%     
==========================================
  Files          56       57       +1     
  Lines        2525     2558      +33     
  Branches      374      374              
==========================================
+ Hits         2444     2477      +33     
  Misses         42       42              
  Partials       39       39
Impacted Files Coverage Δ
...es/eslint-plugin/lib/rules/prefer-function-type.js 100% <100%> (ø)

@uniqueiniquity uniqueiniquity changed the title feat(eslint-plugin): add callable-types rule feat(eslint-plugin): add prefer-function-types rule Feb 8, 2019
@uniqueiniquity uniqueiniquity changed the title feat(eslint-plugin): add prefer-function-types rule feat(eslint-plugin): add prefer-function-type rule Feb 8, 2019
@uniqueiniquity uniqueiniquity merged commit b95c4cf into typescript-eslint:master Feb 8, 2019
@uniqueiniquity uniqueiniquity deleted the addCallableTypes branch February 8, 2019 16:49
kaicataldo pushed a commit to kaicataldo/typescript-eslint that referenced this pull request Aug 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Luckeu pushed a commit to Luckeu/typescript-eslint that referenced this pull request Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants