diff --git a/README.md b/README.md index 9dbc425d..7bae5dda 100644 --- a/README.md +++ b/README.md @@ -1138,6 +1138,21 @@ Other Style Guides } from 'foo'; ``` + + - [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 diff --git a/packages/eslint-config-airbnb-base/rules/es6.js b/packages/eslint-config-airbnb-base/rules/es6.js index 789a925e..bc439134 100644 --- a/packages/eslint-config-airbnb-base/rules/es6.js +++ b/packages/eslint-config-airbnb-base/rules/es6.js @@ -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': {