From d68a067f2b244cf9f8fd90afd7029305b0c1b856 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Thu, 12 May 2016 12:01:15 -0700 Subject: [PATCH] Prepare to enable import/prefer-default-export This was recently added to eslint-plugin-export. It enforces that modules that only have a single export use a default export instead of a named export. Since this is a breaking change and we want to cluster breaking changes, I marked it as 0 for now with a TODO to enable when that time comes. --- README.md | 12 ++++++++++++ packages/eslint-config-airbnb-base/rules/es6.js | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index a5481c75..a75a104e 100644 --- a/README.md +++ b/README.md @@ -1153,6 +1153,18 @@ Other Style Guides export { foo } ``` + + - [10.6](#modules--prefer-default-export) In modules with a single export, prefer default export over named export. + eslint: [`import/prefer-default-export`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md) + + ```javascript + // bad + export function foo() {} + + // good + export default function 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 ab54858c..b264580f 100644 --- a/packages/eslint-config-airbnb-base/rules/es6.js +++ b/packages/eslint-config-airbnb-base/rules/es6.js @@ -203,6 +203,11 @@ module.exports = { 'newlines-between': 'never', }], + // Require modules with a single export to use a default export + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md + // TODO: enable + 'import/prefer-default-export': 0, + // Require a newline after the last import/require in a group // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md // TODO: enable