Skip to content
Permalink
Browse files
CB-12895 : setup eslint and removed jshint
  • Loading branch information
audreyso committed Aug 7, 2017
1 parent 965f65d commit 3dfbb7826fff868179dcc5e028992eedf9cb7121
Showing 11 changed files with 171 additions and 169 deletions.
@@ -0,0 +1,10 @@
root: true
extends: semistandard
rules:
indent:
- error
- 4
camelcase: off
padded-blocks: off
operator-linebreak: off
no-throw-literal: off

This file was deleted.

@@ -47,8 +47,8 @@
"cordova-osx"
],
"scripts": {
"test": "npm run jshint",
"jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
"test": "npm run eslint",
"eslint": "node node_modules/eslint/bin/eslint www && node node_modules/eslint/bin/eslint src && node node_modules/eslint/bin/eslint tests"
},
"author": "Apache Software Foundation",
"license": "Apache-2.0",
@@ -60,6 +60,12 @@
}
},
"devDependencies": {
"jshint": "^2.6.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"
}
}
@@ -23,17 +23,17 @@

function getModelName () {
var modelName = window.qnx.webplatform.device.modelName;
//Pre 10.2 (meaning Z10 or Q10)
if (typeof modelName === "undefined") {
// Pre 10.2 (meaning Z10 or Q10)
if (typeof modelName === 'undefined') {
if (window.screen.height === 720 && window.screen.width === 720) {
if ( window.matchMedia("(-blackberry-display-technology: -blackberry-display-oled)").matches) {
modelName = "Q10";
if (window.matchMedia('(-blackberry-display-technology: -blackberry-display-oled)').matches) {
modelName = 'Q10';
} else {
modelName = "Q5";
modelName = 'Q5';
}
} else if ((window.screen.height === 1280 && window.screen.width === 768) ||
(window.screen.height === 768 && window.screen.width === 1280)) {
modelName = "Z10";
modelName = 'Z10';
} else {
modelName = window.qnx.webplatform.deviceName;
}
@@ -43,28 +43,28 @@ function getModelName () {
}

function getUUID () {
var uuid = "";
var uuid = '';
try {
//Must surround by try catch because this will throw if the app is missing permissions
// Must surround by try catch because this will throw if the app is missing permissions
uuid = window.qnx.webplatform.device.devicePin;
} catch (e) {
//DO Nothing
// DO Nothing
}
return uuid;
}

module.exports = {
getDeviceInfo: function (success, fail, args, env) {
var result = new PluginResult(args, env),
modelName = getModelName(),
uuid = getUUID(),
info = {
manufacturer: 'BlackBerry',
platform: "blackberry10",
version: window.qnx.webplatform.device.scmBundle,
model: modelName,
uuid: uuid
};
var result = new PluginResult(args, env);
var modelName = getModelName();
var uuid = getUUID();
var info = {
manufacturer: 'BlackBerry',
platform: 'blackberry10',
version: window.qnx.webplatform.device.scmBundle,
model: modelName,
uuid: uuid
};

result.ok(info);
}
@@ -20,19 +20,19 @@
*/
var browser = require('cordova/platform');

function getPlatform() {
return "browser";
function getPlatform () {
return 'browser';
}

function getModel() {
function getModel () {
return getBrowserInfo(true);
}

function getVersion() {
function getVersion () {
return getBrowserInfo(false);
}

function getBrowserInfo(getModel) {
function getBrowserInfo (getModel) {
var userAgent = navigator.userAgent;
var returnVal = '';
var offset;
@@ -66,7 +66,6 @@ function getBrowserInfo(getModel) {
return returnVal;
}


module.exports = {
getDeviceInfo: function (success, error) {
setTimeout(function () {
@@ -82,4 +81,4 @@ module.exports = {
}
};

require("cordova/exec/proxy").add("Device", module.exports);
require('cordova/exec/proxy').add('Device', module.exports);
@@ -18,14 +18,14 @@
* under the License.
*
*/
//example UA String for Firefox OS
//Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0
// example UA String for Firefox OS
// Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0

//UA parsing not recommended but currently this is the only way to get the Firefox OS version
//https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference
// UA parsing not recommended but currently this is the only way to get the Firefox OS version
// https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference

//Should be replaced when better conversion to Firefox OS Version is available
function convertVersionNumber(ver) {
// Should be replaced when better conversion to Firefox OS Version is available
function convertVersionNumber (ver) {
var hashVersion = {
'18.0': '1.0.1',
'18.1': '1.1',
@@ -42,7 +42,7 @@ function convertVersionNumber(ver) {
return (rver);

}
function getVersion() {
function getVersion () {
if (navigator.userAgent.match(/(mobile|tablet)/i)) {
var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/));
if (ffVersionArray.length === 2) {
@@ -52,7 +52,7 @@ function getVersion() {
return (null);
}

function getModel() {
function getModel () {
var uaArray = navigator.userAgent.split(/\s*[;)(]\s*/);
if (navigator.userAgent.match(/(mobile|tablet)/i)) {
if (uaArray.length === 5) {
@@ -74,4 +74,4 @@ module.exports = {
}
};

require("cordova/exec/proxy").add("Device", module.exports);
require('cordova/exec/proxy').add('Device', module.exports);
@@ -22,7 +22,7 @@
var tizen = require('cordova/platform');

module.exports = {
getDeviceInfo: function(success, error) {
getDeviceInfo: function (success, error) {
setTimeout(function () {
success({
cordova: tizen.cordovaVersion,
@@ -35,4 +35,4 @@ module.exports = {
}
};

require("cordova/tizen/commandProxy").add("Device", module.exports);
require('cordova/tizen/commandProxy').add('Device', module.exports);
@@ -22,12 +22,16 @@
/* global Cordova */

module.exports = {
getInfo:function(win,fail,args) {
getInfo: function (win, fail, args) {
Cordova.exec(function (model, cordova, platform, uuid, version) {
win({name: name, model: model, cordova: cordova,
platform: platform, uuid: uuid, version: version});
}, null, "com.cordova.Device", "getInfo", []);
win({name: name, // eslint-disable-line no-undef
model: model,
cordova: cordova,
platform: platform,
uuid: uuid,
version: version});
}, null, 'com.cordova.Device', 'getInfo', []);
}
};

require("cordova/exec/proxy").add("Device", module.exports);
require('cordova/exec/proxy').add('Device', module.exports);
@@ -21,25 +21,24 @@

/* global Windows, createUUID */

var ROOT_CONTAINER = "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}";
var DEVICE_CLASS_KEY = "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10";
var DEVICE_CLASS_KEY_NO_SEMICOLON = "{A45C254E-DF1C-4EFD-8020-67D146A850E0}10";
var ROOT_CONTAINER_QUERY = "System.Devices.ContainerId:=\"" + ROOT_CONTAINER + "\"";
var HAL_DEVICE_CLASS = "4d36e966-e325-11ce-bfc1-08002be10318";
var DEVICE_DRIVER_VERSION_KEY = "{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3";
var ROOT_CONTAINER = '{00000000-0000-0000-FFFF-FFFFFFFFFFFF}';
var DEVICE_CLASS_KEY = '{A45C254E-DF1C-4EFD-8020-67D146A850E0},10';
var DEVICE_CLASS_KEY_NO_SEMICOLON = '{A45C254E-DF1C-4EFD-8020-67D146A850E0}10';
var ROOT_CONTAINER_QUERY = 'System.Devices.ContainerId:="' + ROOT_CONTAINER + '"';
var HAL_DEVICE_CLASS = '4d36e966-e325-11ce-bfc1-08002be10318';
var DEVICE_DRIVER_VERSION_KEY = '{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3';

module.exports = {

getDeviceInfo:function(win, fail, args) {
getDeviceInfo: function (win, fail, args) {

// deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
var deviceId;
// get deviceId, or create and store one
var localSettings = Windows.Storage.ApplicationData.current.localSettings;
if (localSettings.values.deviceId) {
deviceId = localSettings.values.deviceId;
}
else {
} else {
// App-specific hardware id could be used as uuid, but it changes if the hardware changes...
try {
var ASHWID = Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(null).id;
@@ -48,22 +47,21 @@ module.exports = {
// Couldn't get the hardware UUID
deviceId = createUUID();
}
//...so cache it per-install
// ...so cache it per-install
localSettings.values.deviceId = deviceId;
}


var userAgent = window.clientInformation.userAgent;
// this will report "windows" in windows8.1 and windows phone 8.1 apps
// and "windows8" in windows 8.0 apps similar to cordova.js
// See https://github.com/apache/cordova-js/blob/master/src/windows/platform.js#L25
var devicePlatform = userAgent.indexOf("MSAppHost/1.0") == -1 ? "windows" : "windows8";
var devicePlatform = userAgent.indexOf('MSAppHost/1.0') === -1 ? 'windows' : 'windows8';
var versionString = userAgent.match(/Windows (?:Phone |NT )?([0-9.]+)/)[1];

var deviceInfo = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();
// Running in the Windows Simulator is a remote session.
// Running in the Windows Phone Emulator has the systemProductName set to "Virtual"
var isVirtual = Windows.System.RemoteDesktop.InteractiveSession.isRemote || deviceInfo.systemProductName == "Virtual";
var isVirtual = Windows.System.RemoteDesktop.InteractiveSession.isRemote || deviceInfo.systemProductName === 'Virtual';
var manufacturer = deviceInfo.systemManufacturer;
var model = deviceInfo.systemProductName;

@@ -73,26 +71,26 @@ module.exports = {
[DEVICE_DRIVER_VERSION_KEY, DEVICE_CLASS_KEY],
ROOT_CONTAINER_QUERY)
.then(function (rootDevices) {
for (var i = 0; i < rootDevices.length; i++) {
var rootDevice = rootDevices[i];
if (!rootDevice.properties) continue;
if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] == HAL_DEVICE_CLASS) {
versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY];
break;
}
for (var i = 0; i < rootDevices.length; i++) {
var rootDevice = rootDevices[i];
if (!rootDevice.properties) continue;
if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] === HAL_DEVICE_CLASS) {
versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY];
break;
}
}

setTimeout(function () {
win({ platform: devicePlatform,
version: versionString,
uuid: deviceId,
isVirtual: isVirtual,
model: model,
manufacturer:manufacturer});
}, 0);
setTimeout(function () {
win({ platform: devicePlatform,
version: versionString,
uuid: deviceId,
isVirtual: isVirtual,
model: model,
manufacturer: manufacturer});
}, 0);
});
}

}; // exports

require("cordova/exec/proxy").add("Device", module.exports);
require('cordova/exec/proxy').add('Device', module.exports);

0 comments on commit 3dfbb78

Please sign in to comment.