Skip to content

Commit 297d937

Browse files
johndeveduJohn Lee
authored and
John Lee
committed
Indicates usage, plugin defaults to no-op, and add description to main README.md
#1351
1 parent f63dd26 commit 297d937

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
5151
* Report imported names marked with `@deprecated` documentation tag ([`no-deprecated`])
5252
* Forbid the use of extraneous packages ([`no-extraneous-dependencies`])
5353
* Forbid the use of mutable exports with `var` or `let`. ([`no-mutable-exports`])
54+
* Report modules without exports, or exports without matching import in another module ([`no-unused-modules`])
5455

5556
[`export`]: ./docs/rules/export.md
5657
[`no-named-as-default`]: ./docs/rules/no-named-as-default.md
5758
[`no-named-as-default-member`]: ./docs/rules/no-named-as-default-member.md
5859
[`no-deprecated`]: ./docs/rules/no-deprecated.md
5960
[`no-extraneous-dependencies`]: ./docs/rules/no-extraneous-dependencies.md
6061
[`no-mutable-exports`]: ./docs/rules/no-mutable-exports.md
62+
[`no-unused-modules`]: ./docs/rules/no-unused-modules.md
6163

6264
### Module systems
6365

docs/rules/no-unused-modules.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,26 @@ Note: dynamic imports are currently not supported.
88

99
## Rule Details
1010

11+
### Usage
12+
13+
In order for this plugin to work, one of the options `missingExports` or `unusedExports` must be enabled (see "Options" section below). In the future, these options will be enabled by default (see https://github.com/benmosher/eslint-plugin-import/issues/1324)
14+
15+
Example:
16+
```
17+
"rules: {
18+
...otherRules,
19+
"import/no-unused-modules": [1, {"unusedExports": true}]
20+
}
21+
```
1122

1223
### Options
1324

1425
This rule takes the following option:
1526

27+
- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
28+
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
1629
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
1730
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
18-
- `missingExports`: if `true`, files without any exports are reported
19-
- `unusedExports`: if `true`, exports without any static usage within other modules are reported.
2031

2132

2233
### Example for missing exports

0 commit comments

Comments
 (0)