Skip to content

Commit

Permalink
Clean up return statements (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Dec 28, 2021
1 parent 57428f9 commit 18f57f0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions index.js
Expand Up @@ -85,23 +85,26 @@ const handleError = (error, file, callback) => {

// eslint-disable-next-line arrow-body-style
const gulpSass = (options, sync) => {
// eslint-disable-next-line consistent-return
return transfob((file, encoding, callback) => {
if (file.isNull()) {
return callback(null, file);
callback(null, file);
return;
}

if (file.isStream()) {
return callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
return;
}

if (path.basename(file.path).startsWith('_')) {
return callback();
callback();
return;
}

if (!file.contents.length) {
file.path = replaceExtension(file.path, '.css');
return callback(null, file);
callback(null, file);
return;
}

const opts = clonedeep(options || {});
Expand Down Expand Up @@ -137,10 +140,10 @@ const gulpSass = (options, sync) => {
/**
* Async Sass render
*/
// eslint-disable-next-line consistent-return
gulpSass.compiler.render(opts, (error, obj) => {
if (error) {
return handleError(error, file, callback);
handleError(error, file, callback);
return;
}

filePush(file, obj, callback);
Expand All @@ -152,7 +155,7 @@ const gulpSass = (options, sync) => {
try {
filePush(file, gulpSass.compiler.renderSync(opts), callback);
} catch (error) {
return handleError(error, file, callback);
handleError(error, file, callback);
}
}
});
Expand Down

0 comments on commit 18f57f0

Please sign in to comment.