Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 27, 2024
1 parent bfc95f8 commit c9a186f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/error.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import PluginError from 'plugin-error'

export const throwError = (error, opts) => {
throw createError(error, opts)
}

// Build a Gulp error, so it prints better.
// Throw a Gulp error, so it prints better.
// By passing `error`, we make sure `error` properties (e.g. from `execa`)
// are kept. They are not printed though, as error message should be enough.
export const createError = (error, opts) => {
export const throwError = (error, opts) => {
const errorA = error instanceof Error ? error : new Error(error)

if (errorA.shortMessage !== undefined) {
Expand All @@ -17,7 +13,7 @@ export const createError = (error, opts) => {
delete errorA.shortMessage
}

return new PluginError({ ...PLUGIN_ERROR_OPTS, ...opts, error: errorA })
throw new PluginError({ ...PLUGIN_ERROR_OPTS, ...opts, error: errorA })
}

const PLUGIN_ERROR_OPTS = {
Expand Down
3 changes: 1 addition & 2 deletions src/stream/result.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Buffer } from 'node:buffer'

import { createError } from '../error.js'
import { execCommand, streamCommand } from '../exec.js'
import { isValidInput } from '../input.js'

Expand Down Expand Up @@ -46,7 +45,7 @@ const saveResult = async ({ file, file: { execa }, input, opts }) => {
file.execa = [...execa, execaResult]
}

const streamResult = ({ file, input, opts, opts: { from } }) => {
const streamResult = ({ file, input, opts }) => {
// eslint-disable-next-line no-param-reassign, fp/no-mutation
file.contents = streamCommand(input, opts)
}
Expand Down

0 comments on commit c9a186f

Please sign in to comment.