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

Add fork of brace-style rule to support one line arrow functions #32

Merged
merged 1 commit into from Dec 28, 2018

Conversation

jimjenkins5
Copy link
Contributor

The base brace-style rule in eslint does not have an option to support
one line arrow functions like:

myFunction((b) => { doSomething(b); });

The only option available is allowSingleLine, which would allow the
above code to pass, but would also allow one line if statements.

This commit forks the brace-style rule and adds the option
allowSingleLineArrowFunctions.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 81.639% when pulling 696a63a on jimjenkins5:allow_oneline_arrow into fdb4381 on silvermine:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 81.639% when pulling 696a63a on jimjenkins5:allow_oneline_arrow into fdb4381 on silvermine:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 81.639% when pulling 696a63a on jimjenkins5:allow_oneline_arrow into fdb4381 on silvermine:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 81.639% when pulling 696a63a on jimjenkins5:allow_oneline_arrow into fdb4381 on silvermine:master.

@coveralls
Copy link

coveralls commented Dec 28, 2018

Coverage Status

Coverage decreased (-0.4%) to 81.639% when pulling c631354 on jimjenkins5:allow_oneline_arrow into fdb4381 on silvermine:master.

Copy link
Member

@jthomerson jthomerson left a comment

Choose a reason for hiding this comment

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

Just did a quick glance. I'll leave it to @yokuze to do the more thorough review.

/**
* @fileoverview Rule to flag block statements that do not use the one true brace style
* @author Ian Christian Myers
*/
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@yokuze yokuze left a comment

Choose a reason for hiding this comment

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

Your comment and commit message says the name of the option is allowSingleLineArrowFunctions but the code has allowSingleLineArrow. I think allowSingleLineArrowFunctions is clearer.

Everything else looks good.

@jimjenkins5
Copy link
Contributor Author

Actually, I changed it to allowSingleLineArrow to make it more consistent with other eslint rules. For example: https://eslint.org/docs/rules/space-before-function-paren#options asyncArrow not asyncArrowFunction. This is just one example, but ESLint doesn't seem to add Function in their rules and options. I'll update the commit message.

The base brace-style rule in eslint does not have an option to support
one line arrow functions like:

```
myFunction((b) => { doSomething(b); });
```

The only option available is `allowSingleLine`, which would allow the
above code to pass, but would also allow one line if statements.

This commit forks the brace-style rule and adds the option
`allowSingleLineArrow`.
@yokuze
Copy link
Contributor

yokuze commented Dec 28, 2018

Looks fine.

@jthomerson jthomerson merged commit 473585b into silvermine:master Dec 28, 2018
@jimjenkins5 jimjenkins5 deleted the allow_oneline_arrow branch December 28, 2018 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants