-
-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lint/useTemplate): preserve leading non-string addition
- Loading branch information
Showing
19 changed files
with
934 additions
and
735 deletions.
There are no files selected for viewing
319 changes: 143 additions & 176 deletions
319
crates/rome_js_analyze/src/analyzers/style/use_template.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
crates/rome_js_analyze/tests/specs/style/useTemplate/invalid.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,51 @@ | ||
foo + 'baz'; | ||
|
||
1 * 2 + 'foo'; | ||
|
||
1 + 2 + 3 + "px" + 4 + 5; | ||
|
||
a + b + c + 'px' + d + e; | ||
|
||
1 + 'foo' + 2 + 'bar' + 'baz' + 3; | ||
|
||
(1 + 'foo') * 2; | ||
|
||
1 * (2 + 'foo') + 'bar'; | ||
|
||
'foo' + 1; | ||
|
||
'foo' + `bar${`baz${'bat' + 'bam'}`}` + 'boo'; | ||
|
||
'foo' + 1 + 2; | ||
|
||
1 + '2' - 3; | ||
|
||
foo() + ' bar'; | ||
|
||
foo() + '\n'; | ||
|
||
1 * /**leading*/'foo' /**trailing */ + 'bar'; | ||
|
||
// strings including `${` | ||
|
||
'${foo.' + bar + '.baz}'; | ||
|
||
'foo: ${bar.' + baz + '.bat}'; | ||
|
||
'foo: `bar.' + baz + '.bat}'; | ||
|
||
'${foo}: `bar.' + baz + '.bat}'; | ||
|
||
'foo: ${bar.' + baz + '.bat}'; | ||
|
||
'foo: `bar.' + baz + '.bat}'; | ||
|
||
'foo: \\${bar.' + baz + '.bat}'; | ||
|
||
'foo: \\${bar.' + baz + '.bat}'; | ||
|
||
// parentheses | ||
|
||
const x = a + ("b") + c; | ||
|
||
("a") + (b) + ("c"); |
Oops, something went wrong.