Skip to content

Commit

Permalink
chore(generic): disable the no-throw-literal eslint rule
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #79
  • Loading branch information
MarshallOfSound authored and malept committed Jan 15, 2017
1 parent 725e6b0 commit 05f893e
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
5 changes: 0 additions & 5 deletions src/api/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand All @@ -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.`;
}

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

Expand All @@ -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}`;
}
});
Expand All @@ -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';
}
}
Expand Down
1 change: 0 additions & 1 deletion src/api/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
3 changes: 0 additions & 3 deletions src/api/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down Expand Up @@ -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}`,
Expand Down
2 changes: 0 additions & 2 deletions src/api/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
1 change: 0 additions & 1 deletion src/api/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
1 change: 0 additions & 1 deletion src/api/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
});
Expand Down
2 changes: 0 additions & 2 deletions src/init/init-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}\``;
}
}
Expand All @@ -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}"`;
}

Expand Down
1 change: 0 additions & 1 deletion src/installers/darwin/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/util/resolve-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down

0 comments on commit 05f893e

Please sign in to comment.