mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Update style guide for named exports
Add new 'named exports' only rule: https://github.com/elastic/kibana/issues/8641
This commit is contained in:
parent
3fe62de75f
commit
7ead88eb09
1 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue