You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/08/07 17:15:42 UTC
[1/2] cordova-plugin-wkwebview-engine git commit: CB-12895 : added
eslint and removed jshint
Repository: cordova-plugin-wkwebview-engine
Updated Branches:
refs/heads/master 1e3276ec1 -> 919dbcec3
CB-12895 : added eslint and removed jshint
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/b2b121b8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/b2b121b8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/b2b121b8
Branch: refs/heads/master
Commit: b2b121b856d0ea92fadca6cae5d8ff283c68f40f
Parents: 1e3276e
Author: Audrey So <au...@apache.org>
Authored: Mon Jun 12 11:59:35 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Mon Jul 31 13:44:45 2017 -0700
----------------------------------------------------------------------
.eslintrc.yml | 12 ++++++++++++
package.json | 15 ++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/b2b121b8/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..470bc46
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,12 @@
+root: true
+extends: semistandard
+plugins:
+ - standard
+ - promise
+rules:
+ indent:
+ - error
+ - 4
+ quotes:
+ - error
+ - single
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/b2b121b8/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 2f9549b..a5417a7 100644
--- a/package.json
+++ b/package.json
@@ -15,14 +15,23 @@
"wkwebview"
],
"scripts": {
- "test": "npm run jshint && npm run objc-tests",
+ "test": "npm run eslint && npm run objc-tests",
"objc-tests": "cd tests/ios && npm test",
"preobjc-tests": "cd tests/ios && npm install",
- "jshint": "node_modules/.bin/jshint src"
+ "eslint": "node_modules/.bin/eslint src"
},
"author": "Apache Cordova",
"license": "Apache-2.0",
"devDependencies": {
- "jshint": "^2.6.0"
+ "eslint": "^4.0.0",
+ "eslint-config-semistandard": "^11.0.0",
+ "eslint-config-standard": "^10.2.1",
+ "eslint-plugin-import": "^2.3.0",
+ "eslint-plugin-node": "^5.0.0",
+ "eslint-plugin-promise": "^3.5.0",
+ "eslint-plugin-standard": "^3.0.1"
+ },
+ "dependencies": {
+ "eslint": "^4.0.0"
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/2] cordova-plugin-wkwebview-engine git commit: CB-12895 : rebased
and updated files
Posted by au...@apache.org.
CB-12895 : rebased and updated files
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/919dbcec
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/919dbcec
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/919dbcec
Branch: refs/heads/master
Commit: 919dbcec374b3a7ebab0131da9870ec25cb10db2
Parents: b2b121b
Author: Audrey So <au...@apache.org>
Authored: Mon Jul 31 13:52:59 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Mon Jul 31 13:57:01 2017 -0700
----------------------------------------------------------------------
.eslintrc.yml | 10 ++---
package.json | 5 +--
src/www/ios/ios-wkwebview-exec.js | 75 ++++++++++++++++------------------
3 files changed, 41 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/919dbcec/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 470bc46..0cccb8c 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,12 +1,10 @@
root: true
extends: semistandard
-plugins:
- - standard
- - promise
rules:
indent:
- error
- 4
- quotes:
- - error
- - single
+ camelcase: off
+ padded-blocks: off
+ operator-linebreak: off
+ no-throw-literal: off
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/919dbcec/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index a5417a7..6d9ba8d 100644
--- a/package.json
+++ b/package.json
@@ -23,15 +23,12 @@
"author": "Apache Cordova",
"license": "Apache-2.0",
"devDependencies": {
- "eslint": "^4.0.0",
+ "eslint": "^3.19.0",
"eslint-config-semistandard": "^11.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-node": "^5.0.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1"
- },
- "dependencies": {
- "eslint": "^4.0.0"
}
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/919dbcec/src/www/ios/ios-wkwebview-exec.js
----------------------------------------------------------------------
diff --git a/src/www/ios/ios-wkwebview-exec.js b/src/www/ios/ios-wkwebview-exec.js
index 2766acc..e18b5f2 100644
--- a/src/www/ios/ios-wkwebview-exec.js
+++ b/src/www/ios/ios-wkwebview-exec.js
@@ -23,17 +23,17 @@
* Creates the exec bridge used to notify the native code of
* commands.
*/
-var cordova = require('cordova'),
- utils = require('cordova/utils'),
- base64 = require('cordova/base64');
+var cordova = require('cordova');
+var utils = require('cordova/utils');
+var base64 = require('cordova/base64');
-function massageArgsJsToNative(args) {
- if (!args || utils.typeName(args) != 'Array') {
+function massageArgsJsToNative (args) {
+ if (!args || utils.typeName(args) !== 'Array') {
return args;
}
var ret = [];
- args.forEach(function(arg, i) {
- if (utils.typeName(arg) == 'ArrayBuffer') {
+ args.forEach(function (arg, i) {
+ if (utils.typeName(arg) === 'ArrayBuffer') {
ret.push({
'CDVType': 'ArrayBuffer',
'data': base64.fromArrayBuffer(arg)
@@ -45,29 +45,29 @@ function massageArgsJsToNative(args) {
return ret;
}
-function massageMessageNativeToJs(message) {
- if (message.CDVType == 'ArrayBuffer') {
- var stringToArrayBuffer = function(str) {
+function massageMessageNativeToJs (message) {
+ if (message.CDVType === 'ArrayBuffer') {
+ var stringToArrayBuffer = function (str) {
var ret = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i);
}
return ret.buffer;
};
- var base64ToArrayBuffer = function(b64) {
- return stringToArrayBuffer(atob(b64));
+ var base64ToArrayBuffer = function (b64) {
+ return stringToArrayBuffer(atob(b64)); // eslint-disable-line no-undef
};
message = base64ToArrayBuffer(message.data);
}
return message;
}
-function convertMessageToArgsNativeToJs(message) {
+function convertMessageToArgsNativeToJs (message) {
var args = [];
if (!message || !message.hasOwnProperty('CDVType')) {
args.push(message);
- } else if (message.CDVType == 'MultiPart') {
- message.messages.forEach(function(e) {
+ } else if (message.CDVType === 'MultiPart') {
+ message.messages.forEach(function (e) {
args.push(massageMessageNativeToJs(e));
});
} else {
@@ -76,8 +76,7 @@ function convertMessageToArgsNativeToJs(message) {
return args;
}
-var iOSExec = function() {
-
+var iOSExec = function () {
// detect change in bridge, if there is a change, we forward to new bridge
// if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
@@ -86,7 +85,7 @@ var iOSExec = function() {
var successCallback, failCallback, service, action, actionArgs;
var callbackId = null;
- if (typeof arguments[0] !== "string") {
+ if (typeof arguments[0] !== 'string') {
// FORMAT ONE
successCallback = arguments[0];
failCallback = arguments[1];
@@ -100,7 +99,7 @@ var iOSExec = function() {
// an invalid callbackId and passes it even if no callbacks were given.
callbackId = 'INVALID';
} else {
- throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' +
+ throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + // eslint-disable-line
'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);');
}
@@ -112,7 +111,7 @@ var iOSExec = function() {
if (successCallback || failCallback) {
callbackId = service + cordova.callbackId++;
cordova.callbacks[callbackId] =
- {success:successCallback, fail:failCallback};
+ {success: successCallback, fail: failCallback};
}
actionArgs = massageArgsJsToNative(actionArgs);
@@ -120,20 +119,18 @@ var iOSExec = function() {
// CB-10133 DataClone DOM Exception 25 guard (fast function remover)
var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))];
window.webkit.messageHandlers.cordova.postMessage(command);
-
};
-iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) {
-
+iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) {
var success = status === 0 || status === 1;
var args = convertMessageToArgsNativeToJs(message);
- setTimeout(function(){
- cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
+ setTimeout(function () {
+ cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line
}, 0);
};
// for backwards compatibility
-iOSExec.nativeEvalAndFetch = function(func) {
+iOSExec.nativeEvalAndFetch = function (func) {
try {
func();
} catch (e) {
@@ -143,35 +140,35 @@ iOSExec.nativeEvalAndFetch = function(func) {
// Proxy the exec for bridge changes. See CB-10106
-function cordovaExec() {
+function cordovaExec () {
var cexec = require('cordova/exec');
var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
- return (cexec_valid && execProxy !== cexec)? cexec : iOSExec;
+ return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec;
}
-function execProxy() {
+function execProxy () {
cordovaExec().apply(null, arguments);
}
-execProxy.nativeFetchMessages = function() {
+execProxy.nativeFetchMessages = function () {
return cordovaExec().nativeFetchMessages.apply(null, arguments);
};
-execProxy.nativeEvalAndFetch = function() {
+execProxy.nativeEvalAndFetch = function () {
return cordovaExec().nativeEvalAndFetch.apply(null, arguments);
};
-execProxy.nativeCallback = function() {
+execProxy.nativeCallback = function () {
return cordovaExec().nativeCallback.apply(null, arguments);
};
module.exports = execProxy;
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
- // unregister the old bridge
- cordova.define.remove('cordova/exec');
- // redefine bridge to our new bridge
- cordova.define("cordova/exec", function(require, exports, module) {
- module.exports = execProxy;
- });
-}
\ No newline at end of file
+ // unregister the old bridge
+ cordova.define.remove('cordova/exec');
+ // redefine bridge to our new bridge
+ cordova.define('cordova/exec', function (require, exports, module) {
+ module.exports = execProxy;
+ });
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org