Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit f9f7002

Browse files
committed
Add rule import/no-unresolved
1 parent beb3707 commit f9f7002

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

src/rules/import/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { DefaultRule } from './default';
2+
import type { NoUnresolvedRule } from './no-unresolved';
23

34
/**
45
* All import rules.
56
*/
6-
export type ImportRules = DefaultRule;
7+
export type ImportRules = DefaultRule & NoUnresolvedRule;

src/rules/import/no-unresolved.d.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Config.
5+
*/
6+
export type NoUnresolvedConfig = {
7+
/**
8+
* If `true` is provided, single-argument `require` calls will be resolved.
9+
*
10+
* @default false
11+
*
12+
* @see [commonjs](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md#options)
13+
*/
14+
commonjs?: boolean;
15+
/**
16+
* If `true` is provided, dependency paths for `define` and `require` calls will be resolved.
17+
*
18+
* @default false
19+
*
20+
* @see [amd](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md#options)
21+
*/
22+
amd?: boolean;
23+
/**
24+
* @see [ignore](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md#ignore)
25+
*/
26+
ignore?: string[];
27+
/**
28+
* By default, this rule will report paths whose case do not match the underlying filesystem path, if the FS is not case-sensitive.
29+
*
30+
* @default true
31+
*
32+
* @see [caseSensitive](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md#casesensitive)
33+
*/
34+
caseSensitive?: boolean;
35+
};
36+
37+
/**
38+
* Options.
39+
*/
40+
export type NoUnresolvedOptions = [number?, NoUnresolvedConfig?];
41+
42+
/**
43+
* Ensures an imported module can be resolved to a module on the local filesystem, as defined by standard Node `require.resolve` behavior.
44+
*
45+
* @see [no-unresolved](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md)
46+
*/
47+
export type NoUnresolvedRuleConfig = RuleConfig<NoUnresolvedOptions>;
48+
49+
/**
50+
* Ensures an imported module can be resolved to a module on the local filesystem, as defined by standard Node `require.resolve` behavior.
51+
*
52+
* @see [no-unresolved](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md)
53+
*/
54+
export interface NoUnresolvedRule {
55+
/**
56+
* Ensures an imported module can be resolved to a module on the local filesystem, as defined by standard Node `require.resolve` behavior.
57+
*
58+
* @see [no-unresolved](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md)
59+
*/
60+
'import/no-unresolved': NoUnresolvedRuleConfig;
61+
}

0 commit comments

Comments
 (0)