-
-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(replace): prevent variable before colons from being replaced when…
… preventAssigment is true (#1609) * fix: prevent variable before colons from being replaced when preventAssignment is true. * feat: add typescript-declare test. --------- Co-authored-by: huanghao36 <[email protected]>
- Loading branch information
Showing
7 changed files
with
24 additions
and
3 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
8 changes: 8 additions & 0 deletions
8
packages/replace/test/fixtures/form/typescript-declare/_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,8 @@ | ||
module.exports = { | ||
description: "doesn't replace lvalue in typescript declare", | ||
isTypescript: true, | ||
options: { | ||
'NAME': 'replaced', | ||
preventAssignment: true | ||
} | ||
}; |
2 changes: 2 additions & 0 deletions
2
packages/replace/test/fixtures/form/typescript-declare/input.ts
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,2 @@ | ||
declare const NAME: string | ||
console.log(NAME) |
3 changes: 3 additions & 0 deletions
3
packages/replace/test/fixtures/form/typescript-declare/output.ts
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,3 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
declare const NAME: string | ||
console.log('replaced') |
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
Binary file not shown.