|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
705 bytes
|
| Line | |
|---|
| 1 | # import/no-named-default
|
|---|
| 2 |
|
|---|
| 3 | <!-- end auto-generated rule header -->
|
|---|
| 4 |
|
|---|
| 5 | Reports use of a default export as a locally named import.
|
|---|
| 6 |
|
|---|
| 7 | Rationale: the syntax exists to import default exports expressively, let's use it.
|
|---|
| 8 |
|
|---|
| 9 | Note that type imports, as used by [Flow], are always ignored.
|
|---|
| 10 |
|
|---|
| 11 | [Flow]: https://flow.org/
|
|---|
| 12 |
|
|---|
| 13 | ## Rule Details
|
|---|
| 14 |
|
|---|
| 15 | Given:
|
|---|
| 16 |
|
|---|
| 17 | ```js
|
|---|
| 18 | // foo.js
|
|---|
| 19 | export default 'foo';
|
|---|
| 20 | export const bar = 'baz';
|
|---|
| 21 | ```
|
|---|
| 22 |
|
|---|
| 23 | ...these would be valid:
|
|---|
| 24 |
|
|---|
| 25 | ```js
|
|---|
| 26 | import foo from './foo.js';
|
|---|
| 27 | import foo, { bar } from './foo.js';
|
|---|
| 28 | ```
|
|---|
| 29 |
|
|---|
| 30 | ...and these would be reported:
|
|---|
| 31 |
|
|---|
| 32 | ```js
|
|---|
| 33 | // message: Using exported name 'bar' as identifier for default export.
|
|---|
| 34 | import { default as foo } from './foo.js';
|
|---|
| 35 | import { default as foo, bar } from './foo.js';
|
|---|
| 36 | ```
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.