2 title: no-duplicate-imports
8 Using a single `import` statement per module will make the code clearer because you can see everything being imported from that module on one line.
10 In the following example the `module` import on line 1 is repeated on line 3. These can be combined to make the list of imports more succinct.
13 import { merge } from 'module';
14 import something from 'another-module';
15 import { find } from 'module';
20 This rule requires that all imports from a single module that can be merged exist in a single `import` statement.
22 Example of **incorrect** code for this rule:
27 /*eslint no-duplicate-imports: "error"*/
29 import { merge } from 'module';
30 import something from 'another-module';
31 import { find } from 'module';
36 Example of **correct** code for this rule:
41 /*eslint no-duplicate-imports: "error"*/
43 import { merge, find } from 'module';
44 import something from 'another-module';
49 Example of **correct** code for this rule:
54 /*eslint no-duplicate-imports: "error"*/
57 import { merge } from 'module';
58 import * as something from 'module';
65 This rule takes one optional argument, an object with a single key, `includeExports` which is a `boolean`. It defaults to `false`.
67 If re-exporting from an imported module, you should add the imports to the `import`-statement, and export that directly, not use `export ... from`.
69 Example of **incorrect** code for this rule with the `{ "includeExports": true }` option:
74 /*eslint no-duplicate-imports: ["error", { "includeExports": true }]*/
76 import { merge } from 'module';
78 export { find } from 'module';
83 Example of **correct** code for this rule with the `{ "includeExports": true }` option:
88 /*eslint no-duplicate-imports: ["error", { "includeExports": true }]*/
90 import { merge, find } from 'module';
97 Example of **correct** code for this rule with the `{ "includeExports": true }` option:
102 /*eslint no-duplicate-imports: ["error", { "includeExports": true }]*/
104 import { merge, find } from 'module';
106 // cannot be merged with the above import
107 export * as something from 'module';
109 // cannot be written differently
110 export * from 'module';