Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
giodamelio committed Jan 23, 2017
1 parent 5948d35 commit 75d468c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
* Forbid `require()` calls with expressions ([`no-dynamic-require`])
* Prevent importing the submodules of other modules ([`no-internal-modules`])
* Forbid Webpack loader syntax in imports ([`no-webpack-loader-syntax`])
* Forbid a module from importing itself ([`no-self-import`])

[`no-unresolved`]: ./docs/rules/no-unresolved.md
[`named`]: ./docs/rules/named.md
Expand All @@ -33,6 +34,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
[`no-dynamic-require`]: ./docs/rules/no-dynamic-require.md
[`no-internal-modules`]: ./docs/rules/no-internal-modules.md
[`no-webpack-loader-syntax`]: ./docs/rules/no-webpack-loader-syntax.md
[`no-self-import`]: ./docs/rules/no-self-import.md

**Helpful warnings:**

Expand Down
30 changes: 30 additions & 0 deletions docs/rules/no-self-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Forbid a module from importing itself

Forbid a module from importing iteself. 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 = reqire('./bar');
```
4 changes: 2 additions & 2 deletions src/rules/no-self-import.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @fileOverview Forbids a file from importing itself
* @fileOverview Forbids a module from importing itself
* @author Gio d'Amelio
*/

Expand All @@ -26,7 +26,7 @@ function isImportingSelf(context, node, requireName) {
module.exports = {
meta: {
doc: {
description: 'Forbid a file from importing itself',
description: 'Forbid a module from importing itself',
recommended: true,
},
schema: [],
Expand Down

0 comments on commit 75d468c

Please sign in to comment.