diff --git a/.eslintrc b/.eslintrc index e8e6a94745..e24907b321 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,7 +10,8 @@ "linebreak-style": 0, "max-len": [2, 160], "no-console": 0, - "no-underscore-dangle": 0 + "no-underscore-dangle": 0, + "no-throw-literal": 0 }, "parser": "babel-eslint" } diff --git a/src/api/install.js b/src/api/install.js index a8caced0ce..3e2a6d77f1 100644 --- a/src/api/install.js +++ b/src/api/install.js @@ -48,7 +48,6 @@ export default async (providedOptions = {}) => { await asyncOra('Searching for Application', async (searchSpinner) => { if (!repo || repo.indexOf('/') === -1) { - // eslint-disable-next-line no-throw-literal throw 'Invalid repository name, must be in the format owner/name'; } @@ -61,7 +60,6 @@ export default async (providedOptions = {}) => { } if (!releases || releases.message === 'Not Found' || !Array.isArray(releases)) { - // eslint-disable-next-line no-throw-literal throw `Failed to find releases for repository "${repo}". Please check the name and try again.`; } @@ -80,7 +78,6 @@ export default async (providedOptions = {}) => { const assets = latestRelease.assets; if (!assets || !Array.isArray(assets)) { - // eslint-disable-next-line no-throw-literal throw 'Could not find any assets for the latest release'; } @@ -99,7 +96,6 @@ export default async (providedOptions = {}) => { }); if (possibleAssets.length === 0) { - // eslint-disable-next-line no-throw-literal throw `Failed to find any installable assets for target platform: ${`${process.platform}`.cyan}`; } }); @@ -124,7 +120,6 @@ export default async (providedOptions = {}) => { targetAsset = possibleAssets.find(asset => asset.id === assetID); } else { - // eslint-disable-next-line no-throw-literal throw 'expected a chooseAsset function to be provided but it was not'; } } diff --git a/src/api/lint.js b/src/api/lint.js index dd3357e811..83be0a16fe 100644 --- a/src/api/lint.js +++ b/src/api/lint.js @@ -36,7 +36,6 @@ export default async (providedOptions = {}) => { await asyncOra('Linting Application', async (lintSpinner) => { dir = await resolveDir(dir); if (!dir) { - // eslint-disable-next-line no-throw-literal throw 'Failed to locate lintable Electron application'; } diff --git a/src/api/make.js b/src/api/make.js index 2af12c9126..e3a3f5c104 100644 --- a/src/api/make.js +++ b/src/api/make.js @@ -42,7 +42,6 @@ export default async (providedOptions = {}) => { await asyncOra('Resolving Forge Config', async () => { dir = await resolveDir(dir); if (!dir) { - // eslint-disable-next-line no-throw-literal throw 'Failed to locate makeable Electron application'; } @@ -111,14 +110,12 @@ export default async (providedOptions = {}) => { `electron-forge-maker-${target}`, ]); if (!maker) { - // eslint-disable-next-line no-throw-literal throw `Could not find a build target with the name: ${target} for the platform: ${declaredPlatform}`; } try { outputs.push(await (maker.default || maker)(packageDir, appName, targetArch, forgeConfig, packageJSON)); } catch (err) { if (err) { - // eslint-disable-next-line no-throw-literal throw { message: `An error occured while making for target: ${target}`, stack: `${err.message}\n${err.stack}`, diff --git a/src/api/package.js b/src/api/package.js index 66a0398ab5..493f9b89f0 100644 --- a/src/api/package.js +++ b/src/api/package.js @@ -44,7 +44,6 @@ export default async (providedOptions = {}) => { dir = await resolveDir(dir); if (!dir) { - // eslint-disable-next-line no-throw-literal throw 'Failed to locate compilable Electron application'; } @@ -52,7 +51,6 @@ export default async (providedOptions = {}) => { if (path.dirname(require.resolve(path.resolve(dir, packageJSON.main))) === dir) { console.error(`Entry point: ${packageJSON.main}`.red); - // eslint-disable-next-line no-throw-literal throw 'The entry point to your application ("packageJSON.name") must be in a subfolder not in the top level directory'; } diff --git a/src/api/publish.js b/src/api/publish.js index bbb2daf699..b0e5ec3519 100644 --- a/src/api/publish.js +++ b/src/api/publish.js @@ -41,7 +41,6 @@ export default async (providedOptions = {}) => { dir = await resolveDir(dir); if (!dir) { - // eslint-disable-next-line no-throw-literal throw 'Failed to locate publishable Electron application'; } diff --git a/src/api/start.js b/src/api/start.js index 9dbc5033c8..e95e981d84 100644 --- a/src/api/start.js +++ b/src/api/start.js @@ -33,7 +33,6 @@ export default async (providedOptions = {}) => { await asyncOra('Locating Application', async () => { dir = await resolveDir(dir); if (!dir) { - // eslint-disable-next-line no-throw-literal throw 'Failed to locate startable Electron application'; } }); diff --git a/src/init/init-custom.js b/src/init/init-custom.js index a10c460992..3c52aab906 100644 --- a/src/init/init-custom.js +++ b/src/init/init-custom.js @@ -22,7 +22,6 @@ export default async (dir, template, lintStyle) => { templateModulePath = require(`electron-forge-template-${template}`); d('using local template'); } catch (err2) { - // eslint-disable-next-line no-throw-literal throw `Failed to locate custom template: "${template}"\n\nTry \`npm install -g electron-forge-template-${template}\``; } } @@ -44,7 +43,6 @@ export default async (dir, template, lintStyle) => { if (templateDirectory) { const tmplPath = templateDirectory; if (!path.isAbsolute(templateDirectory)) { - // eslint-disable-next-line no-throw-literal throw `Custom template path needs to be absolute, this is an issue with "electron-forge-template-${template}"`; } diff --git a/src/installers/darwin/zip.js b/src/installers/darwin/zip.js index ef717baf03..e996f069a1 100644 --- a/src/installers/darwin/zip.js +++ b/src/installers/darwin/zip.js @@ -33,7 +33,6 @@ export default async (filePath, installSpinner) => { message: `The application "${path.basename(targetApplicationPath)}" appears to already exist in /Applications. Do you want to replace it?`, }); if (!confirm) { - // eslint-disable-next-line no-throw-literal throw 'Installation stopped by user'; } else { installSpinner.start(); diff --git a/src/util/resolve-dir.js b/src/util/resolve-dir.js index 3f1998b151..d89bb377a1 100644 --- a/src/util/resolve-dir.js +++ b/src/util/resolve-dir.js @@ -17,11 +17,9 @@ export default async (dir) => { if (packageJSON.devDependencies && packageJSON.devDependencies['electron-prebuilt-compile']) { if (!/[0-9]/.test(packageJSON.devDependencies['electron-prebuilt-compile'][0])) { - // eslint-disable-next-line no-throw-literal throw 'You must depend on an EXACT version of "electron-prebuilt-compile" not a range'; } } else { - // eslint-disable-next-line no-throw-literal throw 'You must depend on "electron-prebuilt-compile" in your devDependencies'; }