|
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:
993 bytes
|
| Line | |
|---|
| 1 | # import/no-namespace
|
|---|
| 2 |
|
|---|
| 3 | 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|---|
| 4 |
|
|---|
| 5 | <!-- end auto-generated rule header -->
|
|---|
| 6 |
|
|---|
| 7 | Enforce a convention of not using namespace (a.k.a. "wildcard" `*`) imports.
|
|---|
| 8 |
|
|---|
| 9 | The rule is auto-fixable when the namespace object is only used for direct member access, e.g. `namespace.a`.
|
|---|
| 10 |
|
|---|
| 11 | ## Options
|
|---|
| 12 |
|
|---|
| 13 | This rule supports the following options:
|
|---|
| 14 |
|
|---|
| 15 | - `ignore`: array of glob strings for modules that should be ignored by the rule.
|
|---|
| 16 |
|
|---|
| 17 | ## Rule Details
|
|---|
| 18 |
|
|---|
| 19 | Valid:
|
|---|
| 20 |
|
|---|
| 21 | ```js
|
|---|
| 22 | import defaultExport from './foo'
|
|---|
| 23 | import { a, b } from './bar'
|
|---|
| 24 | import defaultExport, { a, b } from './foobar'
|
|---|
| 25 | ```
|
|---|
| 26 |
|
|---|
| 27 | ```js
|
|---|
| 28 | /* eslint import/no-namespace: ["error", {ignore: ['*.ext']}] */
|
|---|
| 29 | import * as bar from './ignored-module.ext';
|
|---|
| 30 | ```
|
|---|
| 31 |
|
|---|
| 32 | Invalid:
|
|---|
| 33 |
|
|---|
| 34 | ```js
|
|---|
| 35 | import * as foo from 'foo';
|
|---|
| 36 | ```
|
|---|
| 37 |
|
|---|
| 38 | ```js
|
|---|
| 39 | import defaultExport, * as foo from 'foo';
|
|---|
| 40 | ```
|
|---|
| 41 |
|
|---|
| 42 | ## When Not To Use It
|
|---|
| 43 |
|
|---|
| 44 | If you want to use namespaces, you don't want to use this rule.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.