Skip to content

Commit

Permalink
guide: import/extensions rule documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cain authored and ljharb committed Mar 2, 2020
1 parent 3493b06 commit 9890b40
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,23 @@ Other Style Guides
import barCss from 'bar.css';
```

<a name="modules--import-extensions"></a>
- [10.10](#modules--import-extensions) Do not include JavaScript filename extensions
eslint: [`import/extensions`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md)
> Why? Including extensions inhibits refactoring, and inappropriately hardcodes implementation details of the module you're importing in every consumer.

```javascript
// bad
import foo from './foo.js';
import bar from './bar.jsx';
import baz from './baz/index.jsx';

// good
import foo from './foo';
import bar from './bar';
import baz from './baz';
```

**[⬆ back to top](#table-of-contents)**

## Iterators and Generators
Expand Down

0 comments on commit 9890b40

Please sign in to comment.