Skip to content

Commit d68a067

Browse files
committed
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.
1 parent 5acae06 commit d68a067

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,18 @@ Other Style Guides
11531153
export { foo }
11541154
```
11551155
1156+
<a name="modules--prefer-default-export"></a>
1157+
- [10.6](#modules--prefer-default-export) In modules with a single export, prefer default export over named export.
1158+
eslint: [`import/prefer-default-export`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md)
1159+
1160+
```javascript
1161+
// bad
1162+
export function foo() {}
1163+
1164+
// good
1165+
export default function foo() {}
1166+
```
1167+
11561168
**[⬆ back to top](#table-of-contents)**
11571169
11581170
## Iterators and Generators

packages/eslint-config-airbnb-base/rules/es6.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ module.exports = {
203203
'newlines-between': 'never',
204204
}],
205205

206+
// Require modules with a single export to use a default export
207+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
208+
// TODO: enable
209+
'import/prefer-default-export': 0,
210+
206211
// Require a newline after the last import/require in a group
207212
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
208213
// TODO: enable

0 commit comments

Comments
 (0)