Skip to content

Commit cc7de4a

Browse files
committed
Add tests
1 parent 983a774 commit cc7de4a

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

@@ -441,3 +441,25 @@ ruleTester.run('import() with built-in parser', rule, {
441441
})) || [],
442442
),
443443
});
444+
445+
context('TypeScript', () => {
446+
for (const parser of getTSParsers()) {
447+
if (parser !== require.resolve('typescript-eslint-parser')) {
448+
ruleTester.run('no-unresolved ignore type-only', rule, {
449+
valid: [
450+
test({
451+
code: 'import type { JSONSchema7Type } from "json-schema";',
452+
parser,
453+
}),
454+
],
455+
invalid: [
456+
test({
457+
code: 'import { JSONSchema7Type } from "json-schema";',
458+
errors: [ "Unable to resolve path to module 'json-schema'." ],
459+
parser,
460+
}),
461+
],
462+
});
463+
}
464+
}
465+
});

0 commit comments

Comments
 (0)