diff --git a/packages/cli/snap-tests/oxlint-typeaware/package.json b/packages/cli/snap-tests/oxlint-typeaware/package.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/packages/cli/snap-tests/oxlint-typeaware/package.json @@ -0,0 +1 @@ +{} diff --git a/packages/cli/snap-tests/oxlint-typeaware/snap.txt b/packages/cli/snap-tests/oxlint-typeaware/snap.txt new file mode 100644 index 0000000000..dfc03f0dd1 --- /dev/null +++ b/packages/cli/snap-tests/oxlint-typeaware/snap.txt @@ -0,0 +1,23 @@ +> vite lint ./src +Found 0 warnings and 0 errors. +Finished in ms on 1 file with rules using threads. + + +> echo //comment >> types.ts +> vite lint ./src # non-type-aware linting doesn't read types.ts +✓ cache hit, replaying +Found 0 warnings and 0 errors. +Finished in ms on 1 file with rules using threads. + + +> vite lint --type-aware ./src +Found 0 warnings and 0 errors. +Finished in ms on 1 file with rules using threads. + + +> echo //comment >> types.ts +> vite lint --type-aware ./src # type-aware linting reads types.ts +✗ cache miss: content of input 'types.ts' changed, executing +Found 0 warnings and 0 errors. +Finished in ms on 1 file with rules using threads. + diff --git a/packages/cli/snap-tests/oxlint-typeaware/src/index.ts b/packages/cli/snap-tests/oxlint-typeaware/src/index.ts new file mode 100644 index 0000000000..10c5e7e0aa --- /dev/null +++ b/packages/cli/snap-tests/oxlint-typeaware/src/index.ts @@ -0,0 +1,3 @@ +import type { Foo } from '../types'; + +declare const _foo: Foo; diff --git a/packages/cli/snap-tests/oxlint-typeaware/steps.json b/packages/cli/snap-tests/oxlint-typeaware/steps.json new file mode 100644 index 0000000000..2955df5ff9 --- /dev/null +++ b/packages/cli/snap-tests/oxlint-typeaware/steps.json @@ -0,0 +1,15 @@ +{ + "ignoredPlatforms": ["linux"], + "env": { + "VITE_DISABLE_AUTO_INSTALL": "1" + }, + "commands": [ + "vite lint ./src", + "echo //comment >> types.ts", + "vite lint ./src # non-type-aware linting doesn't read types.ts", + + "vite lint --type-aware ./src", + "echo //comment >> types.ts", + "vite lint --type-aware ./src # type-aware linting reads types.ts" + ] +} diff --git a/packages/cli/snap-tests/oxlint-typeaware/types.ts b/packages/cli/snap-tests/oxlint-typeaware/types.ts new file mode 100644 index 0000000000..191a99ee30 --- /dev/null +++ b/packages/cli/snap-tests/oxlint-typeaware/types.ts @@ -0,0 +1 @@ +export type Foo = number;