You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/11/15 02:06:14 UTC
[cordova-lib] branch master updated: refactor: eslint setup (#822)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
The following commit(s) were added to refs/heads/master by this push:
new 5cc0a79 refactor: eslint setup (#822)
5cc0a79 is described below
commit 5cc0a79b5897a62d25097233e9cbe89f41bb1264
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Fri Nov 15 11:06:05 2019 +0900
refactor: eslint setup (#822)
* refactor: eslint setup
* replace dependencies with @cordova/eslint-config
* update eslint config
* eslint corrections
* chore: readded linebreak-style & promise/catch-or-return
---
.eslintrc.yml | 10 +---
integration-tests/.eslintrc.yml | 6 +--
integration-tests/HooksRunner.spec.js | 2 +-
integration-tests/fetch.spec.js | 10 ++--
integration-tests/pkgJson.spec.js | 8 +--
integration-tests/platform.spec.js | 3 +-
integration-tests/plugman_fetch.spec.js | 1 -
integration-tests/plugman_uninstall.spec.js | 12 ++---
package.json | 12 ++---
spec/.eslintrc.yml | 6 +--
spec/cordova/build.spec.js | 4 +-
spec/cordova/emulate.spec.js | 2 +-
spec/cordova/platform/addHelper.spec.js | 14 +++--
spec/cordova/platform/remove.spec.js | 2 +-
spec/cordova/plugin/add.getFetchVersion.spec.js | 68 ++++++++++++-------------
spec/cordova/plugin/add.spec.js | 55 ++++++++++----------
spec/cordova/plugin/index.spec.js | 9 ++--
spec/cordova/plugin/list.spec.js | 2 +-
spec/cordova/plugin/remove.spec.js | 2 +-
spec/cordova/prepare.spec.js | 5 +-
spec/cordova/restore-util.spec.js | 7 ++-
spec/cordova/run.spec.js | 12 ++---
spec/cordova/serve.spec.js | 7 +--
spec/cordova/util.spec.js | 2 -
spec/helpers.js | 4 +-
spec/hooks/Context.spec.js | 1 -
spec/plugman/add_platform.spec.js | 1 -
spec/plugman/create.spec.js | 1 -
spec/plugman/install.spec.js | 14 ++---
spec/plugman/util/dependencies.spec.js | 10 ++--
spec/plugman/util/metadata.spec.js | 1 -
spec/project-test-helpers.js | 1 +
src/cordova/emulate.js | 5 +-
src/cordova/plugin/add.js | 2 +-
src/cordova/restore-util.js | 1 -
src/cordova/run.js | 5 +-
src/cordova/serve.js | 4 +-
src/cordova/targets.js | 4 +-
src/plugman/create.js | 2 +-
src/plugman/fetch.js | 2 -
src/plugman/install.js | 21 ++------
src/plugman/platform.js | 1 -
src/plugman/platform_operation.js | 2 +-
src/plugman/uninstall.js | 4 +-
src/plugman/util/default-engines.js | 26 +++++-----
45 files changed, 159 insertions(+), 214 deletions(-)
diff --git a/.eslintrc.yml b/.eslintrc.yml
index a518038..3c16de2 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,13 +1,7 @@
root: true
-extends: semistandard
+extends: '@cordova/eslint-config/node'
+
rules:
- indent:
- - error
- - 4
- camelcase: off
- padded-blocks: off
- operator-linebreak: off
- no-throw-literal: off
linebreak-style:
- error
- unix
diff --git a/integration-tests/.eslintrc.yml b/integration-tests/.eslintrc.yml
index 77cb525..f2c42a4 100644
--- a/integration-tests/.eslintrc.yml
+++ b/integration-tests/.eslintrc.yml
@@ -1,4 +1,2 @@
-env:
- jasmine: true
-rules:
- prefer-promise-reject-errors: off
+root: true
+extends: '@cordova/eslint-config/node-tests'
diff --git a/integration-tests/HooksRunner.spec.js b/integration-tests/HooksRunner.spec.js
index e29096e..d9e7a81 100644
--- a/integration-tests/HooksRunner.spec.js
+++ b/integration-tests/HooksRunner.spec.js
@@ -280,7 +280,7 @@ describe('HooksRunner', function () {
const expectedContext = toPlainObject({
cordova: {
- platforms: [ 'android' ],
+ platforms: ['android'],
plugins: [testPlugin],
version: require('../package').version
},
diff --git a/integration-tests/fetch.spec.js b/integration-tests/fetch.spec.js
index b13ed97..06e93dc 100644
--- a/integration-tests/fetch.spec.js
+++ b/integration-tests/fetch.spec.js
@@ -26,10 +26,10 @@ const TIMEOUT = 60 * 1000;
var plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
var plugins = {
- 'Test1': path.join(plugins_dir, 'dependencies', 'Test1'),
- 'Test2': path.join(plugins_dir, 'dependencies', 'Test2'),
- 'Test3': path.join(plugins_dir, 'dependencies', 'Test3'),
- 'Test4': path.join(plugins_dir, 'dependencies', 'Test4')
+ Test1: path.join(plugins_dir, 'dependencies', 'Test1'),
+ Test2: path.join(plugins_dir, 'dependencies', 'Test2'),
+ Test3: path.join(plugins_dir, 'dependencies', 'Test3'),
+ Test4: path.join(plugins_dir, 'dependencies', 'Test4')
};
describe('end-to-end plugin dependency tests', function () {
@@ -82,7 +82,7 @@ describe('end-to-end plugin dependency tests', function () {
})
.then(function () {
expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
- return cordova.plugin('add', plugins['Test1'], { 'force': true });
+ return cordova.plugin('add', plugins['Test1'], { force: true });
})
.then(function () {
expect(path.join(pluginsDir, 'Test1')).toExist();
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index dd3bdcb..87fcf67 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -410,7 +410,7 @@ describe('pkgJson', function () {
const PLATFORM = 'ios';
const PLUGIN = 'cordova-plugin-splashscreen';
- setPkgJson('cordova.platforms', [ PLATFORM ]);
+ setPkgJson('cordova.platforms', [PLATFORM]);
setPkgJson('dependencies', {
[PLUGIN]: '^3.2.2',
[`cordova-${PLATFORM}`]: '^4.5.4'
@@ -424,7 +424,7 @@ describe('pkgJson', function () {
return cordova.platform('add', PLATFORM, { save: true }).then(function () {
// No change to pkg.json platforms or spec for ios.
- expect(getPkgJson('cordova.platforms')).toEqual([ PLATFORM ]);
+ expect(getPkgJson('cordova.platforms')).toEqual([PLATFORM]);
// Config.xml and ios/cordova/version check.
const version = platformVersion(PLATFORM);
// Check that pkg.json and ios/cordova/version versions "satisfy" each other.
@@ -476,7 +476,7 @@ describe('pkgJson', function () {
const PLATFORM = 'ios';
const PLUGIN = 'cordova-plugin-splashscreen';
- setPkgJson('cordova.platforms', [ PLATFORM ]);
+ setPkgJson('cordova.platforms', [PLATFORM]);
setPkgJson('dependencies', {
[`cordova-${PLATFORM}`]: '^4.2.1',
[PLUGIN]: '^3.2.2'
@@ -490,7 +490,7 @@ describe('pkgJson', function () {
return cordova.platform('add', `${PLATFORM}@4.5.4`, { save: true }).then(function () {
// Pkg.json has ios.
- expect(getPkgJson('cordova.platforms')).toEqual([ PLATFORM ]);
+ expect(getPkgJson('cordova.platforms')).toEqual([PLATFORM]);
}).then(function () {
return cordova.plugin('add', `${PLUGIN}@4.0.0`, { save: true });
}).then(function () {
diff --git a/integration-tests/platform.spec.js b/integration-tests/platform.spec.js
index 187035a..1f5b813 100644
--- a/integration-tests/platform.spec.js
+++ b/integration-tests/platform.spec.js
@@ -91,7 +91,6 @@ describe('cordova/platform end-to-end', () => {
expect(testPlatformDir).not.toExist();
expect(installedPlatforms()).toEqual([]);
});
-
});
it('Test 002 : should install plugins correctly while adding platform', () => {
@@ -128,7 +127,7 @@ describe('cordova/platform end-to-end', () => {
it('Test 007 : should add and remove platform from node_modules directory', () => {
return Promise.resolve()
.then(() => {
- return cordova.platform('add', 'browser', { 'save': true });
+ return cordova.platform('add', 'browser', { save: true });
})
.then(() => {
expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
diff --git a/integration-tests/plugman_fetch.spec.js b/integration-tests/plugman_fetch.spec.js
index ac17410..77d2551 100644
--- a/integration-tests/plugman_fetch.spec.js
+++ b/integration-tests/plugman_fetch.spec.js
@@ -126,7 +126,6 @@ describe('fetch', function () {
});
describe('fetch recursive error CB-8809', function () {
-
var srcDir = path.join(plugins_dir, 'recursivePlug');
var appDir = path.join(plugins_dir, 'recursivePlug', 'demo');
fetch.__set__('fetch', function (pluginDir) {
diff --git a/integration-tests/plugman_uninstall.spec.js b/integration-tests/plugman_uninstall.spec.js
index a4a3ebf..7b77ef3 100644
--- a/integration-tests/plugman_uninstall.spec.js
+++ b/integration-tests/plugman_uninstall.spec.js
@@ -35,8 +35,8 @@ const plugins_install_dir = path.join(project, 'cordova/plugins');
const plugins_dir = path.join(__dirname, '../spec/plugman/plugins');
const plugins = {
'org.test.plugins.dummyplugin': path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
- 'A': path.join(plugins_dir, 'dependencies', 'A'),
- 'C': path.join(plugins_dir, 'dependencies', 'C')
+ A: path.join(plugins_dir, 'dependencies', 'A'),
+ C: path.join(plugins_dir, 'dependencies', 'C')
};
function setupProject (name) {
@@ -97,7 +97,6 @@ describe('plugman/uninstall', () => {
});
describe('success', function () {
-
it('Test 002 : should get PlatformApi instance for platform and invoke its\' removePlugin method', function () {
const platformApi = { removePlugin: jasmine.createSpy('removePlugin').and.returnValue(Promise.resolve()) };
const getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
@@ -139,9 +138,9 @@ describe('plugman/uninstall', () => {
}, Promise.resolve());
}
- return validateReturnedResultFor([ true, {}, [], 'foo', function () {} ], true)
+ return validateReturnedResultFor([true, {}, [], 'foo', function () {}], true)
.then(function () {
- return validateReturnedResultFor([ false, null, undefined, '' ], false);
+ return validateReturnedResultFor([false, null, undefined, ''], false);
});
});
@@ -175,9 +174,7 @@ describe('plugman/uninstall', () => {
});
describe('uninstallPlugin', function () {
-
describe('with dependencies', function () {
-
it('Test 006 : should delete all dependent plugins', function () {
setupProject('uninstall.test');
@@ -242,7 +239,6 @@ describe('plugman/uninstall', () => {
});
describe('uninstall', function () {
-
beforeEach(() => {
setupProject('uninstall.test');
});
diff --git a/package.json b/package.json
index a15d019..0577a3d 100644
--- a/package.json
+++ b/package.json
@@ -34,24 +34,18 @@
"semver": "^6.3.0"
},
"devDependencies": {
+ "@cordova/eslint-config": "^2.0.0",
"codecov": "^3.2.0",
"cordova-android": "^8.1.0",
"delay": "^4.1.0",
- "eslint": "^5.15.1",
- "eslint-config-semistandard": "^13.0.0",
- "eslint-config-standard": "^12.0.0",
- "eslint-plugin-import": "^2.16.0",
- "eslint-plugin-node": "^8.0.1",
- "eslint-plugin-promise": "^4.0.1",
- "eslint-plugin-standard": "^4.0.0",
"jasmine": "^3.5.0",
"jasmine-spec-reporter": "^4.2.1",
"nyc": "^14.1.1",
"rewire": "^4.0.1"
},
"scripts": {
- "test": "npm run eslint && npm run unit-tests && npm run e2e-tests",
- "eslint": "eslint .",
+ "test": "npm run lint && npm run unit-tests && npm run e2e-tests",
+ "lint": "eslint .",
"unit-tests": "jasmine \"spec/**/*.spec.js\"",
"cover": "nyc -x spec/ -x integration-tests/ npm test",
"report-coverage": "nyc report -r text-lcov > coverage.lcov && codecov",
diff --git a/spec/.eslintrc.yml b/spec/.eslintrc.yml
index 77cb525..f2c42a4 100644
--- a/spec/.eslintrc.yml
+++ b/spec/.eslintrc.yml
@@ -1,4 +1,2 @@
-env:
- jasmine: true
-rules:
- prefer-promise-reject-errors: off
+root: true
+extends: '@cordova/eslint-config/node-tests'
diff --git a/spec/cordova/build.spec.js b/spec/cordova/build.spec.js
index ad6d02e..ab397c8 100644
--- a/spec/cordova/build.spec.js
+++ b/spec/cordova/build.spec.js
@@ -68,7 +68,7 @@ describe('build command', function () {
describe('success', function () {
it('Test 003 : should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function () {
return cordovaBuild(['android', 'ios']).then(function () {
- var opts = Object({ platforms: [ 'android', 'ios' ], verbose: false, options: Object({ }) });
+ var opts = Object({ platforms: ['android', 'ios'], verbose: false, options: Object({ }) });
expect(cordovaPrepare).toHaveBeenCalledWith(opts);
expect(cordovaCompile).toHaveBeenCalledWith(opts);
});
@@ -93,7 +93,7 @@ describe('build command', function () {
it('Test 007 : should fire after hooks through the hooker module', function () {
return cordovaBuild('android').then(function () {
expect(HooksRunner.prototype.fire.calls.argsFor(1))
- .toEqual([ 'after_build', { platforms: [ 'android' ], verbose: false, options: {} } ]);
+ .toEqual(['after_build', { platforms: ['android'], verbose: false, options: {} }]);
});
});
});
diff --git a/spec/cordova/emulate.spec.js b/spec/cordova/emulate.spec.js
index 257331c..28d20fb 100644
--- a/spec/cordova/emulate.spec.js
+++ b/spec/cordova/emulate.spec.js
@@ -99,7 +99,7 @@ describe('emulate command', function () {
const expectedBuildOptions = Object.assign({ couldBeModified: 'insideBuild' }, baseOptions);
return cordovaEmulate({ platforms: ['blackberry10'], options: { password: '1q1q' } })
.then(function () {
- expect(cordovaPrepare).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: expectedBuildOptions, verbose: false });
+ expect(cordovaPrepare).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: expectedBuildOptions, verbose: false });
expect(platformApi.build).toHaveBeenCalledWith(expectedBuildOptions);
expect(platformApi.run).toHaveBeenCalledWith(expectedRunOptions);
});
diff --git a/spec/cordova/platform/addHelper.spec.js b/spec/cordova/platform/addHelper.spec.js
index c395d58..6ecd500 100644
--- a/spec/cordova/platform/addHelper.spec.js
+++ b/spec/cordova/platform/addHelper.spec.js
@@ -31,7 +31,7 @@ describe('cordova/platform/addHelper', function () {
beforeEach(function () {
fake_platform = {
- 'platform': 'atari'
+ platform: 'atari'
};
package_json_mock = {
cordova: {},
@@ -185,7 +185,6 @@ describe('cordova/platform/addHelper', function () {
});
describe('platform api invocation', function () {
-
it('should invoke the createPlatform platform API method when adding a platform, providing destination location, parsed config file and platform detail options as arguments', function () {
return platform_addHelper('add', hooks_mock, projectRoot, ['ios'], { save: true, restoring: true }).then(function (result) {
expect(platform_api_mock.createPlatform).toHaveBeenCalled();
@@ -202,12 +201,11 @@ describe('cordova/platform/addHelper', function () {
});
describe('after platform api invocation', function () {
-
describe('when the restoring option is not provided', function () {
it('should invoke preparePlatforms twice (?!?), once before installPluginsForNewPlatforms and once after... ?!', function () {
const preparePlatforms = platform_addHelper.__get__('preparePlatforms');
return platform_addHelper('add', hooks_mock, projectRoot, ['atari'], { save: true }).then(function (result) {
- expect(preparePlatforms).toHaveBeenCalledWith([ 'atari' ], '/some/path', { searchpath: undefined });
+ expect(preparePlatforms).toHaveBeenCalledWith(['atari'], '/some/path', { searchpath: undefined });
});
});
});
@@ -228,7 +226,7 @@ describe('cordova/platform/addHelper', function () {
return false;
}
});
- package_json_mock.cordova = { 'platforms': ['ios'] };
+ package_json_mock.cordova = { platforms: ['ios'] };
cordova_util.requireNoCache.and.returnValue(package_json_mock);
return platform_addHelper('add', hooks_mock, projectRoot, ['android'], { save: true, restoring: true }).then(function (result) {
expect(fs.writeFileSync).toHaveBeenCalled();
@@ -237,7 +235,7 @@ describe('cordova/platform/addHelper', function () {
it('should use pkgJson version devDependencies, if dependencies are undefined', function () {
package_json_mock.dependencies = undefined;
- package_json_mock.cordova = { 'platforms': ['ios'] };
+ package_json_mock.cordova = { platforms: ['ios'] };
package_json_mock.devDependencies['ios'] = {};
cordova_util.requireNoCache.and.returnValue(package_json_mock);
fs.existsSync.and.callFake(function (filePath) {
@@ -251,7 +249,7 @@ describe('cordova/platform/addHelper', function () {
});
it('should only write the package.json file if it was modified', function () {
- package_json_mock.cordova = { 'platforms': ['ios'] };
+ package_json_mock.cordova = { platforms: ['ios'] };
cordova_util.requireNoCache.and.returnValue(package_json_mock);
return platform_addHelper('add', hooks_mock, projectRoot, ['ios'], { save: true, restoring: true }).then(function (result) {
expect(fs.writeFileSync).not.toHaveBeenCalled();
@@ -272,7 +270,7 @@ describe('cordova/platform/addHelper', function () {
});
describe('errors', function () {
it('should reject the promise should fetch fail', function () {
- fetch_mock.and.returnValue(Promise.reject('fetch has failed, rejecting promise'));
+ fetch_mock.and.returnValue(Promise.reject(new Error('fetch has failed, rejecting promise')));
return platform_addHelper.downloadPlatform(projectRoot, 'android', '67').then(function () {
fail('success handler unexpectedly invoked');
}, function (e) {
diff --git a/spec/cordova/platform/remove.spec.js b/spec/cordova/platform/remove.spec.js
index 9c1a7b3..8aca614 100644
--- a/spec/cordova/platform/remove.spec.js
+++ b/spec/cordova/platform/remove.spec.js
@@ -86,7 +86,7 @@ describe('cordova/platform/remove', function () {
});
it('should remove from package.json', function () {
- package_json_mock.cordova = { 'platforms': ['atari'] };
+ package_json_mock.cordova = { platforms: ['atari'] };
cordova_util.requireNoCache.and.returnValue(package_json_mock);
spyOn(fs, 'readFileSync').and.returnValue('file');
fs.existsSync.and.callFake(function (filePath) {
diff --git a/spec/cordova/plugin/add.getFetchVersion.spec.js b/spec/cordova/plugin/add.getFetchVersion.spec.js
index 00c667b..8489f05 100644
--- a/spec/cordova/plugin/add.getFetchVersion.spec.js
+++ b/spec/cordova/plugin/add.getFetchVersion.spec.js
@@ -84,10 +84,10 @@ describe('plugin fetching version selection', () => {
events.on('warn', unmetRequirementsCollector);
testPlugin = {
- 'version': '2.3.0',
- 'name': 'test-plugin',
- 'engines': { 'cordovaDependencies': {} },
- 'versions': [
+ version: '2.3.0',
+ name: 'test-plugin',
+ engines: { cordovaDependencies: {} },
+ versions: [
'0.0.2',
'0.7.0',
'1.0.0',
@@ -132,7 +132,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.3.0');
- expectUnmetRequirements([ getPlatformRequirement('6.1.1') ]);
+ expectUnmetRequirements([getPlatformRequirement('6.1.1')]);
});
});
@@ -149,7 +149,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe(null);
- expectUnmetRequirements([ getPlatformRequirement('6.1.1') ]);
+ expectUnmetRequirements([getPlatformRequirement('6.1.1')]);
});
});
@@ -162,7 +162,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.7.1');
- expectUnmetRequirements([ getPlatformRequirement('~5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('~5.0.0')]);
});
});
@@ -173,7 +173,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('0.7.0');
- expectUnmetRequirements([ getPlatformRequirement('~5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('~5.0.0')]);
});
});
@@ -184,7 +184,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe(null);
- expectUnmetRequirements([ getPlatformRequirement('~5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('~5.0.0')]);
});
});
@@ -207,7 +207,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe(null);
- expectUnmetRequirements([ getPlatformRequirement('<2.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('<2.0.0')]);
});
});
@@ -219,7 +219,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.0.0');
- expectUnmetRequirements([ getPlatformRequirement('>5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('>5.0.0')]);
});
});
@@ -252,7 +252,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.1.0');
- expectUnmetRequirements([ getPlatformRequirement('6.1.1') ]);
+ expectUnmetRequirements([getPlatformRequirement('6.1.1')]);
});
});
@@ -265,20 +265,20 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('2.0.0');
- expectUnmetRequirements([ getPluginRequirement('6.1.1') ]);
+ expectUnmetRequirements([getPluginRequirement('6.1.1')]);
});
});
it('Test 013 : should respect cordova constraints', () => {
testPlugin.engines.cordovaDependencies = {
- '0.0.0': { 'cordova': '>1.0.0' },
- '1.1.3': { 'cordova': '<3.0.0 || >4.0.0' },
- '2.3.0': { 'cordova': '6.1.1' }
+ '0.0.0': { cordova: '>1.0.0' },
+ '1.1.3': { cordova: '<3.0.0 || >4.0.0' },
+ '2.3.0': { cordova: '6.1.1' }
};
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.1.0');
- expectUnmetRequirements([ getCordovaRequirement('6.1.1') ]);
+ expectUnmetRequirements([getCordovaRequirement('6.1.1')]);
});
});
@@ -291,7 +291,7 @@ describe('plugin fetching version selection', () => {
// Should not return 2.0.0-rc.2
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.7.1');
- expectUnmetRequirements([ getPlatformRequirement('>5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('>5.0.0')]);
});
});
@@ -306,8 +306,8 @@ describe('plugin fetching version selection', () => {
it('Test 016 : should not fail if there is no cordovaDependencies in the engines', () => {
testPlugin.engines = {
- 'node': '>7.0.0',
- 'npm': '~2.0.0'
+ node: '>7.0.0',
+ npm: '~2.0.0'
};
return getFetchVersion(testPlugin).then(version => {
@@ -325,7 +325,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.7.1');
- expectUnmetRequirements([ getPlatformRequirement('~5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('~5.0.0')]);
});
});
@@ -344,12 +344,12 @@ describe('plugin fetching version selection', () => {
it('Test 019 : should ignore badly typed constraint entries', () => {
testPlugin.engines.cordovaDependencies = {
- '0.0.2': { 'cordova': 1 },
- '0.7.0': { 'cordova': {} },
- '1.0.0': { 'cordova': undefined },
+ '0.0.2': { cordova: 1 },
+ '0.7.0': { cordova: {} },
+ '1.0.0': { cordova: undefined },
'1.1.3': { 8: '5.0.0' },
- '1.3.0': { 'cordova': [] },
- '1.7.1': { 'cordova': null }
+ '1.3.0': { cordova: [] },
+ '1.7.1': { cordova: null }
};
return getFetchVersion(testPlugin).then(version => {
@@ -361,33 +361,33 @@ describe('plugin fetching version selection', () => {
it('Test 020 : should ignore bad semver versions', () => {
testPlugin.engines.cordovaDependencies = {
'0.0.0': { 'cordova-android': '5.0.0' },
- 'notAVersion': { 'cordova-android': '3.1.0' },
+ notAVersion: { 'cordova-android': '3.1.0' },
'^1.1.2': { 'cordova-android': '3.1.0' },
'<=1.3.0': { 'cordova-android': '3.1.0' },
'1.0': { 'cordova-android': '3.1.0' },
- '2': { 'cordova-android': '3.1.0' }
+ 2: { 'cordova-android': '3.1.0' }
};
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe(null);
- expectUnmetRequirements([ getPlatformRequirement('5.0.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('5.0.0')]);
});
});
it('Test 021 : should not fail if there are bad semver versions', () => {
testPlugin.engines.cordovaDependencies = {
- 'notAVersion': { 'cordova-android': '3.1.0' },
+ notAVersion: { 'cordova-android': '3.1.0' },
'^1.1.2': { 'cordova-android': '3.1.0' },
'<=1.3.0': { 'cordova-android': '3.1.0' },
'1.0.0': { 'cordova-android': '~3' }, // Good semver
'2.0.0': { 'cordova-android': '5.1.0' }, // Good semver
'1.0': { 'cordova-android': '3.1.0' },
- '2': { 'cordova-android': '3.1.0' }
+ 2: { 'cordova-android': '3.1.0' }
};
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.7.1');
- expectUnmetRequirements([ getPlatformRequirement('5.1.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('5.1.0')]);
});
});
@@ -396,7 +396,7 @@ describe('plugin fetching version selection', () => {
'1.7.0': {
'cordova-android': '>5.1.0',
'ca.filmaj.AndroidPlugin': '3.1.0',
- 'cordova': '3.4.2'
+ cordova: '3.4.2'
}
};
@@ -438,7 +438,7 @@ describe('plugin fetching version selection', () => {
return getFetchVersion(testPlugin).then(version => {
expect(version).toBe('1.3.0');
- expectUnmetRequirements([ getPlatformRequirement('>5.1.0') ]);
+ expectUnmetRequirements([getPlatformRequirement('>5.1.0')]);
});
});
});
diff --git a/spec/cordova/plugin/add.spec.js b/spec/cordova/plugin/add.spec.js
index 99e9141..da388a1 100644
--- a/spec/cordova/plugin/add.spec.js
+++ b/spec/cordova/plugin/add.spec.js
@@ -66,7 +66,6 @@ describe('cordova/plugin/add', function () {
});
describe('main method', function () {
-
beforeEach(function () {
spyOn(add, 'determinePluginTarget').and.callFake(function (projRoot, cfg, target, opts) {
return Promise.resolve(target);
@@ -90,7 +89,7 @@ describe('cordova/plugin/add', function () {
});
});
it('should error out if any mandatory plugin variables are not provided', function () {
- plugin_info.getPreferences.and.returnValue({ 'some': undefined });
+ plugin_info.getPreferences.and.returnValue({ some: undefined });
return add(projectRoot, hook_mock, { plugins: ['cordova-plugin-device'] }).then(function () {
fail('Expected promise to be rejected');
@@ -113,16 +112,16 @@ describe('cordova/plugin/add', function () {
});
});
it('should retrieve any variables for the plugin from config.xml and add them as cli variables only when the variables were not already provided via options', function () {
- var cfg_plugin_variables = { 'some': 'variable' };
+ var cfg_plugin_variables = { some: 'variable' };
Cfg_parser_mock.prototype.getPlugin.and.callFake(function (plugin_id) {
- return { 'variables': cfg_plugin_variables };
+ return { variables: cfg_plugin_variables };
});
return add(projectRoot, hook_mock, { plugins: ['cordova-plugin-device'] }).then(function () {
// confirm cli_variables are undefind
- expect(add.determinePluginTarget).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ 'variables': undefined }));
+ expect(add.determinePluginTarget).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ variables: undefined }));
expect(plugman.install).toHaveBeenCalled();
// check that the plugin variables from config.xml got added to cli_variables
- expect(plugman.install).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ 'cli_variables': cfg_plugin_variables }));
+ expect(plugman.install).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ cli_variables: cfg_plugin_variables }));
});
});
it('should invoke plugman.install for each platform added to the project', function () {
@@ -131,7 +130,7 @@ describe('cordova/plugin/add', function () {
});
});
it('should save plugin variable information to package.json file (if exists)', function () {
- var cli_plugin_variables = { 'some': 'variable' };
+ var cli_plugin_variables = { some: 'variable' };
fs.existsSync.and.callFake(function (file_path) {
if (path.basename(file_path) === 'package.json') {
@@ -143,21 +142,21 @@ describe('cordova/plugin/add', function () {
spyOn(fs, 'readFileSync').and.returnValue('file');
return add(projectRoot, hook_mock, { plugins: ['cordova-plugin-device'], cli_variables: cli_plugin_variables, save: 'true' }).then(function () {
- expect(fs.writeFileSync).toHaveBeenCalledWith(jasmine.any(String), JSON.stringify({ 'cordova': { 'plugins': { 'cordova-plugin-device': cli_plugin_variables } }, 'dependencies': {}, 'devDependencies': {} }, null, 2), 'utf8');
+ expect(fs.writeFileSync).toHaveBeenCalledWith(jasmine.any(String), JSON.stringify({ cordova: { plugins: { 'cordova-plugin-device': cli_plugin_variables } }, dependencies: {}, devDependencies: {} }, null, 2), 'utf8');
});
});
it('should overwrite plugin information in config.xml after a successful installation', function () {
- var cfg_plugin_variables = { 'some': 'variable' };
- var cli_plugin_variables = { 'some': 'new_variable' };
+ var cfg_plugin_variables = { some: 'variable' };
+ var cli_plugin_variables = { some: 'new_variable' };
Cfg_parser_mock.prototype.getPlugin.and.callFake(function (plugin_id) {
- return { 'variables': cfg_plugin_variables };
+ return { variables: cfg_plugin_variables };
});
return add(projectRoot, hook_mock, { plugins: ['cordova-plugin-device'], cli_variables: cli_plugin_variables, save: 'true' }).then(function () {
// confirm cli_variables got passed through
- expect(add.determinePluginTarget).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ 'variables': cli_plugin_variables }));
+ expect(add.determinePluginTarget).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ variables: cli_plugin_variables }));
// check that the plugin variables from config.xml got added to cli_variables
- expect(plugman.install).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ 'cli_variables': cli_plugin_variables }));
+ expect(plugman.install).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.anything(), jasmine.objectContaining({ cli_variables: cli_plugin_variables }));
});
});
it('should invoke preparePlatforms if plugman.install returned a falsey value', function () {
@@ -290,14 +289,14 @@ describe('cordova/plugin/add', function () {
describe('with no version inferred from config files or provided plugin target', function () {
describe('when searchpath or noregistry flag is provided', function () {
it('should end up just returning the target passed in case of searchpath', function () {
- return add.determinePluginTarget(projectRoot, Cfg_parser_mock, 'cordova-plugin-device', { 'searchpath': 'some/path' })
+ return add.determinePluginTarget(projectRoot, Cfg_parser_mock, 'cordova-plugin-device', { searchpath: 'some/path' })
.then(function (target) {
expect(target).toEqual('cordova-plugin-device');
expect(events.emit).toHaveBeenCalledWith('verbose', 'Not checking npm info for cordova-plugin-device because searchpath or noregistry flag was given');
});
});
it('should end up just returning the target passed in case of noregistry', function () {
- return add.determinePluginTarget(projectRoot, Cfg_parser_mock, 'cordova-plugin-device', { 'noregistry': true })
+ return add.determinePluginTarget(projectRoot, Cfg_parser_mock, 'cordova-plugin-device', { noregistry: true })
.then(function (target) {
expect(target).toEqual('cordova-plugin-device');
expect(events.emit).toHaveBeenCalledWith('verbose', 'Not checking npm info for cordova-plugin-device because searchpath or noregistry flag was given');
@@ -314,11 +313,11 @@ describe('cordova/plugin/add', function () {
});
});
it('should feed registry.info plugin information into getFetchVersion', function () {
- plugin_util.info.and.returnValue(Promise.resolve({ 'plugin': 'info' }));
+ plugin_util.info.and.returnValue(Promise.resolve({ plugin: 'info' }));
return add.determinePluginTarget(projectRoot, Cfg_parser_mock, 'cordova-plugin-device', {})
.then(function (target) {
expect(plugin_util.info).toHaveBeenCalled();
- expect(add.getFetchVersion).toHaveBeenCalledWith(jasmine.anything(), { 'plugin': 'info' }, jasmine.anything());
+ expect(add.getFetchVersion).toHaveBeenCalledWith(jasmine.anything(), { plugin: 'info' }, jasmine.anything());
expect(target).toEqual('cordova-plugin-device');
expect(events.emit).toHaveBeenCalledWith('verbose', 'Attempting to use npm info for cordova-plugin-device to choose a compatible release');
});
@@ -381,15 +380,15 @@ describe('cordova/plugin/add', function () {
});
});
it('should retrieve installed plugins and installed platforms version and feed that information into determinePluginVersionToFetch', function () {
- plugin_util.getInstalledPlugins.and.returnValue([{ 'id': '@cordova/plugin-thinger', 'version': '2.0.0' }]);
- cordova_util.getInstalledPlatformsWithVersions.and.returnValue(Promise.resolve({ 'android': '6.0.0' }));
+ plugin_util.getInstalledPlugins.and.returnValue([{ id: '@cordova/plugin-thinger', version: '2.0.0' }]);
+ cordova_util.getInstalledPlatformsWithVersions.and.returnValue(Promise.resolve({ android: '6.0.0' }));
pluginInfo.engines = {};
- pluginInfo.engines.cordovaDependencies = { '^1.0.0': { 'cordova': '>7.0.0' } };
+ pluginInfo.engines.cordovaDependencies = { '^1.0.0': { cordova: '>7.0.0' } };
return add.getFetchVersion(projectRoot, pluginInfo, '7.0.0')
.then(function () {
expect(plugin_util.getInstalledPlugins).toHaveBeenCalledWith(projectRoot);
expect(cordova_util.getInstalledPlatformsWithVersions).toHaveBeenCalledWith(projectRoot);
- expect(add.determinePluginVersionToFetch).toHaveBeenCalledWith(pluginInfo, { '@cordova/plugin-thinger': '2.0.0' }, { 'android': '6.0.0' }, '7.0.0');
+ expect(add.determinePluginVersionToFetch).toHaveBeenCalledWith(pluginInfo, { '@cordova/plugin-thinger': '2.0.0' }, { android: '6.0.0' }, '7.0.0');
});
});
});
@@ -406,20 +405,20 @@ describe('cordova/plugin/add', function () {
});
it('should return null if no valid semver versions exist and no upperbound constraints were placed', function () {
pluginInfo.engines = {};
- pluginInfo.engines.cordovaDependencies = { '^1.0.0': { 'cordova': '<7.0.0' } };
+ pluginInfo.engines.cordovaDependencies = { '^1.0.0': { cordova: '<7.0.0' } };
expect(add.determinePluginVersionToFetch(pluginInfo, {}, {}, '7.0.0')).toBe(null);
expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Ignoring invalid version/));
});
it('should return null and fetching latest version of plugin', function () {
add.getFailedRequirements.and.returnValue(['2.0.0']);
pluginInfo.engines = {};
- pluginInfo.engines.cordovaDependencies = { '1.0.0': { 'cordova': '<7.0.0' }, '<3.0.0': { 'cordova': '>=7.0.0' } };
+ pluginInfo.engines.cordovaDependencies = { '1.0.0': { cordova: '<7.0.0' }, '<3.0.0': { cordova: '>=7.0.0' } };
expect(add.determinePluginVersionToFetch(pluginInfo, {}, {}, '7.0.0')).toBe(null);
expect(events.emit).toHaveBeenCalledWith('warn', jasmine.stringMatching(/Current project does not satisfy/));
});
it('should return highest version of plugin available based on constraints', function () {
pluginInfo.engines = {};
- pluginInfo.engines.cordovaDependencies = { '1.0.0': { 'cordova': '<7.0.0' }, '<3.0.0': { 'cordova': '>=7.0.0' } };
+ pluginInfo.engines.cordovaDependencies = { '1.0.0': { cordova: '<7.0.0' }, '<3.0.0': { cordova: '>=7.0.0' } };
expect(add.determinePluginVersionToFetch(pluginInfo, {}, {}, '7.0.0')).toEqual('2.0.0');
});
});
@@ -428,11 +427,11 @@ describe('cordova/plugin/add', function () {
var semver = require('semver');
spyOn(semver, 'prerelease').and.returnValue('7.0.1');
spyOn(semver, 'inc').and.callThrough();
- expect(add.getFailedRequirements({ 'cordova': '>=7.0.0' }, {}, {}, '7.0.0').length).toBe(0);
+ expect(add.getFailedRequirements({ cordova: '>=7.0.0' }, {}, {}, '7.0.0').length).toBe(0);
expect(semver.inc).toHaveBeenCalledWith('7.0.0', 'patch');
});
it('should return an empty array if no failed requirements', function () {
- expect(add.getFailedRequirements({ 'cordova': '>=7.0.0' }, {}, {}, '7.0.0').length).toBe(0);
+ expect(add.getFailedRequirements({ cordova: '>=7.0.0' }, {}, {}, '7.0.0').length).toBe(0);
});
it('should return an empty array if invalid dependency constraint', function () {
expect(add.getFailedRequirements({ 1: 'wrong' }, {}, {}, '7.0.0').length).toBe(0);
@@ -442,10 +441,10 @@ describe('cordova/plugin/add', function () {
expect(add.getFailedRequirements({ 'cordova-plugin-camera': '>1.0.0' }, { 'cordova-plugin-camera': '1.0.0' }, {}, '7.0.0')).toEqual([{ dependency: 'cordova-plugin-camera', installed: '1.0.0', required: '>1.0.0' }]);
});
it('should return an array with failed cordova requirements ', function () {
- expect(add.getFailedRequirements({ 'cordova': '>=7.0.0' }, {}, {}, '6.5.0')).toEqual([{ dependency: 'cordova', installed: '6.5.0', required: '>=7.0.0' }]);
+ expect(add.getFailedRequirements({ cordova: '>=7.0.0' }, {}, {}, '6.5.0')).toEqual([{ dependency: 'cordova', installed: '6.5.0', required: '>=7.0.0' }]);
});
it('should return an array with failed platform requirements ', function () {
- expect(add.getFailedRequirements({ 'cordova-android': '>=6.0.0' }, {}, { 'android': '5.5.0' }, '7.0.0')).toEqual([{ dependency: 'cordova-android', installed: '5.5.0', required: '>=6.0.0' }]);
+ expect(add.getFailedRequirements({ 'cordova-android': '>=6.0.0' }, {}, { android: '5.5.0' }, '7.0.0')).toEqual([{ dependency: 'cordova-android', installed: '5.5.0', required: '>=6.0.0' }]);
});
});
describe('listUnmetRequirements helper method', function () {
diff --git a/spec/cordova/plugin/index.spec.js b/spec/cordova/plugin/index.spec.js
index e029d1b..8bdbe1f 100644
--- a/spec/cordova/plugin/index.spec.js
+++ b/spec/cordova/plugin/index.spec.js
@@ -51,7 +51,7 @@ describe('cordova/plugin', function () {
var targets = ['plugin1', 'plugin2', 'plugin3'];
return plugin(cmd, targets)
.then(function () {
- expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ options: [ ], plugins: [ 'plugin1', 'plugin2', 'plugin3' ] }));
+ expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ options: [], plugins: ['plugin1', 'plugin2', 'plugin3'] }));
});
});
@@ -59,7 +59,7 @@ describe('cordova/plugin', function () {
var targets = 'plugin1';
return plugin(cmd, targets)
.then(function () {
- expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ options: [ ], plugins: [ 'plugin1' ] }));
+ expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ options: [], plugins: ['plugin1'] }));
});
});
@@ -67,7 +67,7 @@ describe('cordova/plugin', function () {
var targets = '-plugin1';
return plugin(cmd, targets)
.then(function () {
- expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ options: [ '-plugin1' ], plugins: [ ] }));
+ expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ options: ['-plugin1'], plugins: [] }));
});
});
@@ -76,13 +76,12 @@ describe('cordova/plugin', function () {
var targets = 'plugin1';
return plugin(cmd, targets, options)
.then(function () {
- expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ save: true, options: [ ], plugins: [ 'plugin1' ] }));
+ expect(plugin[cmd]).toHaveBeenCalledWith(projectRoot, jasmine.any(Object), Object({ save: true, options: [], plugins: ['plugin1'] }));
});
});
});
describe('happy path', function () {
-
it('should direct "add" command to the "add" submodule', function () {
spyOn(plugin, 'add').and.returnValue(true);
return plugin('add', ['cordova-plugin-splashscreen'])
diff --git a/spec/cordova/plugin/list.spec.js b/spec/cordova/plugin/list.spec.js
index fe4135a..d8d9d60 100644
--- a/spec/cordova/plugin/list.spec.js
+++ b/spec/cordova/plugin/list.spec.js
@@ -73,7 +73,7 @@ describe('cordova/plugin/list', function () {
});
it('should resolve the promise by returning an array of plugin ids installed', function () {
return list(projectRoot, hook_mock).then(function (results) {
- expect(results).toEqual([ 'VRPlugin', 'MastodonSocialPlugin' ]);
+ expect(results).toEqual(['VRPlugin', 'MastodonSocialPlugin']);
});
});
});
diff --git a/spec/cordova/plugin/remove.spec.js b/spec/cordova/plugin/remove.spec.js
index cad6b00..3c0436d 100644
--- a/spec/cordova/plugin/remove.spec.js
+++ b/spec/cordova/plugin/remove.spec.js
@@ -71,7 +71,7 @@ describe('cordova/plugin/remove', function () {
});
it('should require that a provided plugin be installed in the current project', function () {
- var opts = { plugins: [ undefined ] };
+ var opts = { plugins: [undefined] };
return remove(projectRoot, 'plugin', hook_mock, opts).then(function () {
fail('Expected promise to be rejected');
}, function (err) {
diff --git a/spec/cordova/prepare.spec.js b/spec/cordova/prepare.spec.js
index e91a0c0..7fdb83e 100644
--- a/spec/cordova/prepare.spec.js
+++ b/spec/cordova/prepare.spec.js
@@ -60,7 +60,7 @@ describe('cordova/prepare', function () {
spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
spyOn(util, 'preProcessOptions').and.callFake(function (options) {
var platforms = options.platforms || [];
- return { 'platforms': platforms };
+ return { platforms: platforms };
});
spyOn(prepare, 'preparePlatforms').and.returnValue(Promise.resolve());
});
@@ -104,7 +104,7 @@ describe('cordova/prepare', function () {
});
});
it('should retrieve PlatformApi instances for each platform provided', function () {
- return prepare({ 'platforms': ['android', 'ios'] }).then(function () {
+ return prepare({ platforms: ['android', 'ios'] }).then(function () {
expect(platforms.getPlatformApi).toHaveBeenCalledTimes(4);
// expect(platforms.getPlatformApi).toHaveBeenCalledWith(['android', path.join('some','path','platforms','android')], ['ios', path.join('some','path','platforms','ios')], ['android'], ['ios']);
expect(platforms.getPlatformApi).toHaveBeenCalledWith('android', path.join('/', 'some', 'path', 'platforms', 'android'));
@@ -122,7 +122,6 @@ describe('cordova/prepare', function () {
return prepare({ platforms: ['android'] }).then(function () {
expect(prepare.preparePlatforms).toHaveBeenCalledWith(['android'], '/some/path', jasmine.any(Object));
});
-
});
it('should fire the after_prepare hook and provide platform and path information as arguments', function () {
return prepare({ platforms: ['android'] }).then(function () {
diff --git a/spec/cordova/restore-util.spec.js b/spec/cordova/restore-util.spec.js
index a9d3ec0..088610c 100644
--- a/spec/cordova/restore-util.spec.js
+++ b/spec/cordova/restore-util.spec.js
@@ -84,7 +84,7 @@ describe('cordova/restore-util', () => {
return o;
}, {});
if (Object.keys(expectedSpecs).length > 0) {
- let specs = Object.assign({}, pkgJson.dependencies, pkgJson.devDependencies);
+ const specs = Object.assign({}, pkgJson.dependencies, pkgJson.devDependencies);
expect(specs).toEqual(jasmine.objectContaining(expectedSpecs));
}
}
@@ -114,7 +114,6 @@ describe('cordova/restore-util', () => {
}
describe('installPlatformsFromConfigXML', () => {
-
it('Test#001 : should restore saved platform from package.json', () => {
setPkgJson('cordova.platforms', [testPlatform]);
@@ -334,8 +333,8 @@ describe('cordova/restore-util', () => {
variables: { common_var: 'xml', xml_var: 'foo' }
}]);
- const pluginOccurences = !!getPkgJson('dependencies.cordova-plugin-camera')
- + !!getPkgJson('devDependencies.cordova-plugin-camera');
+ const pluginOccurences = !!getPkgJson('dependencies.cordova-plugin-camera') +
+ !!getPkgJson('devDependencies.cordova-plugin-camera');
expect(pluginOccurences).toBe(1);
});
});
diff --git a/spec/cordova/run.spec.js b/spec/cordova/run.spec.js
index 69ea726..4bba1e8 100644
--- a/spec/cordova/run.spec.js
+++ b/spec/cordova/run.spec.js
@@ -71,7 +71,7 @@ describe('run command', function () {
describe('success', function () {
it('Test 003 : should call prepare before actually run platform ', function () {
return cordovaRun(['android', 'ios']).then(function () {
- expect(cordovaPrepare.calls.argsFor(0)).toEqual([ { platforms: [ 'android', 'ios' ], verbose: false, options: {} } ]);
+ expect(cordovaPrepare.calls.argsFor(0)).toEqual([{ platforms: ['android', 'ios'], verbose: false, options: {} }]);
});
});
it('Test 004 : should get PlatformApi instance for each platform and call its\' run method', function () {
@@ -84,7 +84,7 @@ describe('run command', function () {
});
it('Test 005 : should pass down parameters', function () {
return cordovaRun({ platforms: ['blackberry10'], options: { password: '1q1q' } }).then(function () {
- expect(cordovaPrepare).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q' }, verbose: false });
+ expect(cordovaPrepare).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { password: '1q1q' }, verbose: false });
expect(platformApi.build).toHaveBeenCalledWith({ password: '1q1q' });
expect(platformApi.run).toHaveBeenCalledWith({ password: '1q1q', nobuild: true });
});
@@ -117,8 +117,8 @@ describe('run command', function () {
});
it('Test 009 : should leave parameters unchanged', function () {
return cordovaRun({ platforms: ['blackberry10'], options: { password: '1q1q' } }).then(function () {
- expect(cordovaPrepare).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q', 'couldBeModified': 'insideBuild' }, verbose: false });
- expect(platformApi.build).toHaveBeenCalledWith({ password: '1q1q', 'couldBeModified': 'insideBuild' });
+ expect(cordovaPrepare).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { password: '1q1q', couldBeModified: 'insideBuild' }, verbose: false });
+ expect(platformApi.build).toHaveBeenCalledWith({ password: '1q1q', couldBeModified: 'insideBuild' });
expect(platformApi.run).toHaveBeenCalledWith({ password: '1q1q', nobuild: true });
});
});
@@ -130,13 +130,13 @@ describe('run command', function () {
it('Test 010 : should fire before hooks through the hooker module', function () {
return cordovaRun(['android', 'ios']).then(function () {
expect(HooksRunner.prototype.fire.calls.argsFor(0))
- .toEqual([ 'before_run', { platforms: [ 'android', 'ios' ], verbose: false, options: {} } ]);
+ .toEqual(['before_run', { platforms: ['android', 'ios'], verbose: false, options: {} }]);
});
});
it('Test 011 : should fire after hooks through the hooker module', function () {
return cordovaRun('android').then(function () {
expect(HooksRunner.prototype.fire.calls.argsFor(2))
- .toEqual([ 'after_run', { platforms: [ 'android' ], verbose: false, options: {} } ]);
+ .toEqual(['after_run', { platforms: ['android'], verbose: false, options: {} }]);
});
});
});
diff --git a/spec/cordova/serve.spec.js b/spec/cordova/serve.spec.js
index b596ef4..24aca94 100644
--- a/spec/cordova/serve.spec.js
+++ b/spec/cordova/serve.spec.js
@@ -37,6 +37,7 @@ describe('cordova/serve', () => {
class HooksRunnerMock {
constructor (dir) { expect(dir).toBe(PROJECT_ROOT); }
+
fire (hook, fireOpts) { return Promise.resolve(); }
}
@@ -165,7 +166,7 @@ describe('cordova/serve', () => {
let registerRoutes, app;
beforeEach(() => {
- spyOn(cordovaUtil, 'listPlatforms').and.returnValue([ 'foo' ]);
+ spyOn(cordovaUtil, 'listPlatforms').and.returnValue(['foo']);
serve.__set__({
handleRoot: jasmine.createSpy('handleRoot'),
absolutePathHandler: jasmine.createSpy('absolutePathHandler'),
@@ -195,7 +196,7 @@ describe('cordova/serve', () => {
});
it('should register platform routes', () => {
- cordovaUtil.listPlatforms.and.returnValue([ 'foo', 'bar' ]);
+ cordovaUtil.listPlatforms.and.returnValue(['foo', 'bar']);
const platformRouter = serve.__get__('platformRouter');
platformRouter
.withArgs('foo').and.returnValue(jasmine.createSpy('fooHandler'))
@@ -239,7 +240,7 @@ describe('cordova/serve', () => {
handleRoot(null, response);
expect(response.send).toHaveBeenCalledTimes(1);
- const [ document ] = response.send.calls.argsFor(0);
+ const [document] = response.send.calls.argsFor(0);
expect(document).toContain('cordova-plugin-beer');
expect(document).toContain('foo');
expect(document).toContain('bar');
diff --git a/spec/cordova/util.spec.js b/spec/cordova/util.spec.js
index 0dcfdb4..f8ac232 100644
--- a/spec/cordova/util.spec.js
+++ b/spec/cordova/util.spec.js
@@ -148,7 +148,6 @@ describe('util module', function () {
});
describe('preprocessOptions method', function () {
-
var isCordova, listPlatforms;
var DEFAULT_OPTIONS = {
// 'android' is here because we create a spy
@@ -197,7 +196,6 @@ describe('util module', function () {
});
describe('getPlatformApiFunction', function () {
-
it('Test 030 : successfully find platform Api', function () {
const FIXTURE_PROJECT = path.join(__dirname, 'fixtures/projects/platformApi/');
const API_PATH = path.join(FIXTURE_PROJECT, 'platforms/windows/cordova/Api.js');
diff --git a/spec/helpers.js b/spec/helpers.js
index da80dee..7d29f10 100644
--- a/spec/helpers.js
+++ b/spec/helpers.js
@@ -94,7 +94,7 @@ module.exports.setDefaultTimeout = timeout => {
module.exports.omniStub = (terminalProps = {}) => {
const stub = new Proxy(_ => _, {
get: (_, key) => {
- if (terminalProps.hasOwnProperty(key)) return terminalProps[key];
+ if (Object.prototype.hasOwnProperty.call(terminalProps, key)) return terminalProps[key];
return key === Symbol.toPrimitive ? _ => '' : stub;
},
apply: _ => stub
@@ -145,7 +145,7 @@ module.exports.setPluginSpec = function (appPath, plugin, spec) {
}
}
- parser.addPlugin({ 'name': plugin, 'spec': spec }, variables);
+ parser.addPlugin({ name: plugin, spec: spec }, variables);
parser.write();
};
diff --git a/spec/hooks/Context.spec.js b/spec/hooks/Context.spec.js
index 29a2f65..cc90b21 100644
--- a/spec/hooks/Context.spec.js
+++ b/spec/hooks/Context.spec.js
@@ -106,6 +106,5 @@ describe('hooks/Context', () => {
expectErrorOnRequire('/foo');
});
});
-
});
});
diff --git a/spec/plugman/add_platform.spec.js b/spec/plugman/add_platform.spec.js
index 2e0a98a..1d72912 100644
--- a/spec/plugman/add_platform.spec.js
+++ b/spec/plugman/add_platform.spec.js
@@ -20,7 +20,6 @@ var platform = require('../../src/plugman/platform');
var fs = require('fs-extra');
describe('plugman/platform', () => {
-
describe('add', function () {
beforeEach(function () {
spyOn(fs, 'existsSync').and.returnValue(false);
diff --git a/spec/plugman/create.spec.js b/spec/plugman/create.spec.js
index a38bd05..5e18585 100644
--- a/spec/plugman/create.spec.js
+++ b/spec/plugman/create.spec.js
@@ -20,7 +20,6 @@ var create = require('../../src/plugman/create');
var fs = require('fs-extra');
describe('plugman/create', () => {
-
it('Test 002 : should be successful', function () {
spyOn(fs, 'existsSync').and.returnValue(false);
spyOn(fs, 'ensureDirSync');
diff --git a/spec/plugman/install.spec.js b/spec/plugman/install.spec.js
index 65cc086..16f6b13 100644
--- a/spec/plugman/install.spec.js
+++ b/spec/plugman/install.spec.js
@@ -184,11 +184,11 @@ describe('plugman/install', () => {
.then(() => {
expect(satisfies.calls.count()).toBe(3);
// <engine name="cordova" VERSION=">=3.0.0"/>
- expect(satisfies.calls.argsFor(0)).toEqual([ cordovaVersion, '>=3.0.0', true ]);
+ expect(satisfies.calls.argsFor(0)).toEqual([cordovaVersion, '>=3.0.0', true]);
// <engine name="cordova-android" VERSION=">=3.1.0"/>
- expect(satisfies.calls.argsFor(1)).toEqual([ '18.0.0', '>=3.1.0', true ]);
+ expect(satisfies.calls.argsFor(1)).toEqual(['18.0.0', '>=3.1.0', true]);
// <engine name="android-sdk" VERSION=">=18"/>
- expect(satisfies.calls.argsFor(2)).toEqual([ '18.0.0', '>=18', true ]);
+ expect(satisfies.calls.argsFor(2)).toEqual(['18.0.0', '>=18', true]);
});
}, TIMEOUT);
it('Test 011 : should check engine versions', () => {
@@ -198,13 +198,13 @@ describe('plugman/install', () => {
const cordovaVersion = require('../../package.json').version.replace(/-dev|-nightly.*$/, '');
expect(satisfies.calls.count()).toBe(4);
// <engine name="cordova" version=">=2.3.0"/>
- expect(satisfies.calls.argsFor(0)).toEqual([ cordovaVersion, '>=2.3.0', true ]);
+ expect(satisfies.calls.argsFor(0)).toEqual([cordovaVersion, '>=2.3.0', true]);
// <engine name="cordova-plugman" version=">=0.10.0" />
- expect(satisfies.calls.argsFor(1)).toEqual([ plugmanVersion, '>=0.10.0', true ]);
+ expect(satisfies.calls.argsFor(1)).toEqual([plugmanVersion, '>=0.10.0', true]);
// <engine name="mega-fun-plugin" version=">=1.0.0" scriptSrc="megaFunVersion" platform="*" />
- expect(satisfies.calls.argsFor(2)).toEqual([ null, '>=1.0.0', true ]);
+ expect(satisfies.calls.argsFor(2)).toEqual([null, '>=1.0.0', true]);
// <engine name="mega-boring-plugin" version=">=3.0.0" scriptSrc="megaBoringVersion" platform="ios|android" />
- expect(satisfies.calls.argsFor(3)).toEqual([ null, '>=3.0.0', true ]);
+ expect(satisfies.calls.argsFor(3)).toEqual([null, '>=3.0.0', true]);
});
}, TIMEOUT);
it('Test 012 : should not check custom engine version that is not supported for platform', () => {
diff --git a/spec/plugman/util/dependencies.spec.js b/spec/plugman/util/dependencies.spec.js
index e6ca984..84ad762 100644
--- a/spec/plugman/util/dependencies.spec.js
+++ b/spec/plugman/util/dependencies.spec.js
@@ -26,9 +26,9 @@ describe('dependency module', function () {
describe('generateDependencyInfo method', function () {
it('Test 001 : should return a list of top-level plugins based on what is inside a platform.json file', function () {
var tlps = {
- 'hello': '',
- 'isitme': '',
- 'yourelookingfor': ''
+ hello: '',
+ isitme: '',
+ yourelookingfor: ''
};
var platformJson = new PlatformJson('filePath', 'platform', {
installed_plugins: tlps,
@@ -44,8 +44,8 @@ describe('dependency module', function () {
});
it('Test 002 : should return a dependency graph for the plugins', function () {
var tlps = {
- 'A': '',
- 'B': ''
+ A: '',
+ B: ''
};
var plugins_dir = path.join(__dirname, '..', 'plugins', 'dependencies');
var platformJson = new PlatformJson(plugins_dir, 'android', {
diff --git a/spec/plugman/util/metadata.spec.js b/spec/plugman/util/metadata.spec.js
index f7dda9a..bd9f928 100644
--- a/spec/plugman/util/metadata.spec.js
+++ b/spec/plugman/util/metadata.spec.js
@@ -85,7 +85,6 @@ describe('plugman.metadata', () => {
expect(fsMock.existsSync).not.toHaveBeenCalled();
expect(fsMock.readFileSync).not.toHaveBeenCalled();
});
-
});
});
diff --git a/spec/project-test-helpers.js b/spec/project-test-helpers.js
index 573911a..986a19e 100644
--- a/spec/project-test-helpers.js
+++ b/spec/project-test-helpers.js
@@ -29,6 +29,7 @@ class TestConfigParser extends ConfigParser {
addPlugin (plugin) {
return (super.addPlugin(plugin, plugin.variables), this);
}
+
addEngine (...args) {
return (super.addEngine(...args), this);
}
diff --git a/src/cordova/emulate.js b/src/cordova/emulate.js
index 46bea40..47a347e 100644
--- a/src/cordova/emulate.js
+++ b/src/cordova/emulate.js
@@ -44,9 +44,8 @@ module.exports = function emulate (options) {
}).then(function () {
// Deploy in parallel (output gets intermixed though...)
return Promise.all(options.platforms.map(function (platform) {
-
- var buildPromise = options.options.nobuild ? Promise.resolve() :
- platform_lib.getPlatformApi(platform).build(options.options);
+ var buildPromise = options.options.nobuild ? Promise.resolve()
+ : platform_lib.getPlatformApi(platform).build(options.options);
return buildPromise
.then(function () {
diff --git a/src/cordova/plugin/add.js b/src/cordova/plugin/add.js
index af1f6d2..fdb0317 100644
--- a/src/cordova/plugin/add.js
+++ b/src/cordova/plugin/add.js
@@ -507,7 +507,7 @@ function getFailedRequirements (reqs, pluginMap, platformMap, cordovaVersion) {
}
for (var req in reqs) {
- if (reqs.hasOwnProperty(req) && typeof req === 'string' && semver.validRange(reqs[req])) {
+ if (Object.prototype.hasOwnProperty.call(reqs, req) && typeof req === 'string' && semver.validRange(reqs[req])) {
var badInstalledVersion = null;
// remove potential whitespace
var trimmedReq = req.trim();
diff --git a/src/cordova/restore-util.js b/src/cordova/restore-util.js
index 58d27ad..1e869a8 100644
--- a/src/cordova/restore-util.js
+++ b/src/cordova/restore-util.js
@@ -62,7 +62,6 @@ function installPlatformsFromConfigXML (platforms, opts) {
}
if (cfg !== undefined) {
-
if (pkgJsonPlatforms !== undefined) {
// Combining arrays and checking duplicates.
comboArray = pkgJsonPlatforms.slice();
diff --git a/src/cordova/run.js b/src/cordova/run.js
index 786293d..682cd39 100644
--- a/src/cordova/run.js
+++ b/src/cordova/run.js
@@ -42,9 +42,8 @@ module.exports = function run (options) {
}).then(function () {
// Deploy in parallel (output gets intermixed though...)
return Promise.all(options.platforms.map(function (platform) {
-
- var buildPromise = options.options.nobuild ? Promise.resolve() :
- platform_lib.getPlatformApi(platform).build(options.options);
+ var buildPromise = options.options.nobuild ? Promise.resolve()
+ : platform_lib.getPlatformApi(platform).build(options.options);
return buildPromise
.then(function () {
diff --git a/src/cordova/serve.js b/src/cordova/serve.js
index fc6bf9a..4f6fae8 100644
--- a/src/cordova/serve.js
+++ b/src/cordova/serve.js
@@ -81,8 +81,8 @@ function handleRoot (request, response) {
const contentNode = config.doc.find('content');
const contentSrc = (contentNode && contentNode.attrib.src) || 'index.html';
const metaDataKeys = ['name', 'packageName', 'version'];
- const platformUrl = name => installedPlatforms.includes(name) ?
- `${name}/www/${contentSrc}` : null;
+ const platformUrl = name => installedPlatforms.includes(name)
+ ? `${name}/www/${contentSrc}` : null;
response.send(renderIndex({
metaData: zipObject(metaDataKeys, metaDataKeys.map(k => config[k]())),
diff --git a/src/cordova/targets.js b/src/cordova/targets.js
index 04b7e4c..2471ba2 100644
--- a/src/cordova/targets.js
+++ b/src/cordova/targets.js
@@ -32,14 +32,14 @@ function handleError (error) {
}
function displayDevices (projectRoot, platform, options) {
- var caller = { 'script': 'list-devices' };
+ var caller = { script: 'list-devices' };
events.emit('log', 'Available ' + platform + ' devices:');
var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'lib', 'list-devices');
return execa(cmd, options.argv, { stdio: 'inherit' }).then(data => data.stdout, handleError.bind(caller));
}
function displayVirtualDevices (projectRoot, platform, options) {
- var caller = { 'script': 'list-emulator-images' };
+ var caller = { script: 'list-emulator-images' };
events.emit('log', 'Available ' + platform + ' virtual devices:');
var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'lib', 'list-emulator-images');
return execa(cmd, options.argv, { stdio: 'inherit' }).then(data => data.stdout, handleError.bind(caller));
diff --git a/src/plugman/create.js b/src/plugman/create.js
index 7b46e84..082bfb3 100644
--- a/src/plugman/create.js
+++ b/src/plugman/create.js
@@ -52,7 +52,7 @@ module.exports = function create (name, id, version, pluginPath, options) {
// Loop through the options( variables ) for other tags
for (var key in options) {
var temp = et.XML('<' + key + '>');
- temp.text = options[ key ];
+ temp.text = options[key];
root.append(temp);
}
diff --git a/src/plugman/fetch.js b/src/plugman/fetch.js
index 24e4574..9417a7c 100644
--- a/src/plugman/fetch.js
+++ b/src/plugman/fetch.js
@@ -252,7 +252,6 @@ function findLocalPlugin (plugin_src, searchpath, pluginInfoProvider) {
if (semver.gt(pinfo.version, latest.version)) {
latest = pinfo;
}
-
});
return latest;
}
@@ -260,7 +259,6 @@ function findLocalPlugin (plugin_src, searchpath, pluginInfoProvider) {
// Copy or link a plugin from plugin_dir to plugins_dir/plugin_id.
// if alternative ID of plugin exists in plugins_dir/plugin_id, skip copying
function copyPlugin (pinfo, plugins_dir, link) {
-
var plugin_dir = pinfo.dir;
var dest = path.join(plugins_dir, pinfo.id);
diff --git a/src/plugman/install.js b/src/plugman/install.js
index 835ce5a..044865a 100644
--- a/src/plugman/install.js
+++ b/src/plugman/install.js
@@ -66,7 +66,7 @@ module.exports = function installPlugin (platform, project_dir, id, plugins_dir,
project_dir = cordovaUtil.convertToRealPathSafe(project_dir);
plugins_dir = cordovaUtil.convertToRealPathSafe(plugins_dir);
options = options || {};
- if (!options.hasOwnProperty('is_top_level')) options.is_top_level = true;
+ if (!Object.prototype.hasOwnProperty.call(options, 'is_top_level')) options.is_top_level = true;
plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
@@ -97,7 +97,6 @@ function possiblyFetch (id, plugins_dir, options) {
}
function checkEngines (engines) {
-
for (var i = 0; i < engines.length; i++) {
var engine = engines[i];
@@ -160,13 +159,11 @@ function cleanVersionOutput (version, name) {
// exec engine scripts in order to get the current engine version
// Returns a promise for the array of engines.
function callEngineScripts (engines, project_dir) {
-
return Promise.all(
engines.map(function (engine) {
// CB-5192; on Windows scriptSrc doesn't have file extension so we shouldn't check whether the script exists
var scriptPath = engine.scriptSrc || null;
if (scriptPath && (isWindows || fs.existsSync(engine.scriptSrc))) {
-
if (!isWindows) { // not required on Windows
fs.chmodSync(engine.scriptSrc, '755');
}
@@ -183,7 +180,6 @@ function callEngineScripts (engines, project_dir) {
})
.then(_ => engine);
} else {
-
if (engine.currentVersion) {
engine.currentVersion = cleanVersionOutput(engine.currentVersion, engine.name);
} else {
@@ -237,7 +233,7 @@ function getEngines (pluginInfo, platform, project_dir, plugin_dir) {
throw new Error('Security violation: scriptSrc ' + scriptSrcPath + ' is out of plugin dir ' + plugin_dir);
}
if (platformIndex > -1 || engine.platform === '*') {
- uncheckedEngines.push({ 'name': theName, 'platform': engine.platform, 'scriptSrc': scriptSrcPath, 'minVersion': engine.version });
+ uncheckedEngines.push({ name: theName, platform: engine.platform, scriptSrc: scriptSrcPath, minVersion: engine.version });
}
}
});
@@ -327,7 +323,7 @@ function runInstall (actions, platform, project_dir, plugin_dir, plugins_dir, op
if (projectRoot) {
// using unified hooksRunner
var hookOptions = {
- cordova: { platforms: [ platform ] },
+ cordova: { platforms: [platform] },
plugin: {
id: pluginInfo.id,
pluginInfo: pluginInfo,
@@ -357,7 +353,6 @@ function runInstall (actions, platform, project_dir, plugin_dir, plugins_dir, op
}
).catch(
function (error) {
-
if (error.skip) {
events.emit('warn', 'Skipping \'' + pluginInfo.id + '\' for ' + platform);
} else {
@@ -404,23 +399,19 @@ function installDependencies (install, dependencies, options) {
);
}
);
-
}, Promise.resolve(true));
}
function tryFetchDependency (dep, install, options) {
-
// Handle relative dependency paths by expanding and resolving them.
// The easy case of relative paths is to have a URL of '.' and a different subdir.
// TODO: Implement the hard case of different repo URLs, rather than the special case of
// same-repo-different-subdir.
var relativePath;
if (dep.url === '.') {
-
// Look up the parent plugin's fetch metadata and determine the correct URL.
var fetchdata = require('./util/metadata').get_fetch_metadata(install.top_plugin_dir);
if (!fetchdata || !(fetchdata.source && fetchdata.source.type)) {
-
relativePath = dep.subdir || dep.id;
events.emit('warn', 'No fetch metadata found for plugin ' + install.top_plugin_id + '. checking for ' + relativePath + ' in ' + options.searchpath.join(','));
@@ -430,7 +421,6 @@ function tryFetchDependency (dep, install, options) {
// Now there are two cases here: local directory, and git URL.
if (fetchdata.source.type === 'local') {
-
dep.url = fetchdata.source.path;
return execa.command('git rev-parse --show-toplevel', { cwd: dep.url })
@@ -449,11 +439,9 @@ function tryFetchDependency (dep, install, options) {
}).catch(function () {
return Promise.resolve(dep.url);
});
-
} else if (fetchdata.source.type === 'git') {
return Promise.resolve(fetchdata.source.url);
} else if (fetchdata.source.type === 'dir') {
-
// Note: With fetch() independant from install()
// $md5 = md5(uri)
// Need a Hash(uri) --> $tmpDir/cordova-fetch/git-hostname.com-$md5/
@@ -499,7 +487,6 @@ function tryFetchDependency (dep, install, options) {
}
function installDependency (dep, install, options) {
-
var opts;
dep.install_dir = path.join(install.plugins_dir, dep.id);
@@ -548,7 +535,6 @@ function installDependency (dep, install, options) {
is_top_level: false
});
return module.exports.runInstall(install.actions, install.platform, install.project_dir, dep.install_dir, install.plugins_dir, opts);
-
} else {
events.emit('verbose', 'Plugin dependency "' + dep.id + '" not fetched, retrieving then installing.');
@@ -571,7 +557,6 @@ function installDependency (dep, install, options) {
}
function handleInstall (actions, pluginInfo, platform, project_dir, plugins_dir, plugin_dir, filtered_variables, options) {
-
// @tests - important this event is checked spec/install.spec.js
events.emit('verbose', 'Install start for "' + pluginInfo.id + '" on ' + platform + '.');
diff --git a/src/plugman/platform.js b/src/plugman/platform.js
index bf25da7..f5e7bd9 100644
--- a/src/plugman/platform.js
+++ b/src/plugman/platform.js
@@ -144,5 +144,4 @@ function doPlatformBase (templatesDir, platformName, pluginName, pluginID, plugi
const filePath = path.join(baseDir, `${pluginName}.${extension}`);
fs.writeFileSync(filePath, file, 'utf-8');
}
-
}
diff --git a/src/plugman/platform_operation.js b/src/plugman/platform_operation.js
index dff2d0c..769e612 100644
--- a/src/plugman/platform_operation.js
+++ b/src/plugman/platform_operation.js
@@ -20,5 +20,5 @@
var platform = require('./platform');
module.exports = function (args) {
- return platform[ args.operation ](args.platform_name);
+ return platform[args.operation](args.platform_name);
};
diff --git a/src/plugman/uninstall.js b/src/plugman/uninstall.js
index 19108a4..7c1e619 100644
--- a/src/plugman/uninstall.js
+++ b/src/plugman/uninstall.js
@@ -224,7 +224,6 @@ module.exports.uninstallPlugin = function (id, plugins_dir, options) {
return deleteExecList.reduce(function (acc, deleteExec) {
return acc.then(deleteExec);
}, Promise.resolve());
-
};
// possible options: cli_variables, www_dir, is_top_level
@@ -264,7 +263,6 @@ function runUninstallPlatform (actions, platform, project_dir, plugin_dir, plugi
var promise;
if (deps && deps.length && danglers && danglers.length) {
-
// @tests - important this event is checked spec/uninstall.spec.js
events.emit('log', 'Uninstalling ' + danglers.length + ' dependent plugins.');
promise = promiseutil.Q_chainmap(danglers, function (dangler) {
@@ -295,7 +293,7 @@ function runUninstallPlatform (actions, platform, project_dir, plugin_dir, plugi
var hooksRunner = new HooksRunner(projectRoot);
var hooksRunnerOptions = {
- cordova: { platforms: [ platform ] },
+ cordova: { platforms: [platform] },
plugin: {
id: pluginInfo.id,
pluginInfo: pluginInfo,
diff --git a/src/plugman/util/default-engines.js b/src/plugman/util/default-engines.js
index 1047043..54ec191 100644
--- a/src/plugman/util/default-engines.js
+++ b/src/plugman/util/default-engines.js
@@ -21,29 +21,29 @@ var path = require('path');
module.exports = function (project_dir) {
return {
- 'cordova':
- { 'platform': '*', 'currentVersion': require('../../../package.json').version },
+ cordova:
+ { platform: '*', currentVersion: require('../../../package.json').version },
'cordova-plugman':
- { 'platform': '*', 'currentVersion': require('../../../package.json').version },
+ { platform: '*', currentVersion: require('../../../package.json').version },
'cordova-android':
- { 'platform': 'android', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+ { platform: 'android', scriptSrc: path.join(project_dir, 'cordova', 'version') },
'cordova-ios':
- { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+ { platform: 'ios', scriptSrc: path.join(project_dir, 'cordova', 'version') },
'cordova-osx':
- { 'platform': 'osx', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+ { platform: 'osx', scriptSrc: path.join(project_dir, 'cordova', 'version') },
'cordova-windows':
- { 'platform': 'windows', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+ { platform: 'windows', scriptSrc: path.join(project_dir, 'cordova', 'version') },
'cordova-browser':
- { 'platform': 'browser', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+ { platform: 'browser', scriptSrc: path.join(project_dir, 'cordova', 'version') },
'cordova-electron':
- { 'platform': 'electron', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+ { platform: 'electron', scriptSrc: path.join(project_dir, 'cordova', 'version') },
'apple-xcode':
- { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'apple_xcode_version') },
+ { platform: 'ios', scriptSrc: path.join(project_dir, 'cordova', 'apple_xcode_version') },
'apple-ios':
- { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'apple_ios_version') },
+ { platform: 'ios', scriptSrc: path.join(project_dir, 'cordova', 'apple_ios_version') },
'apple-osx':
- { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'apple_osx_version') },
+ { platform: 'ios', scriptSrc: path.join(project_dir, 'cordova', 'apple_osx_version') },
'android-sdk':
- { 'platform': 'android', 'scriptSrc': path.join(project_dir, 'cordova', 'android_sdk_version') }
+ { platform: 'android', scriptSrc: path.join(project_dir, 'cordova', 'android_sdk_version') }
};
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org