From 92a3d5570b30a237307548023fd78bdf0f96d48a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 6 May 2016 17:44:59 -0700 Subject: [PATCH] [eslint config] [base] [breaking] enable `import/no-mutable-exports` --- README.md | 15 +++++++++++++++ packages/eslint-config-airbnb-base/rules/es6.js | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) 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': {