Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent ASI errors for conditional expressions
- Loading branch information
1 parent
44a23bb
commit 1059e99
Showing
8 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
test/form/samples/keep-tree-shaking-comments-no-asi/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
description: | ||
'always keep leading comments when tree-shaking and no automatic semicolons are inserted' | ||
}; |
7 changes: 7 additions & 0 deletions
7
test/form/samples/keep-tree-shaking-comments-no-asi/_expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
console.log( | ||
/* keep me */ | ||
'expected'); | ||
|
||
console.log( | ||
/* keep me */ | ||
'expected' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
console.log(false ? | ||
'unexpected' : | ||
/* keep me */ | ||
'expected'); | ||
|
||
console.log(true ? | ||
/* keep me */ | ||
'expected' : | ||
'unexpected'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'prevent automatic semicolon insertion from changing behaviour when tree-shaking', | ||
exports(exports) { | ||
assert.strictEqual(exports.test1(), 'expected'); | ||
assert.strictEqual(exports.test2(), 'expected'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export function test1() { | ||
return true ? | ||
|
||
|
||
'expected' : | ||
'unexpected'; | ||
} | ||
|
||
export function test2() { | ||
return false ? | ||
'unexpected' : | ||
|
||
|
||
'expected'; | ||
} |