|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
998 bytes
|
| Line | |
|---|
| 1 | # import/export
|
|---|
| 2 |
|
|---|
| 3 | 💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`.
|
|---|
| 4 |
|
|---|
| 5 | <!-- end auto-generated rule header -->
|
|---|
| 6 |
|
|---|
| 7 | Reports funny business with exports, like repeated exports of names or defaults.
|
|---|
| 8 |
|
|---|
| 9 | ## Rule Details
|
|---|
| 10 |
|
|---|
| 11 | ```js
|
|---|
| 12 | export default class MyClass { /*...*/ } // Multiple default exports.
|
|---|
| 13 |
|
|---|
| 14 | function makeClass() { return new MyClass(...arguments) }
|
|---|
| 15 |
|
|---|
| 16 | export default makeClass // Multiple default exports.
|
|---|
| 17 | ```
|
|---|
| 18 |
|
|---|
| 19 | or
|
|---|
| 20 |
|
|---|
| 21 | ```js
|
|---|
| 22 | export const foo = function () { /*...*/ } // Multiple exports of name 'foo'.
|
|---|
| 23 |
|
|---|
| 24 | function bar() { /*...*/ }
|
|---|
| 25 | export { bar as foo } // Multiple exports of name 'foo'.
|
|---|
| 26 | ```
|
|---|
| 27 |
|
|---|
| 28 | In the case of named/default re-export, all `n` re-exports will be reported,
|
|---|
| 29 | as at least `n-1` of them are clearly mistakes, but it is not clear which one
|
|---|
| 30 | (if any) is intended. Could be the result of copy/paste, code duplication with
|
|---|
| 31 | intent to rename, etc.
|
|---|
| 32 |
|
|---|
| 33 | ## Further Reading
|
|---|
| 34 |
|
|---|
| 35 | - Lee Byron's [ES7] export proposal
|
|---|
| 36 |
|
|---|
| 37 | [ES7]: https://github.com/leebyron/ecmascript-more-export-from
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.