[eslint config] [base] [breaking] enable import/no-mutable-exports

This commit is contained in:
Jordan Harband
2016-05-06 17:44:59 -07:00
parent 36e088759f
commit 92a3d5570b
2 changed files with 16 additions and 2 deletions

View File

@@ -1138,6 +1138,21 @@ Other Style Guides
} from 'foo';
```
<a name="modules--no-mutable-exports"></a>
- [10.5](#modules--no-mutable-exports) Do not export mutable bindings.
eslint: [`import/no-mutable-exports`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md)
> Why? Mutation should be avoided in general, but in particular when exporting mutable bindings. While this technique may be needed for some special cases, in general, only constant references should be exported.
```javascript
// bad
let foo = 3;
export { foo }
// good
const foo = 3;
export { foo }
```
**[⬆ back to top](#table-of-contents)**
## Iterators and Generators

View File

@@ -162,8 +162,7 @@ module.exports = {
'import/newline-after-import': 0,
// Forbid mutable exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
// TODO: enable
'import/no-mutable-exports': 0,
'import/no-mutable-exports': 2,
},
'settings': {
'import/resolver': {