ESLint upgrade, implement additional rules (#3230)

* upgrade to ESLintv7, added overrides for rules violated
* removed overrides for spec files
* fixed no-prototype-builtins issues
* added rules for default-case-last, default-param-last, grouped-accessor-pairs, no-constructor-return, and added override for one violation

Co-authored-by: Andrew Henry <akhenry@gmail.com>
Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
This commit is contained in:
Joel McKinnon
2020-08-10 11:23:35 -07:00
committed by GitHub
parent ef965ebdfd
commit 4d560086dd
119 changed files with 194 additions and 225 deletions

View File

@ -28,7 +28,7 @@ define(function () {
}
BundleRegistry.prototype.register = function (path, definition) {
if (this.knownBundles.hasOwnProperty(path)) {
if (Object.prototype.hasOwnProperty.call(this.knownBundles, path)) {
throw new Error('Cannot register bundle with duplicate path', path);
}

View File

@ -29,7 +29,7 @@ define([], function () {
view,
legacyObject
) {
if (view.hasOwnProperty('provider')) {
if (Object.prototype.hasOwnProperty.call(view, 'provider')) {
var domainObject = legacyObject.useCapability('adapter');
return view.provider.canView(domainObject);

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open openmct, Copyright (c) 2014-2018, United States Government
* Open openmct, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console */
define([
], function (
@ -28,7 +27,7 @@ define([
) {
function checkForDeprecatedFunctionality(typeDef) {
if (typeDef.hasOwnProperty('telemetry')) {
if (Object.prototype.hasOwnProperty.call(typeDef, 'telemetry')) {
console.warn(
'DEPRECATION WARNING: Telemetry data on type '
+ 'registrations will be deprecated in a future version, '

View File

@ -21,7 +21,7 @@ define([
});
let inspectorTypes = openmct.$injector.get('types[]')
.filter((t) => t.hasOwnProperty('inspector'));
.filter((t) => Object.prototype.hasOwnProperty.call(t, 'inspector'));
inspectorTypes.forEach(function (typeDefinition) {
openmct.inspectorViews.addProvider(new TypeInspectorViewProvider(typeDefinition, openmct, convertToLegacyObject));

View File

@ -299,7 +299,7 @@ export default class NotificationAPI extends EventEmitter {
this._dismiss(notification);
};
if (notificationModel.hasOwnProperty('progressPerc')) {
if (Object.prototype.hasOwnProperty.call(notificationModel, 'progressPerc')) {
notification.progress = (progressPerc, progressText) => {
notification.model.progressPerc = progressPerc;
notification.model.progressText = progressText;

View File

@ -32,8 +32,8 @@ define([
*/
function isIdentifier(thing) {
return typeof thing === 'object'
&& thing.hasOwnProperty('key')
&& thing.hasOwnProperty('namespace');
&& Object.prototype.hasOwnProperty.call(thing, 'key')
&& Object.prototype.hasOwnProperty.call(thing, 'namespace');
}
/**

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define([
'./TelemetryMetadataManager',
'./TelemetryValueFormatter',
@ -247,15 +247,15 @@ define([
* @private
*/
TelemetryAPI.prototype.standardizeRequestOptions = function (options) {
if (!options.hasOwnProperty('start')) {
if (!Object.prototype.hasOwnProperty.call(options, 'start')) {
options.start = this.openmct.time.bounds().start;
}
if (!options.hasOwnProperty('end')) {
if (!Object.prototype.hasOwnProperty.call(options, 'end')) {
options.end = this.openmct.time.bounds().end;
}
if (!options.hasOwnProperty('domain')) {
if (!Object.prototype.hasOwnProperty.call(options, 'domain')) {
options.domain = this.openmct.time.timeSystem().key;
}
};
@ -386,7 +386,7 @@ define([
}).reduce(function (a, b) {
var results = {};
Object.keys(a).forEach(function (key) {
if (b.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(b, key)) {
results[key] = a[key];
}
});

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define([
'lodash'
@ -31,26 +30,26 @@ define([
valueMetadata.source = valueMetadata.source || valueMetadata.key;
valueMetadata.hints = valueMetadata.hints || {};
if (valueMetadata.hints.hasOwnProperty('x')) {
if (Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'x')) {
console.warn(
'DEPRECATION WARNING: `x` hints should be replaced with '
+ '`domain` hints moving forward. '
+ 'https://github.com/nasa/openmct/issues/1546'
);
if (!valueMetadata.hints.hasOwnProperty('domain')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'domain')) {
valueMetadata.hints.domain = valueMetadata.hints.x;
}
delete valueMetadata.hints.x;
}
if (valueMetadata.hints.hasOwnProperty('y')) {
if (Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'y')) {
console.warn(
'DEPRECATION WARNING: `y` hints should be replaced with '
+ '`range` hints moving forward. '
+ 'https://github.com/nasa/openmct/issues/1546'
);
if (!valueMetadata.hints.hasOwnProperty('range')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'range')) {
valueMetadata.hints.range = valueMetadata.hints.y;
}
@ -62,16 +61,16 @@ define([
valueMetadata.values = valueMetadata.enumerations.map(e => e.value);
}
if (!valueMetadata.hasOwnProperty('max')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata, 'max')) {
valueMetadata.max = Math.max(valueMetadata.values) + 1;
}
if (!valueMetadata.hasOwnProperty('min')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata, 'min')) {
valueMetadata.min = Math.min(valueMetadata.values) - 1;
}
}
if (!valueMetadata.hints.hasOwnProperty('priority')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'priority')) {
valueMetadata.hints.priority = index;
}
@ -115,7 +114,7 @@ define([
) {
function hasHint(hint) {
// eslint-disable-next-line no-invalid-this
return this.hints.hasOwnProperty(hint);
return Object.prototype.hasOwnProperty.call(this.hints, hint);
}
function hasHints(metadata) {

View File

@ -63,7 +63,7 @@ define([
byString: {}
});
this.formatter.format = function (value) {
if (this.enumerations.byValue.hasOwnProperty(value)) {
if (Object.prototype.hasOwnProperty.call(this.enumerations.byValue, value)) {
return this.enumerations.byValue[value];
}
@ -71,7 +71,7 @@ define([
}.bind(this);
this.formatter.parse = function (string) {
if (typeof string === "string") {
if (this.enumerations.byString.hasOwnProperty(string)) {
if (Object.prototype.hasOwnProperty.call(this.enumerations.byString, string)) {
return this.enumerations.byString[string];
}
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define(['./Type'], function (Type) {
/**
@ -63,7 +62,7 @@ define(['./Type'], function (Type) {
* @private
*/
TypeRegistry.prototype.standardizeType = function (typeDef) {
if (typeDef.hasOwnProperty('label')) {
if (Object.prototype.hasOwnProperty.call(typeDef, 'label')) {
console.warn(
'DEPRECATION WARNING typeDef: ' + typeDef.label + '. '
+ '`label` is deprecated in type definitions. Please use '

View File

@ -303,7 +303,7 @@ export default class ConditionManager extends EventEmitter {
isTelemetryUsed(endpoint) {
const id = this.openmct.objects.makeKeyString(endpoint.identifier);
for (const condition of this.conditions) {
for (let condition of this.conditions) {
if (condition.isTelemetryUsed(id)) {
return true;
}

View File

@ -213,9 +213,9 @@ export default {
this.enumerations = foundMetadata.enumerations;
} else if (foundMetadata.format === 'string' || foundMetadata.format === 'number') {
this.operationFormat = foundMetadata.format;
} else if (foundMetadata.hints.hasOwnProperty('range')) {
} else if (Object.prototype.hasOwnProperty.call(foundMetadata.hints, 'range')) {
this.operationFormat = 'number';
} else if (foundMetadata.hints.hasOwnProperty('domain')) {
} else if (Object.prototype.hasOwnProperty.call(foundMetadata.hints, 'domain')) {
this.operationFormat = 'number';
} else if (foundMetadata.key === 'name') {
this.operationFormat = 'string';

View File

@ -34,7 +34,7 @@ export function evaluateResults(results, trigger) {
}
function matchAll(results) {
for (const result of results) {
for (let result of results) {
if (result !== true) {
return false;
}
@ -44,7 +44,7 @@ function matchAll(results) {
}
function matchAny(results) {
for (const result of results) {
for (let result of results) {
if (result === true) {
return true;
}
@ -55,7 +55,7 @@ function matchAny(results) {
function matchExact(results, target) {
let matches = 0;
for (const result of results) {
for (let result of results) {
if (result === true) {
matches++;
}

View File

@ -375,8 +375,8 @@ export default {
.filter(type => type.startsWith(DRAG_OBJECT_TRANSFER_PREFIX))
.map(type => type.substring(DRAG_OBJECT_TRANSFER_PREFIX.length))[0];
// If the layout already contains the given object, then shortcut the default dragover behavior and
// potentially allow drop. Display layouts allow drag drop of duplicate telemetry objects.
// If the layout already contains the given object, then shortcut the default dragover behavior and
// potentially allow drop. Display layouts allow drag drop of duplicate telemetry objects.
if (this.containsObject(draggedKeyString)) {
$event.preventDefault();
}

View File

@ -14,6 +14,7 @@ export default class SnapshotContainer extends EventEmitter {
this.openmct = openmct;
// eslint-disable-next-line
return SnapshotContainer.instance;
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/chart/MCTChartDirective",
"./src/plot/MCTPlotDirective",

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'../lib/extend',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,requestAnimationFrame,Float32Array*/
/**
* Module defining MCTChart. Created by vwoeltje on 11/12/14.

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/**
* Module defining MCTChart. Created by vwoeltje on 11/12/14.

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'./MCTChartSeriesElement'

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'./MCTChartSeriesElement'

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'./MCTChartSeriesElement'

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Float32Array*/
define([
'../lib/extend',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'EventEmitter',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'lodash',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'./Collection',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'lodash',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console */
define(
[

View File

@ -1,4 +1,25 @@
/*global define*/
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open openmct is licensed 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.
*
* Open openmct includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'./Region'
], function (

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console */
define(function () {

View File

@ -33,7 +33,7 @@ define([
child,
Surrogate;
if (props && props.hasOwnProperty('constructor')) {
if (props && Object.prototype.hasOwnProperty.call(props, 'constructor')) {
child = props.constructor;
} else {
child = function () {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console*/
/**
* Module defining ExportImageService. Created by hudsonfoo on 09/02/16
*/

View File

@ -122,7 +122,7 @@ define([], function () {
$scope.$on('plot:tickWidth', function ($e, width) {
const plotId = $e.targetScope.domainObject.getId();
if (!tickWidthMap.hasOwnProperty(plotId)) {
if (!Object.prototype.hasOwnProperty.call(tickWidthMap, plotId)) {
return;
}

View File

@ -9,8 +9,7 @@ define ([
objectUtils,
EventEmitter,
$,
_,
_
) {
/**
@ -133,9 +132,9 @@ define ([
var type;
if (valueMetadata.enumerations !== undefined) {
type = 'enum';
} else if (valueMetadata.hints.hasOwnProperty('range')) {
} else if (Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'range')) {
type = 'number';
} else if (valueMetadata.hints.hasOwnProperty('domain')) {
} else if (Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'domain')) {
type = 'number';
} else if (valueMetadata.key === 'name') {
type = 'string';

View File

@ -1,5 +1,25 @@
/*global define*/
// jscs:disable disallowDanglingUnderscores
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed 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.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([], function () {
var helperFunctions = {
listenTo: function (object, event, callback, context) {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,8 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*jshint latedef: nofunc */
/*global console */
define([
'objectUtils',
'./TelemetryAverager'

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine, spyOn */
define([], function () {
function MockTelemetryApi() {

View File

@ -270,7 +270,7 @@ define([
}
isTelemetryObject(domainObject) {
return domainObject.hasOwnProperty('telemetry');
return Object.prototype.hasOwnProperty.call(domainObject, 'telemetry');
}
buildOptionsFromConfiguration(telemetryObject) {

View File

@ -41,7 +41,7 @@ define(function () {
}
hasValueForDatum(telemetryDatum) {
return telemetryDatum.hasOwnProperty(this.metadatum.source);
return Object.prototype.hasOwnProperty.call(telemetryDatum, this.metadatum.source);
}
getRawValue(telemetryDatum) {

View File

@ -31,7 +31,7 @@ define([
) {
function TelemetryTableViewProvider(openmct) {
function hasTelemetry(domainObject) {
if (!domainObject.hasOwnProperty('telemetry')) {
if (!Object.prototype.hasOwnProperty.call(domainObject, 'telemetry')) {
return false;
}

View File

@ -104,7 +104,7 @@ define(
}
rowHasColumn(row, key) {
return row.columns.hasOwnProperty(key);
return Object.prototype.hasOwnProperty.call(row.columns, key);
}
destroy() {

View File

@ -36,7 +36,7 @@ define([
openmct.types.addType('table', TelemetryTableType);
openmct.composition.addPolicy((parent, child) => {
if (parent.type === 'table') {
return child.hasOwnProperty('telemetry');
return Object.prototype.hasOwnProperty.call(child, 'telemetry');
} else {
return true;
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console */
define([], function () {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console */
define([], function () {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console */
define(['EventEmitter'], function (EventEmitter) {
const DEFAULT_VIEW_PRIORITY = 100;

View File

@ -1,9 +1,25 @@
/**
Application router -- must
*/
/*global _,module*/
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed 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.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global module*/
const LocationBar = require('location-bar');
const EventEmitter = require('EventEmitter');
@ -124,18 +140,16 @@ class ApplicationRouter extends EventEmitter {
doParamsChange(newParams, oldParams, newLocation) {
let changedParams = {};
for (let [key, value] of Object.entries(newParams)) {
Object.entries(newParams).forEach(([key, value]) => {
if (value !== oldParams[key]) {
changedParams[key] = value;
}
}
for (let key of Object.keys(oldParams)) {
if (!newParams.hasOwnProperty(key)) {
});
Object.keys(oldParams).forEach(key => {
if (!Object.prototype.hasOwnProperty.call(newParams, key)) {
changedParams[key] = undefined;
}
}
});
this.emit('change:params', newParams, oldParams, changedParams);
}
@ -144,14 +158,13 @@ class ApplicationRouter extends EventEmitter {
*/
updateParams(updateParams) {
let searchParams = this.currentLocation.url.searchParams;
for (let [key, value] of Object.entries(updateParams)) {
Object.entries(updateParams).forEach(([key, value]) => {
if (typeof value === 'undefined') {
searchParams.delete(key);
} else {
searchParams.set(key, value);
}
}
});
this.setQueryString(searchParams.toString());
}

View File

@ -179,7 +179,7 @@ export default {
}
});
for (const key in values) {
for (let key in values) {
if (values[key].every(val => val === values[key][0])) {
value[key] = values[key][0];
toolbarItem.nonSpecific = false;