From 32c51665013f26580d5db7627c5e3a48adaa4f37 Mon Sep 17 00:00:00 2001 From: Erisu Date: Tue, 14 Jul 2020 17:13:37 +0900 Subject: [PATCH] feat: migrate to @cordova/eslint-config@3.x --- .eslintrc.yml | 31 ++++++++++++++++++++++--------- package.json | 12 +++--------- src/browser/CameraProxy.js | 2 +- src/windows/CameraProxy.js | 5 +---- tests/tests.js | 8 ++++---- www/ios/CameraPopoverHandle.js | 2 +- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 0cccb8c7a..421bf5335 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,10 +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: 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/package.json b/package.json index 1a76c63d1..3c7630385 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "cordova-osx" ], "scripts": { - "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" + "test": "npm run lint", + "lint": "eslint ." }, "author": "Apache Software Foundation", "license": "Apache-2.0", @@ -51,12 +51,6 @@ } }, "devDependencies": { - "eslint": "^4.3.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/browser/CameraProxy.js b/src/browser/CameraProxy.js index ff81257a6..662ee7f46 100644 --- a/src/browser/CameraProxy.js +++ b/src/browser/CameraProxy.js @@ -112,7 +112,7 @@ function capture (success, errorCallback, opts) { }; if (navigator.getUserMedia) { - navigator.getUserMedia({video: true, audio: false}, successCallback, errorCallback); + navigator.getUserMedia({ video: true, audio: false }, successCallback, errorCallback); } else { alert('Browser does not support camera :('); } diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js index 7ede906f9..5ab21bd96 100644 --- a/src/windows/CameraProxy.js +++ b/src/windows/CameraProxy.js @@ -374,7 +374,6 @@ function takePictureFromCameraWP (successCallback, errorCallback, args) { return capture.initializeAsync(captureSettings); }).then(function () { - // create focus control if available var VideoDeviceController = capture.videoDeviceController; var FocusControl = VideoDeviceController.focusControl; @@ -477,7 +476,6 @@ function takePictureFromCameraWP (successCallback, errorCallback, args) { } function captureAction () { - var encodingProperties; var fileName; var tempFolder = getAppData().temporaryFolder; @@ -715,7 +713,7 @@ function takePictureFromCameraWindows (successCallback, errorCallback, args) { if (targetWidth === -1 && targetHeight === -1) { maxRes = UIMaxRes.highestAvailable; - // Temp fix for CB-10539 + // Temp fix for CB-10539 /* else if (totalPixels <= 320 * 240) { maxRes = UIMaxRes.verySmallQvga; } */ @@ -812,7 +810,6 @@ function savePhoto (picture, options, successCallback, errorCallback) { if (!options.saveToPhotoAlbum) { success(picture); - } else { var savePicker = new Windows.Storage.Pickers.FileSavePicker(); var saveFile = function (file) { diff --git a/tests/tests.js b/tests/tests.js index e4425d403..23bc470f3 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -378,7 +378,7 @@ exports.defineManualTests = function (contentEl, createActionButton) { var options = ''; if (typeof values === 'boolean') { - values = { 'true': 1, 'false': 0 }; + values = { true: 1, false: 0 }; } for (var k in values) { var isSelected = ''; @@ -409,9 +409,9 @@ exports.defineManualTests = function (contentEl, createActionButton) { createOptionsEl('destinationType', Camera.DestinationType, camDestinationTypeDefault) + createOptionsEl('encodingType', Camera.EncodingType, camEncodingTypeDefault) + createOptionsEl('mediaType', Camera.MediaType, camMediaTypeDefault) + - createOptionsEl('quality', { '0': 0, '50': 50, '80': 80, '100': 100 }, camQualityDefault) + - createOptionsEl('targetWidth', { '50': 50, '200': 200, '800': 800, '2048': 2048 }) + - createOptionsEl('targetHeight', { '50': 50, '200': 200, '800': 800, '2048': 2048 }) + + createOptionsEl('quality', { 0: 0, 50: 50, 80: 80, 100: 100 }, camQualityDefault) + + createOptionsEl('targetWidth', { 50: 50, 200: 200, 800: 800, 2048: 2048 }) + + createOptionsEl('targetHeight', { 50: 50, 200: 200, 800: 800, 2048: 2048 }) + createOptionsEl('allowEdit', true, camAllowEditDefault) + createOptionsEl('correctOrientation', true, camCorrectOrientationDefault) + createOptionsEl('saveToPhotoAlbum', true, camSaveToPhotoAlbumDefault) + diff --git a/www/ios/CameraPopoverHandle.js b/www/ios/CameraPopoverHandle.js index 30728d158..15f170fc2 100644 --- a/www/ios/CameraPopoverHandle.js +++ b/www/ios/CameraPopoverHandle.js @@ -58,7 +58,7 @@ var CameraPopoverHandle = function () { * @param {module:CameraPopoverOptions} popoverOptions */ this.setPosition = function (popoverOptions) { - var args = [ popoverOptions ]; + var args = [popoverOptions]; exec(null, null, 'Camera', 'repositionPopover', args); }; };