Skip to content

Commit 1353fcb

Browse files
committed
Removing unnecessary enabled options
1 parent 5d54143 commit 1353fcb

File tree

3 files changed

+25
-29
lines changed

3 files changed

+25
-29
lines changed

index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,35 +221,32 @@ module.exports = {
221221
*
222222
* https://github.com/postcss/postcss-loader
223223
*
224-
* @param {boolean} enabled
225224
* @return {exports}
226225
*/
227-
enablePostCssLoader(enabled = true) {
228-
webpackConfig.enablePostCssLoader(enabled);
226+
enablePostCssLoader() {
227+
webpackConfig.enablePostCssLoader();
229228

230229
return this;
231230
},
232231

233232
/**
234233
* Call this if you plan on loading SASS files.
235234
*
236-
* @param {boolean} enabled
237235
* @return {exports}
238236
*/
239-
enableSassLoader(enabled = true) {
240-
webpackConfig.enableSassLoader(enabled);
237+
enableSassLoader() {
238+
webpackConfig.enableSassLoader();
241239

242240
return this;
243241
},
244242

245243
/**
246244
* Call this if you plan on loading less files.
247245
*
248-
* @param {boolean} enabled
249246
* @return {exports}
250247
*/
251-
enableLessLoader(enabled = true) {
252-
webpackConfig.enableLessLoader(enabled);
248+
enableLessLoader() {
249+
webpackConfig.enableLessLoader();
253250

254251
return this;
255252
},
@@ -276,11 +273,10 @@ module.exports = {
276273
* If enabled, the react preset is added to Babel:
277274
* https://babeljs.io/docs/plugins/preset-react/
278275
*
279-
* @param {boolean} enabled
280276
* @returns {exports}
281277
*/
282-
enableReactPreset(enabled = true) {
283-
webpackConfig.enableReactPreset(enabled);
278+
enableReactPreset() {
279+
webpackConfig.enableReactPreset();
284280

285281
return this;
286282
},

lib/WebpackConfig.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,20 @@ class WebpackConfig {
185185
this.addEntry(name, files);
186186
}
187187

188-
enablePostCssLoader(enabled = true) {
189-
this.usePostCssLoader = enabled;
188+
enablePostCssLoader() {
189+
this.usePostCssLoader = true;
190190
}
191191

192-
enableSassLoader(enabled = true) {
193-
this.useSassLoader = enabled;
192+
enableSassLoader() {
193+
this.useSassLoader = true;
194194
}
195195

196-
enableLessLoader(enabled = true) {
197-
this.useLessLoader = enabled;
196+
enableLessLoader() {
197+
this.useLessLoader = true;
198198
}
199199

200-
enableReactPreset(enabled = true) {
201-
this.useReact = enabled;
200+
enableReactPreset() {
201+
this.useReact = true;
202202
}
203203

204204
cleanupOutputBeforeBuild() {

test/config-generator.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,19 @@ describe('The config-generator function', () => {
257257
});
258258

259259
describe('enablePostCssLoader() adds the postcss-loader', () => {
260-
it('enablePostCssLoader(false)', () => {
260+
it('without enablePostCssLoader()', () => {
261261
const config = createConfig();
262262
config.outputPath = '/tmp/output/public-path';
263263
config.publicPath = '/public-path';
264264
config.addEntry('main', './main');
265-
config.enablePostCssLoader(false);
265+
//config.enablePostCssLoader();
266266

267267
const actualConfig = configGenerator(config);
268268

269269
expect(JSON.stringify(actualConfig.module.rules)).to.not.contain('postcss-loader');
270270
});
271271

272-
it('enablePostCssLoader(true)', () => {
272+
it('enablePostCssLoader()', () => {
273273
const config = createConfig();
274274
config.outputPath = '/tmp/output/public-path';
275275
config.publicPath = '/public-path';
@@ -283,19 +283,19 @@ describe('The config-generator function', () => {
283283
});
284284

285285
describe('enableSassLoader() adds the sass-loader', () => {
286-
it('enableSassLoader(false)', () => {
286+
it('without enableSassLoader()', () => {
287287
const config = createConfig();
288288
config.outputPath = '/tmp/output/public-path';
289289
config.publicPath = '/public-path';
290290
config.addEntry('main', './main');
291-
config.enableSassLoader(false);
291+
// config.enableSassLoader();
292292

293293
const actualConfig = configGenerator(config);
294294

295295
expect(JSON.stringify(actualConfig.module.rules)).to.not.contain('sass-loader');
296296
});
297297

298-
it('enableSassLoader(true)', () => {
298+
it('enableSassLoader()', () => {
299299
const config = createConfig();
300300
config.outputPath = '/tmp/output/public-path';
301301
config.publicPath = '/public-path';
@@ -309,19 +309,19 @@ describe('The config-generator function', () => {
309309
});
310310

311311
describe('enableLessLoader() adds the less-loader', () => {
312-
it('enableLessLoader(false)', () => {
312+
it('without enableLessLoader()', () => {
313313
const config = createConfig();
314314
config.outputPath = '/tmp/output/public-path';
315315
config.publicPath = '/public-path';
316316
config.addEntry('main', './main');
317-
config.enableLessLoader(false);
317+
// do not enable the less loader
318318

319319
const actualConfig = configGenerator(config);
320320

321321
expect(JSON.stringify(actualConfig.module.rules)).to.not.contain('less-loader');
322322
});
323323

324-
it('enableLessLoader(true)', () => {
324+
it('enableLessLoader()', () => {
325325
const config = createConfig();
326326
config.outputPath = '/tmp/output/public-path';
327327
config.publicPath = '/public-path';

0 commit comments

Comments
 (0)