Skip to content

Commit 3a13ee5

Browse files
committed
Add tests
1 parent 5fb313e commit 3a13ee5

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/src/rules/no-unresolved.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path';
22

3-
import { test, SYNTAX_CASES, testVersion } from '../utils';
3+
import { getTSParsers, test, SYNTAX_CASES, testVersion } from '../utils';
44

55
import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve';
66

@@ -414,3 +414,25 @@ ruleTester.run('import() with built-in parser', rule, {
414414
})) || [],
415415
),
416416
});
417+
418+
context('TypeScript', () => {
419+
for (const parser of getTSParsers()) {
420+
if (parser !== require.resolve('typescript-eslint-parser')) {
421+
ruleTester.run('no-unresolved ignore type-only', rule, {
422+
valid: [
423+
test({
424+
code: 'import type { JSONSchema7Type } from "@types/json-schema";',
425+
parser,
426+
}),
427+
],
428+
invalid: [
429+
test({
430+
code: 'import { JSONSchema7Type } from "@types/json-schema";',
431+
errors: [ "Unable to resolve path to module '@types/json-schema'." ],
432+
parser,
433+
}),
434+
],
435+
});
436+
}
437+
}
438+
});

0 commit comments

Comments
 (0)