-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: snapshot tests of no-array-constructor
- Loading branch information
1 parent
0e12c5c
commit 90a7116
Showing
2 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
crates/biome_js_analyze/tests/specs/nursery/noArrayConstructor/invalid.js.snap
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,119 @@ | ||
--- | ||
source: crates/biome_js_analyze/tests/spec_tests.rs | ||
expression: invalid.js | ||
--- | ||
# Input | ||
```jsx | ||
Array(); | ||
|
||
Array(0, 1, 2); | ||
|
||
Array(...args); | ||
|
||
new Array(); | ||
|
||
new Array(0, 1, 2); | ||
|
||
new Array(...args); | ||
|
||
``` | ||
|
||
# Diagnostics | ||
``` | ||
invalid.js:1:1 lint/nursery/noArrayConstructor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! Don't use Array constructors. | ||
> 1 │ Array(); | ||
│ ^^^^^^^^ | ||
2 │ | ||
3 │ Array(0, 1, 2); | ||
i The array literal notation [] is preferable. | ||
``` | ||
|
||
``` | ||
invalid.js:3:1 lint/nursery/noArrayConstructor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! Don't use Array constructors. | ||
1 │ Array(); | ||
2 │ | ||
> 3 │ Array(0, 1, 2); | ||
│ ^^^^^^^^^^^^^^^ | ||
4 │ | ||
5 │ Array(...args); | ||
i The array literal notation [] is preferable. | ||
``` | ||
|
||
``` | ||
invalid.js:5:1 lint/nursery/noArrayConstructor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! Don't use Array constructors. | ||
3 │ Array(0, 1, 2); | ||
4 │ | ||
> 5 │ Array(...args); | ||
│ ^^^^^^^^^^^^^^^ | ||
6 │ | ||
7 │ new Array(); | ||
i The array literal notation [] is preferable. | ||
``` | ||
|
||
``` | ||
invalid.js:7:1 lint/nursery/noArrayConstructor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! Don't use Array constructors. | ||
5 │ Array(...args); | ||
6 │ | ||
> 7 │ new Array(); | ||
│ ^^^^^^^^^^^^ | ||
8 │ | ||
9 │ new Array(0, 1, 2); | ||
i The array literal notation [] is preferable. | ||
``` | ||
|
||
``` | ||
invalid.js:9:1 lint/nursery/noArrayConstructor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! Don't use Array constructors. | ||
7 │ new Array(); | ||
8 │ | ||
> 9 │ new Array(0, 1, 2); | ||
│ ^^^^^^^^^^^^^^^^^^^ | ||
10 │ | ||
11 │ new Array(...args); | ||
i The array literal notation [] is preferable. | ||
``` | ||
|
||
``` | ||
invalid.js:11:1 lint/nursery/noArrayConstructor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! Don't use Array constructors. | ||
9 │ new Array(0, 1, 2); | ||
10 │ | ||
> 11 │ new Array(...args); | ||
│ ^^^^^^^^^^^^^^^^^^^ | ||
12 │ | ||
i The array literal notation [] is preferable. | ||
``` |
19 changes: 19 additions & 0 deletions
19
crates/biome_js_analyze/tests/specs/nursery/noArrayConstructor/valid.js.snap
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,19 @@ | ||
--- | ||
source: crates/biome_js_analyze/tests/spec_tests.rs | ||
expression: valid.js | ||
--- | ||
# Input | ||
```jsx | ||
Array(500); | ||
|
||
Array(someOtherArray.length); | ||
|
||
new Array(500); | ||
|
||
new Array(someOtherArray.length); | ||
|
||
[0, 1, 2]; | ||
|
||
const createArray = (Array) => new Array(); | ||
|
||
``` |