-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Never print comments in compact mode #3146
Conversation
Current coverage is
|
@@ -231,7 +231,7 @@ export default class Printer extends Buffer { | |||
if (this.format.shouldPrintComment) { | |||
return this.format.shouldPrintComment(comment.value); | |||
} else { | |||
if (comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0) { | |||
if (!this.format.compact && comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0) { |
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.
should this be !compact && (@license || @preserve)
?
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 precedence works out. || has higher precedence
On Monday, December 7, 2015, René Kooi notifications@github.com wrote:
In packages/babel-generator/src/printer.js
#3146 (comment):@@ -231,7 +231,7 @@ export default class Printer extends Buffer {
if (this.format.shouldPrintComment) {
return this.format.shouldPrintComment(comment.value);
} else {
if (comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0) {
if (!this.format.compact && comment.value.indexOf("@license") >= 0 || comment.value.indexOf("@preserve") >= 0) {
should this be !compact && (@license || @preserve)?
—
Reply to this email directly or view it on GitHub
https://github.com/babel/babel/pull/3146/files#r46809012.
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.
Doesn't &&
have higher precedence?
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.
huh, maybe, I'll just add parens ;P
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.
Ex:
false && true || true // returns true
false && (true || true) // returns false
Never print comments in compact mode
No description provided.