-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Update: add beforeStatementContinuationChars
to semi (fixes #9521)
#9594
Conversation
Maybe something like |
docs/rules/semi.md
Outdated
Object option (when `"never"`): | ||
|
||
* `"beforeUnreliableLineButSafe": "always"` requires semicolons at the end of statements if the next line starts with `[`, `(`, `/`, `+`, or `-`. | ||
* `"beforeUnreliableLineButSafe": "never"` disallows semicolons as the end of statements if it doesn't make ASI hazard even if the next line starts with `[`, `(`, `/`, `+`, or `-`. |
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.
Can you clarify the default value of beforeUnreliableLineButSafe
when never
is used? (Is it "ignore"
? If so, should we add an explicit "ignore"
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.
OK.
I was hovering between adding the description of "any"
or not because similar omitLastInOneLineBlock
option does not have the description about its default value.
I updated this PR. |
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.
LGTM, thanks!
beforeUnreliableLineButSafe
option to semi (fixes #9521)beforeStatementContinuationChars
option to semi (fixes #9521)
beforeStatementContinuationChars
option to semi (fixes #9521)beforeStatementContinuationChars
to semi (fixes #9521)
What is the purpose of this pull request? (put an "X" next to item)
[X] Changes an existing rule: fixes #9521.
What changes did you make? (Give an overview)
This PR adds a new option
beforeUnreliableLineButSafe
tosemi
rule. This option specifies the behavior about semicolons (or lacking semicolons) which satisfy the following two condition:[
,(
,+
,-
, or`
).For example:
The option can be one of three values:
{ beforeUnreliableLineButSafe: "any" }
ignores the semicolons (or lacking semicolon). This is the default. This is the current behavior.{ beforeUnreliableLineButSafe: "always" }
requires the semicolons.{ beforeUnreliableLineButSafe: "never" }
disallow the semicolons.Is there anything you'd like reviewers to focus on?
The option name
beforeUnreliableLineButSafe
is not the best name. Does somebody have a better idea?