(semi)standard eslint updates
- eslint-config-semistandard@14
- eslint-config-standard@13
with src & spec fixed by the following command:
npm run eslint -- --fix
diff --git a/package.json b/package.json
index b3e84ae..07ab6e6 100644
--- a/package.json
+++ b/package.json
@@ -39,8 +39,8 @@
},
"devDependencies": {
"eslint": "^5.0.0",
- "eslint-config-semistandard": "^13.0.0",
- "eslint-config-standard": "^12.0.0",
+ "eslint-config-semistandard": "^14.0.0",
+ "eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.0",
diff --git a/spec/ConfigChanges/ConfigChanges.spec.js b/spec/ConfigChanges/ConfigChanges.spec.js
index 21baa57..d27a2b1 100644
--- a/spec/ConfigChanges/ConfigChanges.spec.js
+++ b/spec/ConfigChanges/ConfigChanges.spec.js
@@ -87,10 +87,10 @@
});
it('Test 002 : should append specified plugin with any variables to platform.json', function () {
var platformJson = new PlatformJson(null, 'android', null);
- platformJson.addInstalledPluginToPrepareQueue('org.test.plugins.dummyplugin', { 'dude': 'man' });
+ platformJson.addInstalledPluginToPrepareQueue('org.test.plugins.dummyplugin', { dude: 'man' });
var json = platformJson.root;
expect(json.prepare_queue.installed[0].plugin).toEqual('org.test.plugins.dummyplugin');
- expect(json.prepare_queue.installed[0].vars).toEqual({ 'dude': 'man' });
+ expect(json.prepare_queue.installed[0].vars).toEqual({ dude: 'man' });
});
});
@@ -116,7 +116,7 @@
var filepath = path.join(plugins_dir, 'android.json');
var json = {
prepare_queue: { installed: [], uninstalled: [] },
- config_munge: { files: { 'some_file': { parents: { 'some_parent': [{ 'xml': 'some_change', 'count': 1 }] } } } },
+ config_munge: { files: { some_file: { parents: { some_parent: [{ xml: 'some_change', count: 1 }] } } } },
installed_plugins: {},
dependent_plugins: {}
};
@@ -208,7 +208,7 @@
it('Test 014 : should generate config munges for queued plugins', function () {
fs.copySync(android_two_project, temp);
var platformJson = PlatformJson.load(plugins_dir, 'android');
- platformJson.root.prepare_queue.installed = [{ 'plugin': 'org.test.plugins.dummyplugin', 'vars': {} }];
+ platformJson.root.prepare_queue.installed = [{ plugin: 'org.test.plugins.dummyplugin', vars: {} }];
var munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider);
var spy = spyOn(munger, 'generate_plugin_config_munge').and.returnValue({});
munger.process(plugins_dir);
@@ -221,7 +221,7 @@
});
it('Test 015 : should call graftXML for every new config munge it introduces (every leaf in config munge that does not exist)', function () {
var platformJson = PlatformJson.load(plugins_dir, 'android');
- platformJson.root.prepare_queue.installed = [{ 'plugin': 'org.test.plugins.dummyplugin', 'vars': {} }];
+ platformJson.root.prepare_queue.installed = [{ plugin: 'org.test.plugins.dummyplugin', vars: {} }];
var spy = spyOn(xml_helpers, 'graftXML').and.returnValue(true);
@@ -558,7 +558,7 @@
install_plugin(varplugin);
var platformJson = PlatformJson.load(plugins_dir, 'android');
- platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', { 'API_KEY': 'hi' }, true);
+ platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', { API_KEY: 'hi' }, true);
var munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider);
munger.process(plugins_dir);
@@ -595,7 +595,7 @@
// Run through an "install"
var platformJson = PlatformJson.load(plugins_dir, 'android');
- platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', { 'API_KEY': 'canucks' });
+ platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', { API_KEY: 'canucks' });
var munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider);
munger.process(plugins_dir);
@@ -651,7 +651,7 @@
// install the var plugin
var platformJson = PlatformJson.load(plugins_dir, 'android');
- platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', { 'API_KEY': 'eat my shorts' });
+ platformJson.addInstalledPluginToPrepareQueue('com.adobe.vars', { API_KEY: 'eat my shorts' });
var munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider);
munger.process(plugins_dir);
diff --git a/spec/plist-helpers.spec.js b/spec/plist-helpers.spec.js
index 031216f..eb6c5e0 100644
--- a/spec/plist-helpers.spec.js
+++ b/spec/plist-helpers.spec.js
@@ -58,19 +58,19 @@
});
describe('plistGraft', function () {
- let doc = {
+ const doc = {
'keychain-access-groups': [
'$(AppIdentifierPrefix)io.cordova.hellocordova',
'$(AppIdentifierPrefix)com.example.mylib'
]
};
- let xml = '<array>' +
+ const xml = '<array>' +
'<string>$(AppIdentifierPrefix)io.cordova.hellocordova</string>' +
'<string>$(AppIdentifierPrefix)com.example.mylib</string>' +
'</array>';
- let selector = 'keychain-access-groups';
+ const selector = 'keychain-access-groups';
it('Test 01: should not mangle existing plist entries', () => {
var graftStatus = plistHelpers.graftPLIST(doc, xml, selector);
diff --git a/spec/superspawn.spec.js b/spec/superspawn.spec.js
index 27898da..7dfb9e7 100644
--- a/spec/superspawn.spec.js
+++ b/spec/superspawn.spec.js
@@ -41,7 +41,7 @@
return superspawn.spawn(LS, [], { stdio: 'pipe' })
.progress(progressSpy)
.then(function () {
- expect(progressSpy).toHaveBeenCalledWith({ 'stdout': jasmine.any(String) });
+ expect(progressSpy).toHaveBeenCalledWith({ stdout: jasmine.any(String) });
});
});
@@ -51,7 +51,7 @@
.then(() => {
fail('Expected promise to be rejected');
}, () => {
- expect(progressSpy).toHaveBeenCalledWith({ 'stderr': jasmine.any(String) });
+ expect(progressSpy).toHaveBeenCalledWith({ stderr: jasmine.any(String) });
});
});
@@ -112,7 +112,7 @@
describe('operation on windows', () => {
const TEST_SCRIPT = path.join(__dirname, 'fixtures/echo-args.cmd');
- const TEST_ARGS = [ 'install', 'foo@^1.2.3', 'c o r d o v a' ];
+ const TEST_ARGS = ['install', 'foo@^1.2.3', 'c o r d o v a'];
it('should escape arguments if `cmd` is not an *.exe', () => {
if (process.platform !== 'win32') {
diff --git a/src/ConfigParser/ConfigParser.js b/src/ConfigParser/ConfigParser.js
index cfc40cd..95863aa 100644
--- a/src/ConfigParser/ConfigParser.js
+++ b/src/ConfigParser/ConfigParser.js
@@ -75,7 +75,7 @@
*/
function findElementAttributeValue (attributeName, elems) {
- elems = Array.isArray(elems) ? elems : [ elems ];
+ elems = Array.isArray(elems) ? elems : [elems];
var value = elems.filter(function (elem) {
return elem.attrib.name.toLowerCase() === attributeName.toLowerCase();
@@ -505,8 +505,8 @@
return engines.map(function (engine) {
var spec = engine.attrib.spec || engine.attrib.version;
return {
- 'name': engine.attrib.name,
- 'spec': spec || null
+ name: engine.attrib.name,
+ spec: spec || null
};
});
},
@@ -523,14 +523,14 @@
var allows_local_networking = access.attrib['allows-local-networking']; /* Boolean */
return {
- 'origin': access.attrib.origin,
- 'minimum_tls_version': minimum_tls_version,
- 'requires_forward_secrecy': requires_forward_secrecy,
- 'requires_certificate_transparency': requires_certificate_transparency,
- 'allows_arbitrary_loads_in_web_content': allows_arbitrary_loads_in_web_content,
- 'allows_arbitrary_loads_in_media': allows_arbitrary_loads_in_media,
- 'allows_arbitrary_loads_for_media': allows_arbitrary_loads_for_media,
- 'allows_local_networking': allows_local_networking
+ origin: access.attrib.origin,
+ minimum_tls_version: minimum_tls_version,
+ requires_forward_secrecy: requires_forward_secrecy,
+ requires_certificate_transparency: requires_certificate_transparency,
+ allows_arbitrary_loads_in_web_content: allows_arbitrary_loads_in_web_content,
+ allows_arbitrary_loads_in_media: allows_arbitrary_loads_in_media,
+ allows_arbitrary_loads_for_media: allows_arbitrary_loads_for_media,
+ allows_local_networking: allows_local_networking
};
});
},
@@ -543,10 +543,10 @@
var requires_certificate_transparency = allow_navigation.attrib['requires-certificate-transparency']; /* Boolean */
return {
- 'href': allow_navigation.attrib.href,
- 'minimum_tls_version': minimum_tls_version,
- 'requires_forward_secrecy': requires_forward_secrecy,
- 'requires_certificate_transparency': requires_certificate_transparency
+ href: allow_navigation.attrib.href,
+ minimum_tls_version: minimum_tls_version,
+ requires_forward_secrecy: requires_forward_secrecy,
+ requires_certificate_transparency: requires_certificate_transparency
};
});
},
@@ -555,7 +555,7 @@
var allow_intents = this.doc.findall('./allow-intent');
return allow_intents.map(function (allow_intent) {
return {
- 'href': allow_intent.attrib.href
+ href: allow_intent.attrib.href
};
});
},
diff --git a/src/CordovaLogger.js b/src/CordovaLogger.js
index 631070a..85cd3a9 100644
--- a/src/CordovaLogger.js
+++ b/src/CordovaLogger.js
@@ -37,10 +37,15 @@
class CordovaLogger {
// Encapsulate the default logging level values with constants:
static get VERBOSE () { return 'verbose'; }
+
static get NORMAL () { return 'normal'; }
+
static get WARN () { return 'warn'; }
+
static get INFO () { return 'info'; }
+
static get ERROR () { return 'error'; }
+
static get RESULTS () { return 'results'; }
/**
diff --git a/src/FileUpdater.js b/src/FileUpdater.js
index fcbb205..6f384b5 100644
--- a/src/FileUpdater.js
+++ b/src/FileUpdater.js
@@ -244,7 +244,7 @@
*/
function mergeAndUpdateDir (sourceDirs, targetDir, options, log) {
if (sourceDirs && typeof sourceDirs === 'string') {
- sourceDirs = [ sourceDirs ];
+ sourceDirs = [sourceDirs];
} else if (!Array.isArray(sourceDirs)) {
throw new Error('A source directory path or array of paths is required.');
}
@@ -257,16 +257,16 @@
var rootDir = (options && options.rootDir) || '';
- var include = (options && options.include) || [ '**' ];
+ var include = (options && options.include) || ['**'];
if (typeof include === 'string') {
- include = [ include ];
+ include = [include];
} else if (!Array.isArray(include)) {
throw new Error('Include parameter must be a glob string or array of glob strings.');
}
var exclude = (options && options.exclude) || [];
if (typeof exclude === 'string') {
- exclude = [ exclude ];
+ exclude = [exclude];
} else if (!Array.isArray(exclude)) {
throw new Error('Exclude parameter must be a glob string or array of glob strings.');
}
diff --git a/src/PlatformJson.js b/src/PlatformJson.js
index 8005a9b..da77e3f 100644
--- a/src/PlatformJson.js
+++ b/src/PlatformJson.js
@@ -153,11 +153,11 @@
};
PlatformJson.prototype.addInstalledPluginToPrepareQueue = function (pluginDirName, vars, is_top_level, force) {
- this.root.prepare_queue.installed.push({ 'plugin': pluginDirName, 'vars': vars, 'topLevel': is_top_level, 'force': force });
+ this.root.prepare_queue.installed.push({ plugin: pluginDirName, vars: vars, topLevel: is_top_level, force: force });
};
PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function (pluginId, is_top_level) {
- this.root.prepare_queue.uninstalled.push({ 'plugin': pluginId, 'id': pluginId, 'topLevel': is_top_level });
+ this.root.prepare_queue.uninstalled.push({ plugin: pluginId, id: pluginId, topLevel: is_top_level });
};
/**
diff --git a/src/superspawn.js b/src/superspawn.js
index 2e58b2e..7c999a1 100644
--- a/src/superspawn.js
+++ b/src/superspawn.js
@@ -103,7 +103,7 @@
child.stdout.setEncoding('utf8');
child.stdout.on('data', function (data) {
capturedOut += data;
- d.notify({ 'stdout': data });
+ d.notify({ stdout: data });
});
}
@@ -111,7 +111,7 @@
child.stderr.setEncoding('utf8');
child.stderr.on('data', function (data) {
capturedErr += data;
- d.notify({ 'stderr': data });
+ d.notify({ stderr: data });
});
}
diff --git a/src/util/xml-helpers.js b/src/util/xml-helpers.js
index 7221e7a..32ceb1a 100644
--- a/src/util/xml-helpers.js
+++ b/src/util/xml-helpers.js
@@ -293,7 +293,7 @@
function removeDuplicatePreferences (xml) {
// reduce preference tags to a hashtable to remove dupes
var prefHash = xml.findall('preference[@name][@value]').reduce(function (previousValue, currentValue) {
- previousValue[ currentValue.attrib.name ] = currentValue.attrib.value;
+ previousValue[currentValue.attrib.name] = currentValue.attrib.value;
return previousValue;
}, {});