Skip to content

Commit

Permalink
dep: bump @cordova/eslint-config@^4.0.0 w/ fix (#226)
Browse files Browse the repository at this point in the history
* dep(npm): bump @cordova/eslint-config@^4.0.0
* style: apply eslint auto corrections
* style: apply eslint manual corrections
  • Loading branch information
erisu authored May 20, 2022
1 parent de5e8bd commit d6d3d41
Show file tree
Hide file tree
Showing 7 changed files with 8,804 additions and 1,609 deletions.
12 changes: 6 additions & 6 deletions bin/templates/platform_www/cdv-electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ let mainWindow;
function createWindow () {
// Create the browser window.
let appIcon;
if (fs.existsSync(`${__dirname}/img/app.png`)) {
appIcon = `${__dirname}/img/app.png`;
} else if (fs.existsSync(`${__dirname}/img/icon.png`)) {
appIcon = `${__dirname}/img/icon.png`;
if (fs.existsSync(path.join(__dirname, 'img/app.png'))) {
appIcon = path.join(__dirname, 'img/app.png');
} else if (fs.existsSync(path.join(__dirname, 'img/icon.png'))) {
appIcon = path.join(__dirname, 'img/icon.png');
} else {
appIcon = `${__dirname}/img/logo.png`;
appIcon = path.join(__dirname, 'img/logo.png');
}

const browserWindowOpts = Object.assign({}, cdvElectronSettings.browserWindow, { icon: appIcon });
Expand Down Expand Up @@ -101,7 +101,7 @@ function createWindow () {
function configureProtocol () {
protocol.registerFileProtocol(scheme, (request, cb) => {
const url = request.url.substr(basePath.length + 1);
cb({ path: path.normalize(`${__dirname}/${url}`) });
cb({ path: path.normalize(path.join(__dirname, url)) }); // eslint-disable-line node/no-callback-literal
});

protocol.interceptFileProtocol('file', (_, cb) => { cb(null); });
Expand Down
6 changes: 3 additions & 3 deletions cordova-js-src/confighelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Config (xhr) {
}

function readConfig (success, error) {
var xhr;
let xhr; // eslint-disable-line prefer-const

if (typeof config !== 'undefined') {
success(config);
Expand All @@ -49,7 +49,7 @@ function readConfig (success, error) {
}
}

var xhrStatusChangeHandler = function () {
const xhrStatusChangeHandler = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200 || xhr.status === 304 || xhr.status === 0 /* file:// */) {
config = new Config(xhr);
Expand All @@ -76,7 +76,7 @@ function readConfig (success, error) {
* Returns preference value or undefined if it does not exist.
* @param {String} preferenceName Preference name to read */
Config.prototype.getPreferenceValue = function getPreferenceValue (preferenceName) {
var preferenceItem = this.preferences && this.preferences.filter(function (item) {
const preferenceItem = this.preferences && this.preferences.filter(function (item) {
return item.attributes.name && item.attributes.name.value === preferenceName;
});

Expand Down
10 changes: 5 additions & 5 deletions cordova-js-src/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ module.exports = function (success, fail, service, action, args) {
args = args || [];

if (proxy) {
var callbackId = service + cordova.callbackId++;
const callbackId = service + cordova.callbackId++;

if (typeof success === 'function' || typeof fail === 'function') {
cordova.callbacks[callbackId] = { success: success, fail: fail };
}
try {
// callbackOptions param represents additional optional parameters command could pass back, like keepCallback or
// custom callbackId, for example {callbackId: id, keepCallback: true, status: cordova.callbackStatus.JSON_EXCEPTION }
var onSuccess = function (result, callbackOptions) {
const onSuccess = function (result, callbackOptions) {
callbackOptions = callbackOptions || {};
var callbackStatus;
let callbackStatus;
// covering both undefined and null.
// strict null comparison was causing callbackStatus to be undefined
// and then no callback was called because of the check in cordova.callbackFromNative
Expand All @@ -76,9 +76,9 @@ module.exports = function (success, fail, service, action, args) {
keepCallback: callbackOptions.keepCallback || false
});
};
var onError = function (err, callbackOptions) {
const onError = function (err, callbackOptions) {
callbackOptions = callbackOptions || {};
var callbackStatus;
let callbackStatus;
// covering both undefined and null.
// strict null comparison was causing callbackStatus to be undefined
// and then no callback was called because of the check in cordova.callbackFromNative
Expand Down
4 changes: 2 additions & 2 deletions cordova-js-src/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
cordovaVersion: '4.2.0', // cordova-js

bootstrap: function () {
var modulemapper = require('cordova/modulemapper');
var channel = require('cordova/channel');
const modulemapper = require('cordova/modulemapper');
const channel = require('cordova/channel');

modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');

Expand Down
2 changes: 1 addition & 1 deletion lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function findHighResIcons (icons) {
: false
);

const highResIcons = icons.filter(icon => {
const highResIcons = icons.filter(icon => { // eslint-disable-line array-callback-return
if (icon.src.includes('@')) {
const extension = path.extname(icon.src);
const suffix = icon.src.split('@').pop().slice(0, -extension.length);
Expand Down
Loading

0 comments on commit d6d3d41

Please sign in to comment.