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

Fix: Update curly lint rule #42

Merged
merged 2 commits into from
Jun 2, 2017
Merged

Fix: Update curly lint rule #42

merged 2 commits into from
Jun 2, 2017

Conversation

stramel
Copy link
Contributor

@stramel stramel commented May 19, 2017

Went with multi-line based on lighthouse's eslintrc rules.

mutli-line: allow brace-less single-line if, else if, else, for, while, or do

The alternative one would be,

multi: http://eslint.org/docs/rules/curly#multi

@philipwalton
Copy link
Contributor

I think this rule doesn't quite fit because technically the JS style guide only allows single line if statements (i.e. it doesn't allow if (foo) foo++; else doSomething();.

Though maybe it's better to have something turned on here than not since I think it's not very common to do the example above.

@stramel
Copy link
Contributor Author

stramel commented Jun 2, 2017

Hmmm you are correct it doesn't but I also don't see a rule to accomplish this with the current eslint configuration.

I think it would be better than not having any rule on it. Is that the only case missed by this rule?

@philipwalton
Copy link
Contributor

Yeah, I think it's better to have an overly permissive rule than nothing (since nothing is also not correct). What I don't want is something that will incorrectly error on technically valid code.

Can you update your changes to keep the comment and then I'll merge?

@stramel
Copy link
Contributor Author

stramel commented Jun 2, 2017

@philipwalton I re-added but inline with the new rule and capped the line at 80 chars

@philipwalton philipwalton merged commit d7a198d into google:master Jun 2, 2017
@stramel stramel deleted the patch-2 branch June 2, 2017 21:57
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.

2 participants