webhook-action/node_modules/eslint-plugin-import/docs/rules/no-namespace.md

45 lines
993 B
Markdown
Raw Normal View History

# import/no-namespace
2024-03-28 02:25:32 +00:00
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
<!-- end auto-generated rule header -->
Enforce a convention of not using namespace (a.k.a. "wildcard" `*`) imports.
2024-03-28 02:25:32 +00:00
The rule is auto-fixable when the namespace object is only used for direct member access, e.g. `namespace.a`.
2024-03-28 02:25:32 +00:00
## Options
2022-11-10 10:43:16 +00:00
This rule supports the following options:
2024-03-28 02:25:32 +00:00
- `ignore`: array of glob strings for modules that should be ignored by the rule.
2022-11-10 10:43:16 +00:00
## Rule Details
Valid:
```js
import defaultExport from './foo'
import { a, b } from './bar'
import defaultExport, { a, b } from './foobar'
```
2022-11-10 10:43:16 +00:00
```js
/* eslint import/no-namespace: ["error", {ignore: ['*.ext']}] */
import * as bar from './ignored-module.ext';
```
Invalid:
```js
import * as foo from 'foo';
```
```js
import defaultExport, * as foo from 'foo';
```
## When Not To Use It
If you want to use namespaces, you don't want to use this rule.