Skip to content

Commit 61f7745

Browse files
authored
test: add test for type-aware linting (#253)
Disabled on Linux for now. Will enable with a fix in a separate PR.
1 parent 5857a0f commit 61f7745

5 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
> vite lint ./src
2+
Found 0 warnings and 0 errors.
3+
Finished in <variable>ms on 1 file with <variable> rules using <variable> threads.
4+
5+
6+
> echo //comment >> types.ts
7+
> vite lint ./src # non-type-aware linting doesn't read types.ts
8+
✓ cache hit, replaying
9+
Found 0 warnings and 0 errors.
10+
Finished in <variable>ms on 1 file with <variable> rules using <variable> threads.
11+
12+
13+
> vite lint --type-aware ./src
14+
Found 0 warnings and 0 errors.
15+
Finished in <variable>ms on 1 file with <variable> rules using <variable> threads.
16+
17+
18+
> echo //comment >> types.ts
19+
> vite lint --type-aware ./src # type-aware linting reads types.ts
20+
✗ cache miss: content of input 'types.ts' changed, executing
21+
Found 0 warnings and 0 errors.
22+
Finished in <variable>ms on 1 file with <variable> rules using <variable> threads.
23+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { Foo } from '../types';
2+
3+
declare const _foo: Foo;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ignoredPlatforms": ["linux"],
3+
"env": {
4+
"VITE_DISABLE_AUTO_INSTALL": "1"
5+
},
6+
"commands": [
7+
"vite lint ./src",
8+
"echo //comment >> types.ts",
9+
"vite lint ./src # non-type-aware linting doesn't read types.ts",
10+
11+
"vite lint --type-aware ./src",
12+
"echo //comment >> types.ts",
13+
"vite lint --type-aware ./src # type-aware linting reads types.ts"
14+
]
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type Foo = number;

0 commit comments

Comments
 (0)