-
Notifications
You must be signed in to change notification settings - Fork 885
Improve Curly Rule to allow no brackets same-line statements #2334
Conversation
One question re: documentation. I updated the documentation at the top of |
It looks like the tests are failing, though they're running fine locally for me. Could it perhaps be a node version issue? I'm running 6.2.2. |
Yep, looks like it was a node version issue. I was trying to be fancy with |
docs are no longer checked in and are generated for each release |
src/rules/curlyRule.ts
Outdated
* \`"${OPTION_IGNORE_SAME_LINE}"\` skips checking braces for control-flow statements | ||
that are on one line and start on the same line as their control-flow keyword | ||
Note: \`"${OPTION_ALWAYS}"\` will be overriden by any "ignore" options that are also set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can safely remove always
since it's not actually used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nchen63 Do you mean just from the docs or overall as an option in general?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the option in general. We're parsing optionAlways
and not reading it, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nchen63 I went ahead and pulled out the entire option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. thanks @devrelm!
src/rules/curlyRule.ts
Outdated
* \`"${OPTION_IGNORE_SAME_LINE}"\` skips checking braces for control-flow statements | ||
that are on one line and start on the same line as their control-flow keyword | ||
Note: \`"${OPTION_ALWAYS}"\` will be overriden by any "ignore" options that are also set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the option in general. We're parsing optionAlways
and not reading it, right?
…r#2334) * "ignore-same-line" option
PR checklist
Overview of change:
In #822, there was a request to improve the Curly rule with the ability to have single-line unbraced statements.
I had originally opened PR #1565 to fix this, which added the options per my comment on that issue. The requested updates to that pull request, plus some merge conflicts from TSLint 4.0 refactoring in the meantime made it more useful to create this new PR instead of updating the original.
This PR is much more focused than the first and keeps closer to the original request (#822). I still tried to leave the code easy to extend in case more options are added later, but this should hopefully come off as a much more subtle and evolutionary change compared to my prior PR's near-rewrite.
Is there anything you'd like reviewers to focus on?
Please read the prior pull request (#1565) for context on design decisions.
CHANGELOG.md entry:
[new-rule-option]
curly
added optionignore-same-line