mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-26 01:16:56 +01:00
31 lines
418 B
Markdown
31 lines
418 B
Markdown
|
# Forbid a module from importing itself (`import/no-self-import`)
|
||
|
|
||
|
Forbid a module from importing itself. This can sometimes happen during refactoring.
|
||
|
|
||
|
## Rule Details
|
||
|
|
||
|
### Fail
|
||
|
|
||
|
```js
|
||
|
// foo.js
|
||
|
import foo from './foo';
|
||
|
|
||
|
const foo = require('./foo');
|
||
|
```
|
||
|
|
||
|
```js
|
||
|
// index.js
|
||
|
import index from '.';
|
||
|
|
||
|
const index = require('.');
|
||
|
```
|
||
|
|
||
|
### Pass
|
||
|
|
||
|
```js
|
||
|
// foo.js
|
||
|
import bar from './bar';
|
||
|
|
||
|
const bar = require('./bar');
|
||
|
```
|