You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/rules/max-dependencies.md
+30-8
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,20 @@ This is a useful rule because a module with too many dependencies is a code smel
6
6
7
7
Importing multiple named exports from a single module will only count once (e.g. `import {x, y, z} from './foo'` will only count as a single dependency).
8
8
9
-
###Options
9
+
## Options
10
10
11
-
This rule takes the following option:
12
-
13
-
`max`: The maximum number of dependencies allowed. Anything over will trigger the rule. **Default is 10** if the rule is enabled and no `max` is specified.
14
-
15
-
You can set the option like this:
11
+
This rule has the following options, with these defaults:
16
12
17
13
```js
18
-
"import/max-dependencies": ["error", {"max":10}]
14
+
"import/max-dependencies": ["error", {
15
+
"max":10,
16
+
"ignoreTypeImports":false,
17
+
}]
19
18
```
20
19
20
+
### `max`
21
21
22
-
## Example
22
+
This option sets the maximum number of dependencies allowed. Anything over will trigger the rule. **Default is 10** if the rule is enabled and no `max` is specified.
Ignores `type` imports. Type imports are a feature released in TypeScript 3.8, you can [read more here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). Defaults to `false`.
45
+
46
+
Given `{"max": 2, "ignoreTypeImports": true}`:
47
+
48
+
### Fail
49
+
50
+
```ts
51
+
importafrom'./a';
52
+
importbfrom'./b';
53
+
importcfrom'./c';
54
+
```
55
+
56
+
### Pass
57
+
58
+
```ts
59
+
importafrom'./a';
60
+
importbfrom'./b';
61
+
importtypecfrom'./c'; // Doesn't count against max
62
+
```
63
+
42
64
## When Not To Use It
43
65
44
66
If you don't care how many dependencies a module has.
0 commit comments