Skip to content
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): [explicit-function-return-type] add option to allow concise arrows that start with void #1732

Merged
merged 2 commits into from Apr 13, 2020

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Mar 14, 2020

This is an option to complement the no-void base rule allowing the use of void in the same conditions.

Since that issue is still being evaluated, I've not made any reference to it, but the use-case is still valid even if the team decide against it.

The idea is to not require you to double up void:

const log = (message: string): void => void console.log(message);

This change means that an option can be enabled that allows you to drop the void return type:

const log = (message: string) => void console.log(message);

This is only allowed when the option is enabled and: the arrow function is concise, and starts with the void operator.


I'm completely open to bikeshedding on the name & such - I just didn't feel it was worth an issue given how small it is to implement, and makes more sense seeing it visually.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @G-Rath!

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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@bradzacher bradzacher changed the title feat(eslint-plugin): allow concise arrows that start with void feat(eslint-plugin): [explicit-function-return-type] allow concise arrows that start with void Mar 14, 2020
@bradzacher bradzacher added the enhancement New feature or request label Mar 14, 2020
@codecov
Copy link

codecov bot commented Mar 20, 2020

Codecov Report

Merging #1732 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1732   +/-   ##
=======================================
  Coverage   94.48%   94.48%           
=======================================
  Files         162      162           
  Lines        7487     7494    +7     
  Branches     2146     2150    +4     
=======================================
+ Hits         7074     7081    +7     
  Misses        178      178           
  Partials      235      235           
Flag Coverage Δ
#unittest 94.48% <100.00%> (+<0.01%) ⬆️
Impacted Files Coverage Δ
...-plugin/src/rules/explicit-function-return-type.ts 100.00% <100.00%> (ø)
...-plugin/src/rules/restrict-template-expressions.ts 100.00% <0.00%> (ø)

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

code LGTM. it's pretty specific but sure, I'll allow it if they want to allow the change into eslint core.
lint again :)

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Apr 12, 2020
@G-Rath G-Rath requested a review from bradzacher April 12, 2020 23:31
@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Apr 13, 2020
@bradzacher bradzacher changed the title feat(eslint-plugin): [explicit-function-return-type] allow concise arrows that start with void feat(eslint-plugin): [explicit-function-return-type] add option to allow concise arrows that start with void Apr 13, 2020
@bradzacher bradzacher merged commit 2e9c202 into typescript-eslint:master Apr 13, 2020
@G-Rath G-Rath deleted the allow-implicit-void-return-type branch April 13, 2020 00:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants