Update style guide for named exports

Add new 'named exports' only rule: https://github.com/elastic/kibana/issues/8641
This commit is contained in:
Stacey Gammon 2017-01-12 13:29:04 -05:00 committed by GitHub
parent 3fe62de75f
commit 7ead88eb09

View file

@ -277,7 +277,7 @@ possible (which is almost everywhere):
```js
// good
import { mapValues } from 'lodash';
export default mapValues;
export mapValues;
// bad
const _ = require('lodash');
@ -321,6 +321,20 @@ import inFoo from 'foo/child';
import inSibling from '../foo/child';
```
## Use named exports only
Favor named exports over default exports. See (#8641)[https://github.com/elastic/kibana/issues/8641] for more background on this decision.
```js
// good
import { foo } from 'foo';
export foo;
// bad
import myDefaultModule from 'foo/child';
export default myDefaultModule;
```
## Global definitions
Don't do this. Everything should be wrapped in a module that can be depended on