-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add const reassign rule * Update src/utils/logs.ts Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com> * Update tests --------- Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
- Loading branch information
1 parent
f74d0a9
commit d6fd383
Showing
4 changed files
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const path = require('node:path'); | ||
const MAIN_ID = path.resolve(__dirname, 'main.js'); | ||
|
||
module.exports = defineTest({ | ||
description: 'Cannot reassign a variable declared with `const`', | ||
error: { | ||
code: 'CONST_REASSIGN', | ||
frame: ` | ||
1: const foo = 1;\n2: foo = 2;\n ^ | ||
`, | ||
id: MAIN_ID, | ||
loc: { | ||
column: 0, | ||
file: MAIN_ID, | ||
line: 2 | ||
}, | ||
message: 'Cannot reassign a variable declared with `const`', | ||
pos: 15, | ||
watchFiles: [MAIN_ID] | ||
} | ||
}); |
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 @@ | ||
const foo = 1; | ||
foo = 2; |