Skip to content

Commit 2a14b3a

Browse files
authored
Merge pull request #21 from briisk/export-default
dont prefer export deafult
2 parents f570e51 + 4bcefe3 commit 2a14b3a

File tree

1 file changed

+7
-67
lines changed

1 file changed

+7
-67
lines changed

README.md

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,15 +1259,14 @@
12591259
```
12601260
12611261
<a name="modules--prefer-default-export"></a>
1262-
- [10.6](#modules--prefer-default-export) In modules with a single export, prefer default export over named export.
1263-
eslint: [`import/prefer-default-export`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md)
1262+
- [10.6](#modules--prefer-default-export) In modules with a single export, don't prefer default export over named export.
12641263

12651264
```javascript
12661265
// bad
1267-
export function foo() {}
1266+
export default function foo() {}
12681267
12691268
// good
1270-
export default function foo() {}
1269+
export function foo() {}
12711270
```
12721271

12731272
<a name="modules--imports-first"></a>
@@ -2769,89 +2768,30 @@
27692768
}
27702769
```
27712770
2772-
<a name="naming--filename-matches-export"></a><a name="22.6"></a>
2773-
- [22.6](#naming--filename-matches-export) A base filename should exactly match the name of its default export.
2774-
2775-
```javascript
2776-
// file 1 contents
2777-
class CheckBox {
2778-
// ...
2779-
}
2780-
export default CheckBox;
2781-
2782-
// file 2 contents
2783-
export default function fortyTwo() { return 42; }
2784-
2785-
// file 3 contents
2786-
export default function insideDirectory() {}
2787-
2788-
// in some other file
2789-
// bad
2790-
import CheckBox from './checkBox'; // PascalCase import/export, camelCase filename
2791-
import FortyTwo from './FortyTwo'; // PascalCase import/filename, camelCase export
2792-
import InsideDirectory from './InsideDirectory'; // PascalCase import/filename, camelCase export
2793-
2794-
// bad
2795-
import CheckBox from './check_box'; // PascalCase import/export, snake_case filename
2796-
import forty_two from './forty_two'; // snake_case import/filename, camelCase export
2797-
import inside_directory from './inside_directory'; // snake_case import, camelCase export
2798-
import index from './inside_directory/index'; // requiring the index file explicitly
2799-
import insideDirectory from './insideDirectory/index'; // requiring the index file explicitly
2800-
2801-
// good
2802-
import CheckBox from './CheckBox'; // PascalCase export/import/filename
2803-
import fortyTwo from './fortyTwo'; // camelCase export/import/filename
2804-
import insideDirectory from './insideDirectory'; // camelCase export/import/directory name/implicit "index"
2805-
// ^ supports both insideDirectory.js and insideDirectory/index.js
2806-
```
2807-
2808-
<a name="naming--camelCase-default-export"></a><a name="22.7"></a>
2809-
- [22.7](#naming--camelCase-default-export) Use camelCase when you export-default a function. Your filename should be identical to your function's name.
2810-
2811-
```javascript
2812-
function makeStyleGuide() {
2813-
// ...
2814-
}
2815-
2816-
export default makeStyleGuide;
2817-
```
2818-
2819-
<a name="naming--PascalCase-singleton"></a><a name="22.8"></a>
2820-
- [22.8](#naming--PascalCase-singleton) Use PascalCase when you export a constructor / class / singleton / function library / bare object.
2821-
2822-
```javascript
2823-
const AirbnbStyleGuide = {
2824-
es6: {
2825-
},
2826-
};
2827-
2828-
export default AirbnbStyleGuide;
2829-
```
2830-
28312771
<a name="naming--Acronyms-and-Initialisms"></a>
2832-
- [22.9](#naming--Acronyms-and-Initialisms) Acronyms and initialisms should always be all capitalized, or all lowercased.
2772+
- [22.6](#naming--Acronyms-and-Initialisms) Acronyms and initialisms should always be all capitalized, or all lowercased.
28332773
28342774
> Why? Names are for readability, not to appease a computer algorithm.
28352775
28362776
```javascript
28372777
// bad
2838-
import SmsContainer from './containers/SmsContainer';
2778+
import { SmsContainer } from './containers/SmsContainer';
28392779

28402780
// bad
28412781
const HttpRequests = [
28422782
// ...
28432783
];
28442784

28452785
// good
2846-
import SMSContainer from './containers/SMSContainer';
2786+
import { SMSContainer } from './containers/SMSContainer';
28472787

28482788
// good
28492789
const HTTPRequests = [
28502790
// ...
28512791
];
28522792

28532793
// best
2854-
import TextMessageContainer from './containers/TextMessageContainer';
2794+
import { TextMessageContainer } from './containers/TextMessageContainer';
28552795

28562796
// best
28572797
const Requests = [

0 commit comments

Comments
 (0)