Skip to content

Commit

Permalink
refactor(eslint): use cordova-eslint w/ fix (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbru31 committed Aug 28, 2020
1 parent ed48242 commit 7e1c0f5
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 216 deletions.
23 changes: 23 additions & 0 deletions .eslintrc.yml
@@ -0,0 +1,23 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

root: true
extends: '@cordova/eslint-config/browser'

overrides:
- files: [tests/**/*.js]
extends: '@cordova/eslint-config/node-tests'
19 changes: 0 additions & 19 deletions .jshintrc

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -25,8 +25,8 @@
"cordova-browser"
],
"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 lint",
"lint": "eslint ."
},
"author": "Apache Software Foundation",
"license": "Apache-2.0",
Expand All @@ -38,6 +38,6 @@
}
},
"devDependencies": {
"jshint": "^2.6.0"
"@cordova/eslint-config": "^3.0.0"
}
}
6 changes: 3 additions & 3 deletions src/browser/CompassProxy.js
Expand Up @@ -17,12 +17,12 @@
* specific language governing permissions and limitations
* under the License.
*
*/
*/

var Compass = {
getHeading: function(success, error) {
getHeading: function (success, error) {
var orient = {};
var heading = (Math.round((Math.random() * 360) * 100) / 100);
var heading = Math.round(Math.random() * 360 * 100) / 100;

orient.trueHeading = heading;
orient.magneticHeading = heading;
Expand Down
19 changes: 8 additions & 11 deletions src/windows/CompassProxy.js
@@ -1,4 +1,4 @@
/*
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -17,17 +17,14 @@
* specific language governing permissions and limitations
* under the License.
*
*/
*/

/*jslint sloppy:true */
/*global Windows:true, require, module, setTimeout */

var CompassHeading = require('cordova-plugin-device-orientation.CompassHeading'),
CompassError = require('cordova-plugin-device-orientation.CompassError');
/* global Windows */

var CompassHeading = require('cordova-plugin-device-orientation.CompassHeading');
var CompassError = require('cordova-plugin-device-orientation.CompassError');

module.exports = {

onReadingChanged: null,
getHeading: function (win, lose) {
var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
Expand All @@ -36,8 +33,8 @@ module.exports = {
lose(CompassError.COMPASS_NOT_SUPPORTED);
}, 0);
} else {
var reading = deviceCompass.getCurrentReading(),
heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth, null, reading.timestamp.getTime());
var reading = deviceCompass.getCurrentReading();
var heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth, null, reading.timestamp.getTime());
setTimeout(function () {
win(heading);
}, 0);
Expand All @@ -50,4 +47,4 @@ module.exports = {
}
};

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

0 comments on commit 7e1c0f5

Please sign in to comment.