Skip to content
Permalink
Browse files

chore(generic): disable the no-throw-literal eslint rule

ISSUES CLOSED: #79
  • Loading branch information
MarshallOfSound authored and malept committed Jan 14, 2017
1 parent 725e6b0 commit 05f893e8257a9aca1a07a2f895f0f6e60b860a6a
@@ -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"
}
@@ -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';
}
}
@@ -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';
}

@@ -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}`,
@@ -44,15 +44,13 @@ export default async (providedOptions = {}) => {

dir = await resolveDir(dir);
if (!dir) {
// eslint-disable-next-line no-throw-literal
throw 'Failed to locate compilable Electron application';
}

const packageJSON = await readPackageJSON(dir);

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';
}

@@ -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';
}

@@ -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';
}
});
@@ -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}"`;
}

@@ -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();
@@ -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';
}

0 comments on commit 05f893e

Please sign in to comment.
You can’t perform that action at this time.