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
Allow padding on simple returns for newline-before-return #6176
Comments
I think The doc says (emphasis mine):
|
I support @alberto's suggested change 👍, though this would be a breaking change to the rule. I wonder if we should make it an option that relaxes the rule for that case? |
I added |
There is still the question of whether this is a breaking change and it should instead be treated as an enhancement go behind an option @eslint/eslint-team There are a good number of tests asserting this behaviour |
I think we can modify the default behavior because this change is relaxing, so it probably will not break existing CI tests of users. |
In JSCS, relaxing rules was not considered a breaking change. |
Can we document what should be considered as breaking change? See JSCS example https://github.com/jscs-dev/node-jscs/blob/master/OVERVIEW.md#user-content-versioning--semver for reference |
I concur that this is a bug as the documentation seems to indicate that the desired behavior. I've opened an issue so we can discuss formalizing a semver policy: #6244 |
I like this as an option. When should this be available? It looks like it is already included but I am not seeing it working. |
Hey there, this should be in as of >2.11.0 http://eslint.org/blog/2016/05/eslint-v2.11.0-released#bug-fixes |
@kaicataldo That's what I was thinking but I am not able to get this option to work; I still get:
... in my lint results output. My
I've tried all permutation of |
Ah yeah, that's the |
@kaicataldo Correct, it is the update: Here is a repo I put together to illustrate the issue - https://github.com/kalisjoshua/eslint-bug-example. |
Looks like this fix was just for newlines before |
ESLint Version: 2.10.1
Problem:
Using
newline-before-return
withpadded-blocks
causes a conflict, aspadded-blocks
insists on padded spacing for functions, andnewline-before-return
complains if there is a newline before a return statement by itself in a function.Recommended Solution:
Add an option to
newline-before-return
to ignore scenarios where the only statement in a function block is the return statement.For example:
This will allow ESLint to properly support it's built-in plugins without changing the default functionality of the
newline-before-return
rule. With the above configuration:This code would result in an error:
This code would be valid with both plugins:
The text was updated successfully, but these errors were encountered: