File tree 11 files changed +23
-28
lines changed
11 files changed +23
-28
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
3
- import Image from "./Image" ;
3
+ import { Image } from "./Image" ;
4
4
5
5
export interface ComponentProps {
6
6
className ?: string ;
7
7
children ?: React . ReactNode ;
8
8
}
9
9
10
- const Component : React . VoidFunctionComponent < ComponentProps > = ( props ) => {
10
+ export const Component : React . VoidFunctionComponent < ComponentProps > = (
11
+ props
12
+ ) => {
11
13
const { className, children } = props ;
12
14
13
15
return (
@@ -31,5 +33,3 @@ Component.defaultProps = {
31
33
className : undefined ,
32
34
children : null ,
33
35
} ;
34
-
35
- export default Component ;
Original file line number Diff line number Diff line change 2
2
import PropTypes from "prop-types" ;
3
3
import React from "react" ;
4
4
5
- const Image = ( { alt, ...rest } ) => < img alt = { alt } { ...rest } /> ;
5
+ export const Image = ( { alt, ...rest } ) => < img alt = { alt } { ...rest } /> ;
6
6
7
7
Image . propTypes = {
8
8
alt : PropTypes . string . isRequired ,
9
9
src : PropTypes . string . isRequired ,
10
10
} ;
11
-
12
- export default Image ;
Original file line number Diff line number Diff line change 1
- const a = ( b , c , d ) => {
1
+ export const a = ( b , c , d ) => {
2
2
return b * c - d ;
3
3
} ;
4
4
5
5
export function e ( ) {
6
6
return "f" ;
7
7
}
8
-
9
- export default a ;
Original file line number Diff line number Diff line change 1
- import a , { e } from "./a" ;
1
+ import { a , e } from "./a" ;
2
2
3
- export default function b ( ) {
3
+ export function b ( ) {
4
4
a ( 1 , 2 , 3 ) ;
5
5
6
6
e ( ) ;
Original file line number Diff line number Diff line change 1
- const a = ( b , c , d ) => {
1
+ export const a = ( b , c , d ) => {
2
2
return b * c - d ;
3
3
} ;
4
4
5
5
export function e ( ) {
6
6
return "f" ;
7
7
}
8
-
9
- export default a ;
Original file line number Diff line number Diff line change 1
- import a , { e } from "./a" ;
1
+ import { a , e } from "./a" ;
2
2
3
- export default function b ( ) {
3
+ export function b ( ) {
4
4
a ( 1 , 2 , 3 ) ;
5
5
6
6
e ( ) ;
Original file line number Diff line number Diff line change 2
2
import PropTypes from "prop-types" ;
3
3
import React from "react" ;
4
4
5
- const Component = ( props ) => {
5
+ export const Component = ( props ) => {
6
6
const { className, children } = props ;
7
7
8
8
return (
@@ -31,5 +31,3 @@ Component.propTypes = {
31
31
className : PropTypes . string ,
32
32
children : PropTypes . element ,
33
33
} ;
34
-
35
- export default Component ;
Original file line number Diff line number Diff line change 1
- const a = ( b : number , c : number , d : number ) => {
1
+ export const a = ( b : number , c : number , d : number ) => {
2
2
return b * c - d ;
3
3
} ;
4
4
5
5
export function e ( ) {
6
6
return "f" ;
7
7
}
8
-
9
- export default a ;
Original file line number Diff line number Diff line change 1
- import a , { e } from "./a" ;
1
+ import { a , e } from "./a" ;
2
2
3
- export default function b ( ) {
3
+ export function b ( ) {
4
4
a ( 1 , 2 , 3 ) ;
5
5
6
6
e ( ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export interface ComponentProps {
5
5
className ?: string ;
6
6
}
7
7
8
- const Component : React . FunctionComponent < ComponentProps > = ( props ) => {
8
+ export const Component : React . FunctionComponent < ComponentProps > = ( props ) => {
9
9
const { className, children } = props ;
10
10
11
11
return (
@@ -28,5 +28,3 @@ const Component: React.FunctionComponent<ComponentProps> = (props) => {
28
28
Component . defaultProps = {
29
29
className : undefined ,
30
30
} ;
31
-
32
- export default Component ;
Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ module.exports = {
17
17
"arrow-body-style" : "off" ,
18
18
"prefer-arrow-callback" : "off" ,
19
19
20
+ // Prefer named exports over default exports
21
+ // https://humanwhocodes.com/blog/2019/01/stop-using-default-exports-javascript-module/
22
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md
23
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
24
+ "import/prefer-default-export" : "off" ,
25
+ "import/no-default-export" : "error" ,
26
+
20
27
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
21
28
"import/extensions" : [
22
29
"error" ,
You can’t perform that action at this time.
0 commit comments