breaking: use @cordova/eslint-config w/ applied fix (#377)
* breaking: use @cordova/eslint-config w/ applied fix
* ci: update command in travis config
* chore: add missing EOL
* chore: revert the removal of quote prop
* chore: revert the removal of quote prop
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 0cccb8c..f2e63b6 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,10 +1,30 @@
-root: true
-extends: semistandard
-rules:
- indent:
- - error
- - 4
- camelcase: off
- padded-blocks: off
- operator-linebreak: off
- no-throw-literal: off
\ No newline at end of file
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+extends: '@cordova/eslint-config/node'
+
+overrides:
+ - files: [spec/**/*.js]
+ extends: '@cordova/eslint-config/node-tests'
+
+ - files: [cordova-js-src/**/*.js]
+ extends: '@cordova/eslint-config/browser'
+
+ globals:
+ cordova: readonly
+ WinJS: readonly
+ Windows: readonly
diff --git a/.travis.yml b/.travis.yml
index a8cff29..84dd5fe 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,7 @@
- npm install -g codecov
script:
- - npm run eslint
+ - npm run lint
- npm run cover
after_script:
diff --git a/bin/create b/bin/create
index 9af5b0a..c0b229f 100755
--- a/bin/create
+++ b/bin/create
@@ -24,11 +24,11 @@
var Api = require('../template/cordova/Api');
var argv = require('nopt')({
- 'help': Boolean,
- 'guid': String,
- 'silent': Boolean,
- 'verbose': Boolean
-}, { 'd': '--verbose' });
+ help: Boolean,
+ guid: String,
+ silent: Boolean,
+ verbose: Boolean
+}, { d: '--verbose' });
if (argv.help || argv.argv.remain.length === 0) {
console.log('Usage: create PathToProject [ PackageName [ AppName [ CustomTemplate ] ] ] [--guid=<GUID string>]');
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 5006f34..e3d9b5e 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -41,7 +41,7 @@
// reference: https://msdn.microsoft.com/en-us/library/bb164659(v=vs.120).aspx
var VS2013_UPDATE2_RC = new Version(12, 0, 30324);
var REQUIRED_VERSIONS = {
- '8.1': {
+ '8.1': { // eslint-disable-line quote-props
os: '6.3',
msbuild: '12.0',
visualstudio: '12.0',
@@ -220,8 +220,8 @@
function mapWindowsVersionToName (version) {
var map = {
- '6.2': 'Windows 8',
- '6.3': 'Windows 8.1',
+ '6.2': 'Windows 8', // eslint-disable-line quote-props
+ '6.3': 'Windows 8.1', // eslint-disable-line quote-props
'10.0': 'Windows 10'
};
var majorMinor = shortenVersion(version);
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 6919145..ccbd33c 100644
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -73,7 +73,7 @@
shell.cp('-rf', path.join(root, 'VERSION'), projectPath);
// copy node_modules to cordova directory
- let nodeModulesDir = path.join(root, 'node_modules');
+ const nodeModulesDir = path.join(root, 'node_modules');
if (fs.existsSync(nodeModulesDir)) {
events.emit('verbose', 'Copying node_modules to ' + projectPath);
shell.cp('-r', nodeModulesDir, path.join(projectPath, 'cordova'));
@@ -101,8 +101,8 @@
// replace specific values in manifests' templates
events.emit('verbose', 'Updating manifest files with project configuration.');
- [ 'package.windows.appxmanifest', 'package.phone.appxmanifest',
- 'package.windows10.appxmanifest' ]
+ ['package.windows.appxmanifest', 'package.phone.appxmanifest',
+ 'package.windows10.appxmanifest']
.forEach(function (item) {
var manifest = AppxManifest.get(path.join(projectPath, item));
if (manifest.hasPhoneIdentity) {
diff --git a/bin/update b/bin/update
index 13e1c6e..0133ce9 100755
--- a/bin/update
+++ b/bin/update
@@ -21,10 +21,10 @@
var Api = require('../template/cordova/Api');
var args = require('nopt')({
- 'help': Boolean,
- 'silent': Boolean,
- 'verbose': Boolean
-}, { 'd': '--verbose' });
+ help: Boolean,
+ silent: Boolean,
+ verbose: Boolean
+}, { d: '--verbose' });
if (args.help || args.argv.remain.length === 0) {
console.log('WARNING : Make sure to back up your project before updating!');
diff --git a/cordova-js-src/.eslintrc.yml b/cordova-js-src/.eslintrc.yml
deleted file mode 100644
index 472e887..0000000
--- a/cordova-js-src/.eslintrc.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-env:
- node: false
- commonjs: true
- browser: true
-
-globals:
- cordova: readonly
- WinJS: readonly
- Windows: readonly
diff --git a/cordova-js-src/confighelper.js b/cordova-js-src/confighelper.js
index 0bc8c4a..2310857 100644
--- a/cordova-js-src/confighelper.js
+++ b/cordova-js-src/confighelper.js
@@ -110,11 +110,11 @@
* @param {String} preferenceName Preference name to read */
Config.prototype.getPreferenceValue = function (preferenceName) {
var preferenceItem = this.preferences && this.preferences.filter(function (item) {
- return item.attributes['name'].value === preferenceName;
+ return item.attributes.name.value === preferenceName;
});
- if (preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes['value']) {
- return preferenceItem[0].attributes['value'].value;
+ if (preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes.value) {
+ return preferenceItem[0].attributes.value.value;
}
};
@@ -122,7 +122,7 @@
* Reads SplashScreen image path
*/
Manifest.prototype.getSplashScreenImagePath = function () {
- return this.splashScreen.attributes['Image'].value;
+ return this.splashScreen.attributes.Image.value;
};
exports.readConfig = readConfig;
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
index eb41bf9..23b2a17 100644
--- a/cordova-js-src/exec.js
+++ b/cordova-js-src/exec.js
@@ -40,7 +40,6 @@
* @param {String[]} [args] Zero or more arguments to pass to the method
*/
module.exports = function (success, fail, service, action, args) {
-
// Handle the case when we have an old version of splashscreen plugin to avoid the API calls failures
if (service === 'SplashScreen') {
var pluginsVersions = require('cordova/plugin_list').metadata;
@@ -111,7 +110,6 @@
});
};
proxy(onSuccess, onError, args);
-
} catch (e) {
console.log('Exception calling native with command :: ' + service + ' :: ' + action + ' ::exception=' + e);
}
diff --git a/cordova-js-src/platform.js b/cordova-js-src/platform.js
index a3f2aca..d27edcb 100644
--- a/cordova-js-src/platform.js
+++ b/cordova-js-src/platform.js
@@ -71,8 +71,8 @@
});
}
- if (e.detail.previousExecutionState === Windows.ApplicationModel.Activation.ApplicationExecutionState.running
- || e.detail.previousExecutionState === Windows.ApplicationModel.Activation.ApplicationExecutionState.suspended) {
+ if (e.detail.previousExecutionState === Windows.ApplicationModel.Activation.ApplicationExecutionState.running ||
+ e.detail.previousExecutionState === Windows.ApplicationModel.Activation.ApplicationExecutionState.suspended) {
cordova.fireDocumentEvent('activated', platform.activationContext, true);
return;
}
@@ -133,7 +133,6 @@
};
function injectBackButtonHandler () {
-
var app = WinJS.Application;
// create document event handler for backbutton
@@ -167,9 +166,9 @@
backButtonChannel.onHasSubscribersChange = function () {
// If we just attached the first handler or detached the last handler,
// let native know we need to override the back button.
- navigationManager.appViewBackButtonVisibility = (this.numHandlers > 0) ?
- Windows.UI.Core.AppViewBackButtonVisibility.visible :
- Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
+ navigationManager.appViewBackButtonVisibility = (this.numHandlers > 0)
+ ? Windows.UI.Core.AppViewBackButtonVisibility.visible
+ : Windows.UI.Core.AppViewBackButtonVisibility.collapsed;
};
navigationManager.addEventListener('backrequested', backRequestedHandler, false);
diff --git a/package.json b/package.json
index 49b90b5..cc85299 100644
--- a/package.json
+++ b/package.json
@@ -12,11 +12,11 @@
"apache"
],
"scripts": {
- "test": "npm run eslint && npm run test-unit && npm run test-e2e",
+ "test": "npm run lint && npm run test-unit && npm run test-e2e",
"test-unit": "jasmine",
"test-e2e": "jasmine spec/e2e/endtoend.spec.js",
"cover": "nyc jasmine",
- "eslint": "eslint . \"+(bin|template)/**/!(*.*)\""
+ "lint": "eslint . \"+(bin|template)/**/!(*.*|gitignore)\""
},
"dependencies": {
"cordova-common": "^3.2.0",
@@ -30,13 +30,7 @@
"winjs": "^4.4.3"
},
"devDependencies": {
- "eslint": "^5.12.0",
- "eslint-config-semistandard": "^13.0.0",
- "eslint-config-standard": "^12.0.0",
- "eslint-plugin-import": "^2.14.0",
- "eslint-plugin-node": "^8.0.1",
- "eslint-plugin-promise": "^4.0.1",
- "eslint-plugin-standard": "^4.0.0",
+ "@cordova/eslint-config": "^3.0.0",
"jasmine": "^3.5.0",
"nyc": "^15.0.1",
"rewire": "^5.0.0"
diff --git a/spec/.eslintrc.yml b/spec/.eslintrc.yml
deleted file mode 100644
index 6afba65..0000000
--- a/spec/.eslintrc.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-env:
- jasmine: true
\ No newline at end of file
diff --git a/spec/e2e/endtoend.spec.js b/spec/e2e/endtoend.spec.js
index b33e013..0e6ba81 100644
--- a/spec/e2e/endtoend.spec.js
+++ b/spec/e2e/endtoend.spec.js
@@ -29,7 +29,6 @@
var PluginInfo = require('cordova-common').PluginInfo;
describe('Cordova create and build', function () {
-
var templateDir = path.join(__dirname, '../../template');
var projectFolder = 'testcreate 応用';
var workingDirectory = path.join(__dirname, '../../temp');
@@ -79,7 +78,6 @@
});
describe('Windows 10', function () {
-
// default
it('spec.2a should build default (win10) project', function () {
@@ -157,11 +155,9 @@
_expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_x64_Test', 'CordovaApp.Windows10_1.0.0.0_x64.appx');
_expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_x86_Test', 'CordovaApp.Windows10_1.0.0.0_x86.appx');
});
-
});
describe('Windows 8.1', function () {
-
beforeEach(function () {
if (process.env.APPVEYOR_BUILD_WORKER_IMAGE === 'Visual Studio 2017' && process.env.MSBUILDDIR !== 'C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\') {
pending('Windows 8.1 builds are not supported by Visual Studio 2017: https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2017-compatibility-vs#windows-store-and-windows-phone-apps');
@@ -254,7 +250,5 @@
_expectSubdirAndFileExist('CordovaApp.Phone_1.0.0.0_arm_Test', 'CordovaApp.Phone_1.0.0.0_arm.appx');
_expectSubdirAndFileExist('CordovaApp.Phone_1.0.0.0_x86_Test', 'CordovaApp.Phone_1.0.0.0_x86.appx');
});
-
});
-
});
diff --git a/spec/unit/AppxManifest.spec.js b/spec/unit/AppxManifest.spec.js
index 882b1d3..51bc71d 100644
--- a/spec/unit/AppxManifest.spec.js
+++ b/spec/unit/AppxManifest.spec.js
@@ -30,7 +30,6 @@
var CSS_COLOR_NAME = 'turquoise';
describe('AppxManifest', function () {
-
var XMLS = {
'/no/prefixed': new et.ElementTree(et.XML('<?xml version="1.0" encoding="UTF-8"?><Package/>')),
'/uap/prefixed': new et.ElementTree(et.XML('<?xml version="1.0" encoding="UTF-8"?><Package xmlns:uap=""/>'))
@@ -46,7 +45,6 @@
});
describe('constructor', function () {
-
it('Test #000 : should create a new AppxManifest instance', function () {
var manifest;
expect(function () { manifest = new AppxManifest(WINDOWS_MANIFEST); }).not.toThrow();
@@ -103,7 +101,6 @@
});
describe('static get() method', function () {
-
it('Test #008 : should return an AppxManifest instance', function () {
expect(AppxManifest.get(WINDOWS_MANIFEST) instanceof AppxManifest).toBe(true);
});
@@ -174,8 +171,8 @@
it('Test #015 : should not write duplicate UAP capability declarations', function () {
var manifest = AppxManifest.get(WINDOWS_10_MANIFEST);
var capabilities = manifest.doc.find('.//Capabilities');
- capabilities.append(new et.Element('uap:Capability', { 'Name': 'enterpriseAuthentication' }));
- capabilities.append(new et.Element('uap:Capability', { 'Name': 'enterpriseAuthentication' }));
+ capabilities.append(new et.Element('uap:Capability', { Name: 'enterpriseAuthentication' }));
+ capabilities.append(new et.Element('uap:Capability', { Name: 'enterpriseAuthentication' }));
var xml = manifest.writeToString();
diff --git a/spec/unit/ConfigChanges.spec.js b/spec/unit/ConfigChanges.spec.js
index 05f5ede..face9b5 100644
--- a/spec/unit/ConfigChanges.spec.js
+++ b/spec/unit/ConfigChanges.spec.js
@@ -48,9 +48,13 @@
beforeEach(function () {
shell.mkdir('-p', tempDir);
- munge = { parents: { 'foo/bar': [
- { before: undefined, count: 1, xml: '<DummyElement name="Dummy" />' }
- ] } };
+ munge = {
+ parents: {
+ 'foo/bar': [
+ { before: undefined, count: 1, xml: '<DummyElement name="Dummy" />' }
+ ]
+ }
+ };
munger = new PlatformMunger('windows', tempDir);
spyOn(BaseMunger.prototype, 'apply_file_munge').and.callThrough();
});
@@ -60,7 +64,6 @@
});
describe('apply_file_munge method', function () {
-
it('should call parent\'s method with the same parameters', function () {
munger.apply_file_munge(WINDOWS_MANIFEST, munge, false);
expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS_MANIFEST, munge, false);
@@ -73,16 +76,24 @@
it('should remove uap: capabilities added by windows prepare step', function () {
// Generate a munge that contain non-prefixed capabilities changes
- var baseMunge = { parents: { '/Package/Capabilities': [
- // Emulate capability that was initially added with uap prefix
- { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">' }, /* eslint no-useless-escape : 0 */
- { before: undefined, count: 1, xml: '<Capability Name=\"enterpriseAuthentication\">' } /* eslint no-useless-escape : 0 */
- ] } };
+ var baseMunge = {
+ parents: {
+ '/Package/Capabilities': [
+ // Emulate capability that was initially added with uap prefix
+ { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">' }, /* eslint no-useless-escape : 0 */
+ { before: undefined, count: 1, xml: '<Capability Name=\"enterpriseAuthentication\">' } /* eslint no-useless-escape : 0 */
+ ]
+ }
+ };
- var capabilitiesMunge = { parents: { '/Package/Capabilities': [
- { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">' },
- { before: undefined, count: 1, xml: '<uap:Capability Name=\"enterpriseAuthentication\">' }
- ] } };
+ var capabilitiesMunge = {
+ parents: {
+ '/Package/Capabilities': [
+ { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">' },
+ { before: undefined, count: 1, xml: '<uap:Capability Name=\"enterpriseAuthentication\">' }
+ ]
+ }
+ };
munger.apply_file_munge(WINDOWS10_MANIFEST, baseMunge, /* remove= */true);
expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS10_MANIFEST, capabilitiesMunge, true);
});
@@ -90,7 +101,6 @@
});
describe('Capabilities within package.windows.appxmanifest', function () {
-
var testDir, windowsPlatform, windowsManifest, windowsManifest10, dummyPluginInfo, api;
beforeEach(function () {
diff --git a/spec/unit/JsprojManager.spec.js b/spec/unit/JsprojManager.spec.js
index 936034e..f1a3ba6 100644
--- a/spec/unit/JsprojManager.spec.js
+++ b/spec/unit/JsprojManager.spec.js
@@ -35,12 +35,10 @@
'</Package>'));
describe('JsprojManager', function () {
-
var project;
var origProj = JsprojManager.__get__('proj');
beforeEach(function () {
-
JsprojManager.__set__('proj', jasmine.createSpy('proj'));
spyOn(shell, 'ls').and.returnValue([PROJECT_PATH + '/CordovaApp.projitems']);
diff --git a/spec/unit/MRTImage.spec.js b/spec/unit/MRTImage.spec.js
index 2d5c050..1a07bb0 100644
--- a/spec/unit/MRTImage.spec.js
+++ b/spec/unit/MRTImage.spec.js
@@ -20,7 +20,6 @@
var MRTImage = require('../../template/cordova/lib/MRTImage');
describe('MRTImage class', function () {
-
it('should be constructable', function () {
expect(new MRTImage('some/path/Image.scale-240.png')).toBeDefined();
});
diff --git a/spec/unit/MSBuildTools.spec.js b/spec/unit/MSBuildTools.spec.js
index 94c99ba..47ee796 100644
--- a/spec/unit/MSBuildTools.spec.js
+++ b/spec/unit/MSBuildTools.spec.js
@@ -143,18 +143,18 @@
var availableVersions = ['10.0.10030.0', '10.0.10166.0', '10.0.10078.0'];
var shellTest, shellLs;
var programFilesx86Orig = process.env['ProgramFiles(x86)'];
- var programFilesOrig = process.env['ProgramFiles'];
+ var programFilesOrig = process.env.ProgramFiles;
beforeEach(function () {
shellTest = spyOn(shell, 'test').and.returnValue(true);
shellLs = spyOn(shell, 'ls').and.returnValue(availableVersions);
process.env['ProgramFiles(x86)'] = '/';
- process.env['ProgramFiles'] = '/';
+ process.env.ProgramFiles = '/';
});
afterEach(function () {
process.env['ProgramFiles(x86)'] = programFilesx86Orig;
- process.env['ProgramFiles'] = programFilesOrig;
+ process.env.ProgramFiles = programFilesOrig;
});
it('should return list of available versions', function () {
@@ -172,7 +172,7 @@
it('should return empty array if it isn\'t able to detect SDK location', function () {
delete process.env['ProgramFiles(x86)'];
- delete process.env['ProgramFiles'];
+ delete process.env.ProgramFiles;
expect(buildTools.getAvailableUAPVersions().length).toEqual(0);
});
@@ -191,7 +191,6 @@
});
describe('getMSBuildToolsAt method', function () {
-
var fakePath = '/some/fake/path';
var messyPath = '/another/fake/path';
var fakeVersion = '22.0.12635.5';
diff --git a/spec/unit/Prepare.Win10.spec.js b/spec/unit/Prepare.Win10.spec.js
index 847ed01..0740251 100644
--- a/spec/unit/Prepare.Win10.spec.js
+++ b/spec/unit/Prepare.Win10.spec.js
@@ -93,11 +93,9 @@
}
describe('Windows 8.1 project', function () {
-
it('should not have an HTTP or HTTPS scheme for its startup URI.', function () {
-
// arrange
- var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { 'WindowsDefaultUriPrefix': 'http://' }, false);
+ var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { WindowsDefaultUriPrefix: 'http://' }, false);
// act
applyCoreProperties(mockConfig.config, mockConfig.manifest, 'fake-path', 'm2:', false);
@@ -107,9 +105,8 @@
});
it('should not have any scheme for its startup URI.', function () {
-
// arrange
- var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { 'WindowsDefaultUriPrefix': 'ms-appx://' }, false);
+ var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { WindowsDefaultUriPrefix: 'ms-appx://' }, false);
// act
applyCoreProperties(mockConfig.config, mockConfig.manifest, 'fake-path', 'm2:', false);
@@ -121,7 +118,6 @@
describe('Windows 10 project', function () {
it('should default to ms-appx-web for its startup URI.', function () {
-
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { }, true);
@@ -137,9 +133,8 @@
});
it('should allow ms-appx as its startup URI, and it gets removed from the final output.', function () {
-
// arrange
- var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { 'WindowsDefaultUriPrefix': 'ms-appx://' }, true);
+ var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { WindowsDefaultUriPrefix: 'ms-appx://' }, true);
// act
applyStartPage(mockConfig.config, mockConfig.manifest, true);
@@ -149,9 +144,8 @@
});
it('should allow an HTTP or HTTPS scheme for its startup URI.', function () {
-
// arrange
- var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { 'WindowsDefaultUriPrefix': 'http://' }, true);
+ var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { WindowsDefaultUriPrefix: 'http://' }, true);
// act
applyStartPage(mockConfig.config, mockConfig.manifest, true);
@@ -162,11 +156,9 @@
});
describe('Windows Store preference', function () {
-
it('"WindowsStoreDisplayName" should be reflected in the manifest.', function () {
-
// arrange
- var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { 'WindowsDefaultUriPrefix': 'http://', 'WindowsStoreDisplayName': 'ContosoApp' }, true);
+ var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { WindowsDefaultUriPrefix: 'http://', WindowsStoreDisplayName: 'ContosoApp' }, true);
// act
applyCoreProperties(mockConfig.config, mockConfig.manifest, 'fake-path', 'uap:', true);
@@ -176,9 +168,8 @@
});
it('"WindowsStorePublisherName" should be reflected in the manifest.', function () {
-
// arrange
- var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { 'WindowsDefaultUriPrefix': 'http://', 'WindowsStorePublisherName': 'Contoso Inc' }, true);
+ var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { WindowsDefaultUriPrefix: 'http://', WindowsStorePublisherName: 'Contoso Inc' }, true);
// act
applyCoreProperties(mockConfig.config, mockConfig.manifest, 'fake-path', 'uap:', true);
@@ -189,7 +180,6 @@
});
describe('A Windows 10 project should warn if it supports remote mode and restricted capabilities.', function () {
-
// arrange
var mockConfig;
var stringFound = false;
@@ -262,14 +252,14 @@
}
return rules.map(function (rule) {
- return { 'origin': rule };
+ return { origin: rule };
});
};
config.getAllowNavigations = function () {
if (isWin10) {
return rules.map(function (rule) {
- return { 'href': rule };
+ return { href: rule };
});
}
@@ -286,7 +276,6 @@
describe('Access rules management', function () {
// body...
it('A Windows 8.1 project should not have WindowsRuntimeAccess attributes in access rules.', function () {
-
var mockConfig = createMockConfigAndManifestForApplyAccessRules(false, 'https://www.contoso.com');
applyAccessRules(mockConfig.config, mockConfig.manifest);
@@ -300,11 +289,9 @@
var rule = accessRules.getItem(0);
expect(rule).toBeDefined();
expect(rule.attrib.WindowsRuntimeAccess).toBeUndefined();
-
});
it('A Windows 10 project should have WindowsRuntimeAccess attributes in access rules.', function () {
-
var mockConfig = createMockConfigAndManifestForApplyAccessRules(true, 'https://www.contoso.com');
applyNavigationWhitelist(mockConfig.config, mockConfig.manifest, true);
@@ -319,11 +306,9 @@
expect(rule).toBeDefined();
expect(rule.attrib.WindowsRuntimeAccess).toBeDefined();
expect(rule.attrib.WindowsRuntimeAccess).toBe('all');
-
});
describe('A Windows 8.1 project should reject http:// URI scheme rules.', function () {
-
var stringIndex = -1;
var searchStr = 'Access rules must begin with "https://", the following rule will be ignored: ';
@@ -342,7 +327,6 @@
});
describe('A Windows 10 project should accept http:// URI access rules.', function () {
-
var stringIndex = -1;
var searchStr = 'The following navigation rule had an invalid URI scheme and is ignored:';
beforeEach(function () {
@@ -361,7 +345,6 @@
});
describe('A Windows 10 project should apply the uap: namespace prefix to certain capabilities.', function () {
-
var manifest;
beforeEach(function () {
diff --git a/spec/unit/Version.spec.js b/spec/unit/Version.spec.js
index e33702f..b33083e 100644
--- a/spec/unit/Version.spec.js
+++ b/spec/unit/Version.spec.js
@@ -20,7 +20,6 @@
var Version = require('../../template/cordova/lib/Version.js');
describe('Version constructor', function () {
-
it('Test #000 : should behave correctly', function () {
var v1 = new Version(1);
expect(v1.major).toBe(1);
@@ -46,7 +45,6 @@
});
describe('Version parse functions work as expected.', function () {
-
it('Test #001 : should behave correctly', function () {
var version = Version.fromString('1.2.4.7');
expect(version.major).toBe(1);
diff --git a/spec/unit/WindowsConfigParser.spec.js b/spec/unit/WindowsConfigParser.spec.js
index 926e03a..bae7059 100644
--- a/spec/unit/WindowsConfigParser.spec.js
+++ b/spec/unit/WindowsConfigParser.spec.js
@@ -38,7 +38,6 @@
**/
describe('getAllMinMaxUAPVersions method', function () {
-
var mockConfig;
beforeEach(function () {
spyOn(xml, 'parseElementtreeSync').and.returnValue(new et.ElementTree(et.XML(TEST_XML)));
@@ -84,7 +83,6 @@
expect(versionSet[0].Name).toBe('Windows.Universal');
expect(versionSet[0].MinVersion).toBe(verBaseline);
expect(versionSet[0].MaxVersionTested).toBe(verBaseline);
-
});
it('should fail with a RangeError if version specified incorrectly', function () {
diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index 4023ea1..b703c9a 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -115,7 +115,7 @@
utils.isCordovaProject.and.returnValue(false);
createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
- return build.run([ 'node', buildPath, '--release', '--debug' ]).then(
+ return build.run(['node', buildPath, '--release', '--debug']).then(
() => fail('Expected promise to be rejected'),
() => expect(buildSpy).not.toHaveBeenCalled()
);
@@ -137,12 +137,11 @@
createFindAvailableVersionMock('14.0', testPath, buildSpy);
expect(function () {
- build.run({ argv: [ '--phone', '--win' ] });
+ build.run({ argv: ['--phone', '--win'] });
}).toThrow();
});
it('should respect build configuration from \'buildConfig\' option', function () {
-
createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: jasmine.createSpy(), path: testPath }]);
var buildConfigPath = path.resolve(__dirname, 'fixtures/fakeBuildConfig.json');
@@ -182,7 +181,7 @@
createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
- return build.run([ 'node', buildPath ])
+ return build.run(['node', buildPath])
.finally(function () {
expect(buildSpy).toHaveBeenCalled();
});
@@ -422,7 +421,6 @@
});
describe('buildFlags', function () {
-
describe('parseAndValidateArgs method', function () {
var parseAndValidateArgs;
var readFileSync;
@@ -441,7 +439,7 @@
argv: ['--buildFlag', 'foo=bar', '--buildFlag', 'bar=baz', '--buildConfig', 'buildConfig.json']
};
- expect(parseAndValidateArgs(buildOptions).buildFlags).toEqual([ 'baz="quux"', 'foo=bar', 'bar=baz' ]);
+ expect(parseAndValidateArgs(buildOptions).buildFlags).toEqual(['baz="quux"', 'foo=bar', 'bar=baz']);
});
});
@@ -472,7 +470,7 @@
.then(() => {
// CB-12416 AppxBundle=Never is present because we are not building a bundle
expect(buildTools.buildProject).toHaveBeenCalledWith(jasmine.any(String),
- jasmine.any(String), jasmine.any(String), [ 'foo=bar', '/p:AppxBundle=Never' ]);
+ jasmine.any(String), jasmine.any(String), ['foo=bar', '/p:AppxBundle=Never']);
});
});
});
diff --git a/spec/unit/check_reqs.spec.js b/spec/unit/check_reqs.spec.js
index e7a65a1..e288406 100644
--- a/spec/unit/check_reqs.spec.js
+++ b/spec/unit/check_reqs.spec.js
@@ -28,7 +28,6 @@
var check_reqs = rewire(path.join(binPath, 'lib/check_reqs.js'));
describe('check_reqs module', function () {
-
describe('has Requirement object', function () {
var Requirement;
beforeEach(function () {
@@ -145,5 +144,4 @@
});
});
});
-
});
diff --git a/spec/unit/deployment.spec.js b/spec/unit/deployment.spec.js
index a93b63f..8c4517a 100644
--- a/spec/unit/deployment.spec.js
+++ b/spec/unit/deployment.spec.js
@@ -28,7 +28,6 @@
var TEST_APP_PACKAGE_ID = '12121212-3434-3434-3434-567856785678';
describe('The correct version of the app deployment tool is obtained.', function () {
-
var mockedProgramFiles = process.env['ProgramFiles(x86)'];
beforeEach(function () {
@@ -44,22 +43,17 @@
});
it('Test #000 : Provides an AppDeployCmdTool when 8.1 is requested.', function () {
-
var tool = deployment.getDeploymentTool('8.1');
expect(tool instanceof AppDeployCmdTool).toBe(true);
-
});
it('Test #001 : Provides a WinAppDeployCmdTool when 10.0 is requested.', function () {
-
var tool = deployment.getDeploymentTool('10.0');
expect(tool instanceof WinAppDeployCmdTool).toBe(true);
-
});
});
describe('Windows 10 deployment interacts with the file system as expected.', function () {
-
function fakeSpawn (cmd, args, cwd) {
expect(cmd).toBe(path.join('c:/Program Files (x86)/Windows Kits/10/bin/x86/WinAppDeployCmd.exe'));
switch (args[0]) {
@@ -77,7 +71,6 @@
expect(args[2]).toBe(TEST_APP_PACKAGE_ID);
expect(args[4]).toBe('10.120.68.150');
return Q('');
-
}
}
@@ -135,7 +128,6 @@
});
describe('Windows 8.1 deployment interacts with the file system as expected.', function () {
-
function fakeSpawn (cmd, args, cwd) {
expect(cmd).toBe(path.join('c:/Program Files (x86)/Microsoft SDKs/Windows Phone/v8.1/Tools/AppDeploy/AppDeployCmd.exe'));
switch (args[0]) {
@@ -158,7 +150,6 @@
default:
throw new Error('Unrecognized AppDeployCmd parameter "' + args[0] + '"');
-
}
}
diff --git a/spec/unit/pluginHandler/windows.spec.js b/spec/unit/pluginHandler/windows.spec.js
index a22c9ab..530db7f 100644
--- a/spec/unit/pluginHandler/windows.spec.js
+++ b/spec/unit/pluginHandler/windows.spec.js
@@ -128,7 +128,6 @@
});
function validateInstalledProjects (tag, elementToInstall, xpath, supportedPlatforms) {
-
var projects = copyArray(dummyProject.projects);
projects.push(dummyProject.master);
@@ -196,7 +195,6 @@
}
describe('of <source-file> elements', function () {
-
var install = PluginHandler.getInstaller('source-file');
it('Test #000 : should copy stuff from one location to another by calling common.copyFile', function () {
@@ -251,7 +249,6 @@
it('Test #006 : should write to correct project files when conditions are specified with reference', function () {
var xpath = 'Content[@Include="' + computeResourcePath(resourcereferenceFiles[0]) + '"][@Condition="\'$(Platform)\'==\'x86\'"]';
validateInstalledProjects('resource-file', resourcereferenceFiles[0], xpath, ['all']);
-
});
it('Test #007 : should write to correct project files when conditions are specified with reference', function () {
@@ -526,7 +523,6 @@
});
function validateUninstalledProjects (tag, elementToUninstall, xmlPath, incText, targetConditions, supportedPlatforms) {
-
var projects = copyArray(dummyProject.projects);
projects.push(dummyProject.master);
diff --git a/spec/unit/run.spec.js b/spec/unit/run.spec.js
index 9b85396..c8c729f 100644
--- a/spec/unit/run.spec.js
+++ b/spec/unit/run.spec.js
@@ -77,7 +77,7 @@
return Q.reject(); // rejecting to break run chain
});
- return run.run([ 'node', buildPath ]).then(
+ return run.run(['node', buildPath]).then(
() => fail('Expected promise to be rejected'),
() => expect(buildRun).not.toHaveBeenCalled()
);
@@ -162,7 +162,7 @@
return Q();
});
- return run.run([ 'node', buildPath, '--phone', '--break' ])
+ return run.run(['node', buildPath, '--phone', '--break'])
.then(() => {
expect(build).toHaveBeenCalled();
expect(deployToPhone).toHaveBeenCalled();
@@ -204,7 +204,7 @@
return Q();
});
- return run.run([ 'node', buildPath ])
+ return run.run(['node', buildPath])
.finally(function () {
expect(build).toHaveBeenCalled();
expect(deployToDesktop).toHaveBeenCalled();
@@ -240,7 +240,6 @@
});
it('spec.8 should accept --archs parameter either as cli or as platform arg', function () {
-
spyOn(utils, 'isCordovaProject').and.returnValue(true);
spyOn(packages, 'getPackage').and.returnValue(Q({ arch: 'arm' }));
spyOn(packages, 'deployToDesktop').and.returnValue(Q());
@@ -263,7 +262,6 @@
});
it('spec.9 should fall back to anycpu if --archs parameter is not specified', function () {
-
spyOn(utils, 'isCordovaProject').and.returnValue(true);
spyOn(packages, 'getPackage').and.returnValue(Q({ arch: 'anycpu' }));
spyOn(packages, 'deployToDesktop').and.returnValue(Q());
diff --git a/template/cordova/Api.js b/template/cordova/Api.js
index b8103ca..c316444 100644
--- a/template/cordova/Api.js
+++ b/template/cordova/Api.js
@@ -147,7 +147,6 @@
* platform's file structure and other properties of platform.
*/
Api.prototype.getPlatformInfo = function () {
-
var result = {};
result.locations = this.locations;
result.root = this.root;
@@ -199,7 +198,6 @@
* CordovaError instance.
*/
Api.prototype.addPlugin = function (plugin, installOptions) {
-
var self = this;
// We need to use custom PluginInfo to trigger windows-specific processing
diff --git a/template/cordova/build b/template/cordova/build
index 5ed8a3c..0d5137c 100644
--- a/template/cordova/build
+++ b/template/cordova/build
@@ -68,13 +68,13 @@
// Do some basic argument parsing
var buildOpts = nopt({
- 'silent': Boolean,
- 'verbose': Boolean,
- 'debug': Boolean,
- 'release': Boolean,
- 'nobuild': Boolean,
- 'buildConfig': path,
- 'buildFlag': [String, Array]
+ silent: Boolean,
+ verbose: Boolean,
+ debug: Boolean,
+ release: Boolean,
+ nobuild: Boolean,
+ buildConfig: path,
+ buildFlag: [String, Array]
}, { d: '--verbose', r: '--release' });
// Make buildOptions compatible with PlatformApi build method spec
diff --git a/template/cordova/clean b/template/cordova/clean
index fd283db..9480719 100644
--- a/template/cordova/clean
+++ b/template/cordova/clean
@@ -31,9 +31,9 @@
// Do some basic argument parsing
var opts = nopt({
- 'verbose': Boolean,
- 'silent': Boolean
-}, { 'd': '--verbose' });
+ verbose: Boolean,
+ silent: Boolean
+}, { d: '--verbose' });
// Make buildOptions compatible with PlatformApi clean method spec
opts.argv = opts.argv.original;
diff --git a/template/cordova/lib/AppxManifest.js b/template/cordova/lib/AppxManifest.js
index b2b7e90..372fb41 100644
--- a/template/cordova/lib/AppxManifest.js
+++ b/template/cordova/lib/AppxManifest.js
@@ -36,21 +36,21 @@
'phoneCall', 'blockedChatMessages', 'objects3D'];
var KNOWN_ORIENTATIONS = {
- 'default': ['portrait', 'landscape', 'landscapeFlipped'],
- 'portrait': ['portrait'],
- 'landscape': ['landscape', 'landscapeFlipped']
+ default: ['portrait', 'landscape', 'landscapeFlipped'],
+ portrait: ['portrait'],
+ landscape: ['landscape', 'landscapeFlipped']
};
var MANIFESTS = {
- 'windows': {
+ windows: {
'8.1.0': 'package.windows.appxmanifest',
'10.0.0': 'package.windows10.appxmanifest'
},
- 'phone': {
+ phone: {
'8.1.0': 'package.phone.appxmanifest',
'10.0.0': 'package.windows10.appxmanifest'
},
- 'all': {
+ all: {
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'],
'10.0.0': 'package.windows10.appxmanifest'
}
@@ -113,7 +113,6 @@
* @return {AppxManifest|Win10AppxManifest} Manifest instance
*/
AppxManifest.get = function (fileName, ignoreCache) {
-
if (!ignoreCache && manifestCache[fileName]) {
return manifestCache[fileName];
}
@@ -289,7 +288,6 @@
return description && description.text;
},
setDescription: function (text) {
-
var description = properties.find('./Description');
if (!text || text.length === 0) {
@@ -617,7 +615,6 @@
* appxmanifest
*/
function sortCapabilities (manifest) {
-
// removes namespace prefix (m3:Capability -> Capability)
// this is required since elementtree returns qualified name with namespace
function extractLocalName (tag) {
diff --git a/template/cordova/lib/ConfigChanges.js b/template/cordova/lib/ConfigChanges.js
index c6f7e21..1723f22 100644
--- a/template/cordova/lib/ConfigChanges.js
+++ b/template/cordova/lib/ConfigChanges.js
@@ -39,7 +39,6 @@
* need to be removed or added to the file
*/
PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
-
// Create a copy to avoid modification of original munge
var mungeCopy = cloneObject(munge);
var capabilities = mungeCopy.parents[CAPS_SELECTOR];
@@ -93,7 +92,6 @@
*/
function getUniqueCapabilities (capabilities) {
return capabilities.reduce(function (uniqueCaps, currCap) {
-
var isRepeated = uniqueCaps.some(function (cap) {
return getCapabilityName(cap) === getCapabilityName(currCap);
});
@@ -133,7 +131,6 @@
* @return {Object} A list with 'uap'-prefixed capabilities
*/
function generateUapCapabilities (capabilities) {
-
function hasCapabilityChange (change) {
return /^\s*<(\w+:)?(Device)?Capability\s/.test(change.xml);
}
@@ -157,7 +154,6 @@
.filter(hasCapabilityChange)
// ... and create a duplicate with 'uap:' prefix
.map(createPrefixedCapabilityChange);
-
}
exports.PlatformMunger = PlatformMunger;
diff --git a/template/cordova/lib/ConfigParser.js b/template/cordova/lib/ConfigParser.js
index e80521c..2dd6101 100644
--- a/template/cordova/lib/ConfigParser.js
+++ b/template/cordova/lib/ConfigParser.js
@@ -171,7 +171,7 @@
// Returns the widget defaultLocale
WindowsConfigParser.prototype.defaultLocale = function () {
- return this.doc.getroot().attrib['defaultlocale'];
+ return this.doc.getroot().attrib.defaultlocale;
};
/**
diff --git a/template/cordova/lib/MSBuildTools.js b/template/cordova/lib/MSBuildTools.js
index b522609..625379d 100644
--- a/template/cordova/lib/MSBuildTools.js
+++ b/template/cordova/lib/MSBuildTools.js
@@ -227,7 +227,6 @@
return this.findAllAvailableVersions()
.then(function (allMsBuildVersions) {
-
var availableVersions = allMsBuildVersions
.filter(function (buildTools) {
// Sanitize input - filter out tools w/ invalid versions
@@ -290,7 +289,7 @@
'12.0': msBuild12TargetsFilter,
'14.0': msBuild14TargetsFilter,
'15.x': msBuild15TargetsFilter,
- '15.5': msBuild155TargetsFilter,
+ '15.5': msBuild155TargetsFilter, // eslint-disable-line quote-props
get: function (version) {
// Apart from exact match also try to get filter for version range
// so we can find for example targets for version '15.1'
@@ -367,7 +366,7 @@
// returns an array of available UAP Versions
// prepare.js
module.exports.getAvailableUAPVersions = function () {
- var programFilesFolder = process.env['ProgramFiles(x86)'] || process.env['ProgramFiles'];
+ var programFilesFolder = process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;
// No Program Files folder found, so we won't be able to find UAP SDK
if (!programFilesFolder) return [];
diff --git a/template/cordova/lib/PluginHandler.js b/template/cordova/lib/PluginHandler.js
index 2231d46..f058c94 100644
--- a/template/cordova/lib/PluginHandler.js
+++ b/template/cordova/lib/PluginHandler.js
@@ -94,7 +94,7 @@
project.removeSDKRef(inc, getTargetConditions(obj));
}
},
- 'framework': {
+ framework: {
install: function (obj, plugin, project, options) {
events.emit('verbose', 'windows framework install :: ' + plugin.id);
@@ -116,7 +116,6 @@
}
project.addReference(dest, getTargetConditions(obj), implementPath);
}
-
},
uninstall: function (obj, plugin, project, options) {
events.emit('verbose', 'windows framework uninstall :: ' + plugin.id);
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index eccb5c8..e40deda 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -48,7 +48,6 @@
// builds cordova-windows application with parameters provided.
// See 'help' function for args list
module.exports.run = function run (buildOptions) {
-
ROOT = this.root || ROOT;
if (!utils.isCordovaProject(this.root)) {
@@ -62,7 +61,6 @@
return MSBuildTools.getLatestMatchingMSBuild(selectedBuildTargets) // get latest msbuild tools
.then(function (result) {
-
var msbuild = result[0];
var myBuildTargets = result[1];
@@ -192,16 +190,16 @@
function parseAndValidateArgs (options) {
// parse and validate args
var args = nopt({
- 'archs': [String],
- 'appx': String,
- 'phone': Boolean,
- 'win': Boolean,
- 'bundle': Boolean,
- 'packageCertificateKeyFile': String,
- 'packageThumbprint': String,
- 'publisherId': String,
- 'buildConfig': String,
- 'buildFlag': [String, Array]
+ archs: [String],
+ appx: String,
+ phone: Boolean,
+ win: Boolean,
+ bundle: Boolean,
+ packageCertificateKeyFile: String,
+ packageThumbprint: String,
+ publisherId: String,
+ buildConfig: String,
+ buildFlag: [String, Array]
}, {}, options.argv, 0);
var config = {};
@@ -327,7 +325,6 @@
}
function buildTargets (config, myBuildTargets, msbuild) {
-
var buildConfigs = [];
var bundleTerms = '';
var hasAnyCpu = false;
diff --git a/template/cordova/lib/deployment.js b/template/cordova/lib/deployment.js
index 080f936..ba9ace0 100644
--- a/template/cordova/lib/deployment.js
+++ b/template/cordova/lib/deployment.js
@@ -121,7 +121,7 @@
DeploymentTool.call(this);
this.targetOsVersion = targetOsVersion;
- var programFilesPath = process.env['ProgramFiles(x86)'] || process.env['ProgramFiles'];
+ var programFilesPath = process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;
this.path = path.join(programFilesPath, 'Microsoft SDKs', 'Windows Phone', 'v' + this.targetOsVersion, 'Tools', 'AppDeploy', 'AppDeployCmd.exe');
}
@@ -210,7 +210,7 @@
DeploymentTool.call(this);
this.targetOsVersion = targetOsVersion;
- var programFilesPath = process.env['ProgramFiles(x86)'] || process.env['ProgramFiles'];
+ var programFilesPath = process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;
this.path = path.join(programFilesPath, 'Windows Kits', '10', 'bin', 'x86', 'WinAppDeployCmd.exe');
}
diff --git a/template/cordova/lib/log.js b/template/cordova/lib/log.js
index ea88d55..a2ca51d 100644
--- a/template/cordova/lib/log.js
+++ b/template/cordova/lib/log.js
@@ -24,6 +24,7 @@
var nopt = require('nopt');
var spawn = require('cordova-common').superspawn.spawn;
+const { CordovaError } = require('cordova-common');
var execSync = require('child_process').execSync;
// paths
@@ -50,8 +51,8 @@
* and prints them to console
*/
module.exports.run = function (args) {
- var knownOpts = { 'minutes': Number, 'dump': Boolean, 'help': Boolean };
- var shortHands = { 'mins': ['--minutes'], 'h': ['--help'] };
+ var knownOpts = { minutes: Number, dump: Boolean, help: Boolean };
+ var shortHands = { mins: ['--minutes'], h: ['--help'] };
var parsedOpts = nopt(knownOpts, shortHands, args, 0);
if (parsedOpts.help) {
@@ -88,7 +89,7 @@
}
}).then(function () {
if (!adminCurrentState && !appTracingCurrentState) {
- throw 'No log channels enabled. Exiting...';
+ throw new CordovaError('No log channels enabled. Exiting...');
}
try {
var config = new ConfigParser(configPath);
@@ -289,7 +290,7 @@
multiLineWhitespace += ' ';
}
- if (event.hasOwnProperty(fieldName) && (typeof event[fieldName] !== 'undefined')) {
+ if (Object.prototype.hasOwnProperty.call(event, fieldName) && (typeof event[fieldName] !== 'undefined')) {
event[fieldName] = event[fieldName].replace(/\n\s*/g, '\n' + multiLineWhitespace);
return ('\n' + fieldShownName + ':' + whitespace + event[fieldName]).replace(/\n$/m, '');
}
diff --git a/template/cordova/lib/package.js b/template/cordova/lib/package.js
index 5386074..a097884 100644
--- a/template/cordova/lib/package.js
+++ b/template/cordova/lib/package.js
@@ -166,12 +166,10 @@
// returns array of available devices names
module.exports.listDevices = function (deploymentTool) {
-
return deploymentTool.enumerateDevices().then(function (deviceList) {
return deviceList.map(function (device) {
return device.toString();
});
-
}, function (e) {
events.emit('error', new Error('Failed to list devices: ' + e));
});
@@ -223,7 +221,6 @@
return utils.getAppStoreUtils().then(function (appStoreUtils) {
return getPackageName(path.join(__dirname, '..', '..')).then(function (pkgname) {
-
var oldArch;
// uninstalls previous application instance (if exists)
events.emit('log', 'Attempting to uninstall previous application version...');
diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js
index f09d08e..1538848 100644
--- a/template/cordova/lib/prepare.js
+++ b/template/cordova/lib/prepare.js
@@ -98,7 +98,7 @@
certificatePropertyElement.text = packageCertificateKeyFile;
propertyGroup.append(certificatePropertyElement);
- var certificateItemElement = new et.Element('None', { 'Include': packageCertificateKeyFile });
+ var certificateItemElement = new et.Element('None', { Include: packageCertificateKeyFile });
itemGroup.append(certificateItemElement);
// packageThumbprint
@@ -114,9 +114,9 @@
defaultLocaleElement.text = defaultLocale;
propertyGroup.append(defaultLocaleElement);
- var buildConfigFileName = buildConfig.buildType === 'release' ?
- path.join(projectRoot, 'CordovaAppRelease.projitems') :
- path.join(projectRoot, 'CordovaAppDebug.projitems');
+ var buildConfigFileName = buildConfig.buildType === 'release'
+ ? path.join(projectRoot, 'CordovaAppRelease.projitems')
+ : path.join(projectRoot, 'CordovaAppDebug.projitems');
fs.writeFileSync(buildConfigFileName, TEMPLATE + buildConfigXML.write({ indent: 2, xml_declaration: false }), 'utf-8');
};
@@ -273,7 +273,6 @@
* Allows WinRT access to origins specified by <allow-navigation href="origin" /> elements.
*/
function applyNavigationWhitelist (config, manifest) {
-
if (manifest.prefix !== 'uap:') {
// This never should happen, but to be sure let's check
throw new Error('AllowNavigation whitelist rules must be applied to Windows 10 appxmanifest only.');
@@ -525,13 +524,12 @@
// Updates manifests to match the app splash screen image types (PNG/JPG/JPEG)
function updateSplashScreenImageExtensions (cordovaProject, locations) {
-
// Saving all extensions used for targets to verify them later
var extensionsUsed = {};
function checkThatExtensionsAreNotMixed () {
for (var target in extensionsUsed) {
- if (extensionsUsed.hasOwnProperty(target)) {
+ if (Object.prototype.hasOwnProperty.call(extensionsUsed, target)) {
var extensionsUsedForTarget = extensionsUsed[target];
// Check that extensions are not mixed:
@@ -584,7 +582,7 @@
manifestSplashScreenMap[MANIFEST_PHONE] = phoneSplashScreen;
for (var manifest in manifestSplashScreenMap) {
- if (manifestSplashScreenMap.hasOwnProperty(manifest)) {
+ if (Object.prototype.hasOwnProperty.call(manifestSplashScreenMap, manifest)) {
var splashScreen = manifestSplashScreenMap[manifest];
if (!splashScreen) {
return;
diff --git a/template/cordova/lib/run.js b/template/cordova/lib/run.js
index a0ac238..5e7f148 100644
--- a/template/cordova/lib/run.js
+++ b/template/cordova/lib/run.js
@@ -40,12 +40,12 @@
// parse arg
var args = nopt({
- 'archs': [String],
- 'phone': Boolean,
- 'win': Boolean,
- 'appx': String,
- 'win10tools': Boolean
- }, { 'r': '--release' }, options.argv, 0);
+ archs: [String],
+ phone: Boolean,
+ win: Boolean,
+ appx: String,
+ win10tools: Boolean
+ }, { r: '--release' }, options.argv, 0);
// Validate args
if (options.debug && options.release) {
@@ -131,7 +131,7 @@
try {
// Check if ran from admin prompt and fail quickly if CLI has administrative permissions
// http://stackoverflow.com/a/11995662/64949
- execSync('net session', { 'stdio': 'ignore' });
+ execSync('net session', { stdio: 'ignore' });
return true;
} catch (e) {
return false;
diff --git a/template/cordova/lib/target-list.js b/template/cordova/lib/target-list.js
index 616e944..87ac566 100644
--- a/template/cordova/lib/target-list.js
+++ b/template/cordova/lib/target-list.js
@@ -35,14 +35,12 @@
console.log(' node target-list.js --started_emulators');
console.log(' node target-list.js --all');
console.log('');
-
}
// Handle help flag
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[0]) > -1) {
help();
} else {
-
var version = '8.1';
if (args.indexOf('--win10') >= 0) {
version = '10.0';
diff --git a/template/cordova/prebuild.js b/template/cordova/prebuild.js
index 0204424..ecf021b 100644
--- a/template/cordova/prebuild.js
+++ b/template/cordova/prebuild.js
@@ -30,20 +30,20 @@
var url = require('url');
var basejsSrcMap = {
- '10': '/www/WinJS/js/base.js',
- '8.1': '//Microsoft.WinJS.2.0/js/base.js',
+ '10': '/www/WinJS/js/base.js', // eslint-disable-line quote-props
+ '8.1': '//Microsoft.WinJS.2.0/js/base.js', // eslint-disable-line quote-props
'phone-8.1': '//Microsoft.Phone.WinJS.2.1/js/base.js'
};
var escapedBasejsSrcMap = {
- '10': '\/www\/WinJS\/js\/base\.js',
- '8.1': '\/\/Microsoft\.WinJS\.2\.0\/js\/base\.js',
+ '10': '\/www\/WinJS\/js\/base\.js', // eslint-disable-line quote-props
+ '8.1': '\/\/Microsoft\.WinJS\.2\.0\/js\/base\.js', // eslint-disable-line quote-props
'phone-8.1': '\/\/Microsoft\.Phone\.WinJS\.2\.1\/js\/base\.js'
};
var basejsSrc = basejsSrcMap[platform];
var appxmanifestMap = {
- '10': 'package.windows10.appxmanifest',
- '8.1': 'package.windows.appxmanifest',
+ '10': 'package.windows10.appxmanifest', // eslint-disable-line quote-props
+ '8.1': 'package.windows.appxmanifest', // eslint-disable-line quote-props
'phone-8.1': 'package.phone.appxmanifest'
};
diff --git a/template/cordova/prepare b/template/cordova/prepare
index d042f00..1fc1edf 100644
--- a/template/cordova/prepare
+++ b/template/cordova/prepare
@@ -32,9 +32,9 @@
// Do some basic argument parsing
var opts = nopt({
- 'verbose': Boolean,
- 'silent': Boolean
-}, { 'd': '--verbose' });
+ verbose: Boolean,
+ silent: Boolean
+}, { d: '--verbose' });
// Make buildOptions compatible with PlatformApi clean method spec
opts.argv = opts.argv.original;
diff --git a/template/cordova/run b/template/cordova/run
index 704b37f..52cdcd5 100644
--- a/template/cordova/run
+++ b/template/cordova/run
@@ -63,15 +63,15 @@
// Do some basic argument parsing
var runOpts = nopt({
- 'silent': Boolean,
- 'verbose': Boolean,
- 'debug': Boolean,
- 'release': Boolean,
- 'nobuild': Boolean,
- 'device': Boolean,
- 'emulator': Boolean,
- 'target': String,
- 'buildConfig': path
+ silent: Boolean,
+ verbose: Boolean,
+ debug: Boolean,
+ release: Boolean,
+ nobuild: Boolean,
+ device: Boolean,
+ emulator: Boolean,
+ target: String,
+ buildConfig: path
}, { d: '--verbose', r: '--release' });
// Make buildOptions compatible with PlatformApi build method spec