From 83954d691d16fe6599305cfdb5107ce5b287457d Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Thu, 18 Jul 2019 18:47:30 -0400 Subject: [PATCH] eslint cleanup fixes: operator-linebreak (#86) - remove operator-linebreak exception from .eslintrc.yml - reformat ternary expresssions according to (semi)standard - reformat error message expressions according to (semi)standard as done by the following command, with no operator-linebreak exception enabled: npm run eslint -- --fix --- .eslintrc.yml | 1 - src/ConfigChanges/ConfigChanges.js | 6 +++--- src/ConfigChanges/ConfigFile.js | 6 +++--- src/PlatformJson.js | 12 ++++++------ src/PluginInfo/PluginInfo.js | 10 +++++----- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index afef73bb..648dbf98 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -6,7 +6,6 @@ rules: - 4 camelcase: off padded-blocks: off - operator-linebreak: off no-unused-vars: - error - args: after-used diff --git a/src/ConfigChanges/ConfigChanges.js b/src/ConfigChanges/ConfigChanges.js index a695c598..6f1466a0 100644 --- a/src/ConfigChanges/ConfigChanges.js +++ b/src/ConfigChanges/ConfigChanges.js @@ -90,9 +90,9 @@ PlatformMunger.prototype.remove_plugin_changes = remove_plugin_changes; function remove_plugin_changes (pluginInfo, is_top_level) { var self = this; var platform_config = self.platformJson.root; - var plugin_vars = is_top_level ? - platform_config.installed_plugins[pluginInfo.id] : - platform_config.dependent_plugins[pluginInfo.id]; + var plugin_vars = is_top_level + ? platform_config.installed_plugins[pluginInfo.id] + : platform_config.dependent_plugins[pluginInfo.id]; var edit_config_changes = null; if (pluginInfo.getEditConfigs) { edit_config_changes = pluginInfo.getEditConfigs(self.platform); diff --git a/src/ConfigChanges/ConfigFile.js b/src/ConfigChanges/ConfigFile.js index 88c1e777..0bebf05c 100644 --- a/src/ConfigChanges/ConfigFile.js +++ b/src/ConfigChanges/ConfigFile.js @@ -79,9 +79,9 @@ function ConfigFile_load () { // We always write out text plist, not binary. // Do we still need to support binary plist? // If yes, use plist.parseStringSync() and read the file once. - self.data = isBinaryPlist(filepath) ? - modules.bplist.parseBuffer(fs.readFileSync(filepath))[0] : - modules.plist.parse(fs.readFileSync(filepath, 'utf8')); + self.data = isBinaryPlist(filepath) + ? modules.bplist.parseBuffer(fs.readFileSync(filepath))[0] + : modules.plist.parse(fs.readFileSync(filepath, 'utf8')); } } diff --git a/src/PlatformJson.js b/src/PlatformJson.js index b7a8c771..8005a9bb 100644 --- a/src/PlatformJson.js +++ b/src/PlatformJson.js @@ -72,9 +72,9 @@ PlatformJson.prototype.isPluginInstalled = function (pluginId) { }; PlatformJson.prototype.addPlugin = function (pluginId, variables, isTopLevel) { - var pluginsList = isTopLevel ? - this.root.installed_plugins : - this.root.dependent_plugins; + var pluginsList = isTopLevel + ? this.root.installed_plugins + : this.root.dependent_plugins; pluginsList[pluginId] = variables; @@ -114,9 +114,9 @@ PlatformJson.prototype.addPluginMetadata = function (pluginInfo) { }; PlatformJson.prototype.removePlugin = function (pluginId, isTopLevel) { - var pluginsList = isTopLevel ? - this.root.installed_plugins : - this.root.dependent_plugins; + var pluginsList = isTopLevel + ? this.root.installed_plugins + : this.root.dependent_plugins; delete pluginsList[pluginId]; diff --git a/src/PluginInfo/PluginInfo.js b/src/PluginInfo/PluginInfo.js index 6f6d68ea..0130741f 100644 --- a/src/PluginInfo/PluginInfo.js +++ b/src/PluginInfo/PluginInfo.js @@ -68,9 +68,9 @@ function PluginInfo (dirname) { if (!src || !target) { var msg = - 'Malformed tag. Both "src" and "target" attributes' - + 'must be specified in\n' - + self.filepath + 'Malformed tag. Both "src" and "target" attributes' + + 'must be specified in\n' + + self.filepath ; throw new Error(msg); } @@ -113,8 +113,8 @@ function PluginInfo (dirname) { if (!dep.id) { var msg = - ' tag is missing id attribute in ' - + self.filepath + ' tag is missing id attribute in ' + + self.filepath ; throw new CordovaError(msg); }