Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Improve Curly Rule to allow no brackets same-line statements #2334

Merged
merged 8 commits into from
Mar 15, 2017

Conversation

devrelm
Copy link
Contributor

@devrelm devrelm commented Mar 12, 2017

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 option ignore-same-line

Sorry, something went wrong.

@devrelm
Copy link
Contributor Author

devrelm commented Mar 12, 2017

One question re: documentation. I updated the documentation at the top of curlyRule.ts, but are there any scripts that I have to run manually to update other static doc files (e.g. for the website)?

@devrelm devrelm changed the title Devrelm/curly Improve Curly rule with more granular options Mar 12, 2017
@devrelm devrelm changed the title Improve Curly rule with more granular options Improve Curly Rule to allow no brackets same-line statements Mar 12, 2017
@devrelm
Copy link
Contributor Author

devrelm commented Mar 12, 2017

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.

@devrelm
Copy link
Contributor Author

devrelm commented Mar 12, 2017

Yep, looks like it was a node version issue. I was trying to be fancy with includes -- I switched it to indexOf and everything looks good :)

@nchen63
Copy link
Contributor

nchen63 commented Mar 14, 2017

docs are no longer checked in and are generated for each release

* \`"${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.
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@nchen63 nchen63 left a 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!

* \`"${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.
Copy link
Contributor

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?

@nchen63 nchen63 merged commit 9e8ddd3 into palantir:master Mar 15, 2017
AJamesPhillips pushed a commit to AJamesPhillips/tslint that referenced this pull request Mar 23, 2017
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