@@ -12,8 +12,8 @@ const path = require('path')
12
12
* disable useTypescriptIncrementalApi of react-scripts ForkTsCheckerWebpackPlugin
13
13
* Fix Hanging at 'Files successfully emitted, waiting for typecheck results...' when yarn start on the first time
14
14
*/
15
- const removeOriginalForkTsCheckerWebpackPlugin = config => {
16
- config . plugins = config . plugins . filter ( plugin => {
15
+ const removeOriginalForkTsCheckerWebpackPlugin = ( config ) => {
16
+ config . plugins = config . plugins . filter ( ( plugin ) => {
17
17
return plugin . constructor . name !== 'ForkTsCheckerWebpackPlugin'
18
18
} )
19
19
@@ -49,7 +49,7 @@ const patchForkTsCheckerWebpackPlugin = (config, env) => {
49
49
/**
50
50
* Add linaria loader after babel loader
51
51
*/
52
- const transformLoader = loader => {
52
+ const transformLoader = ( loader ) => {
53
53
const options = loader . options || { }
54
54
const presets = options . presets || [ ]
55
55
options . presets = presets
@@ -76,23 +76,23 @@ const transformLoader = loader => {
76
76
}
77
77
}
78
78
79
- const updateJestSetupTestFiles = config => {
79
+ const updateJestSetupTestFiles = ( config ) => {
80
80
const setupTestFile = path . resolve ( __dirname , './src/setup-tests.js' )
81
81
config . setupFiles . push ( setupTestFile )
82
82
return config
83
83
}
84
84
85
- const addLinariaLoader = config => {
85
+ const addLinariaLoader = ( config ) => {
86
86
/**
87
87
* cra scripts rules atm (version 3)
88
88
* https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.js
89
89
*/
90
- const ruleWithOneOf = config . module . rules . find ( rule => rule . oneOf )
90
+ const ruleWithOneOf = config . module . rules . find ( ( rule ) => rule . oneOf )
91
91
if ( ruleWithOneOf === null ) {
92
92
throw Error ( 'Cant find webpack rule with oneOf' )
93
93
}
94
94
95
- let subRuleWithTsxIndex = ruleWithOneOf . oneOf . findIndex ( rule => rule . test . toString ( ) . includes ( 'tsx' ) )
95
+ let subRuleWithTsxIndex = ruleWithOneOf . oneOf . findIndex ( ( rule ) => rule . test . toString ( ) . includes ( 'tsx' ) )
96
96
if ( subRuleWithTsxIndex === - 1 ) {
97
97
throw Error ( 'Cant find rule match ts/tsx' )
98
98
}
@@ -105,13 +105,13 @@ const addLinariaLoader = config => {
105
105
// react-rewired configuration https://github.com/timarney/react-app-rewired
106
106
module . exports = {
107
107
// The Webpack config to use when compiling your react app for development or production.
108
- webpack : function ( config , env ) {
108
+ webpack : function ( config , env ) {
109
109
return {
110
110
...override ( addBabelPreset ( 'linaria/babel' ) , addLinariaLoader , removeOriginalForkTsCheckerWebpackPlugin ) ( config ) ,
111
111
...patchForkTsCheckerWebpackPlugin ( config , env ) ,
112
112
}
113
113
} ,
114
- jest : function ( config ) {
114
+ jest : function ( config ) {
115
115
return updateJestSetupTestFiles ( config )
116
116
} ,
117
117
}
0 commit comments