Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

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 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.

None yet

2 participants