From ed8f15e91da83703217eb8bda7bc8cddad911929 Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Mon, 8 Jun 2020 12:44:54 -0300 Subject: [PATCH] refactor(eslint): use cordova-eslint (#115) --- .eslintrc.yml | 32 +++++++++++++++++++++++--------- .travis.yml | 2 +- package.json | 12 +++--------- src/windows/NetworkInfoProxy.js | 1 - tests/tests.js | 10 +++++----- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 0cccb8c..60dfb7f 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,10 +1,24 @@ +# 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: semistandard -rules: - indent: - - error - - 4 - camelcase: off - padded-blocks: off - operator-linebreak: off - no-throw-literal: off \ No newline at end of file + +extends: '@cordova/eslint-config/browser' + +overrides: + - files: [tests/**/*.js] + extends: '@cordova/eslint-config/node-tests' diff --git a/.travis.yml b/.travis.yml index 62b1d7e..6510f63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -92,7 +92,7 @@ before_script: - | if [[ "$TRAVIS_REPO_SLUG" =~ cordova-paramedic ]]; then # when used in the cordova-paramedic repo - TEST_COMMAND="npm run eslint" + TEST_COMMAND="npm run lint" PARAMEDIC_PLUGIN_TO_TEST="./spec/testable-plugin/" PARAMEDIC_COMMAND="node main.js" else diff --git a/package.json b/package.json index 1da5d2e..9ac4c96 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "cordova-browser" ], "scripts": { - "test": "npm run eslint", - "eslint": "eslint www && eslint src && eslint tests" + "test": "npm run lint", + "lint": "eslint ." }, "author": "Apache Software Foundation", "license": "Apache-2.0", @@ -43,12 +43,6 @@ } }, "devDependencies": { - "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" + "@cordova/eslint-config": "^3.0.0" } } diff --git a/src/windows/NetworkInfoProxy.js b/src/windows/NetworkInfoProxy.js index e07ecc6..c4f0540 100644 --- a/src/windows/NetworkInfoProxy.js +++ b/src/windows/NetworkInfoProxy.js @@ -27,7 +27,6 @@ var winNetConn = Windows.Networking.Connectivity; var networkInfo = winNetConn.NetworkInformation; function getCurrrentConnectionType () { - var profile = networkInfo.getInternetConnectionProfile(); if (!profile) { diff --git a/tests/tests.js b/tests/tests.js index c28e7eb..3471fff 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -31,14 +31,14 @@ exports.defineAutoTests = function () { it('network.spec.2 should be set to a valid value', function () { var validValues = { - 'unknown': 1, - 'ethernet': 1, - 'wifi': 1, + unknown: 1, + ethernet: 1, + wifi: 1, '2g': 1, - 'cellular': 1, + cellular: 1, '3g': 1, '4g': 1, - 'none': 1 + none: 1 }; expect(validValues[navigator.connection.type]).toBe(1); });