Skip to content

Commit

Permalink
feat: snapshot tests of no-array-constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuhiro-Mimaki committed Apr 21, 2024
1 parent 0e12c5c commit 90a7116
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
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.
```
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();

```

0 comments on commit 90a7116

Please sign in to comment.