From ef965ebdfd55d5e834bfbf9ffa8f33e8d11f460d Mon Sep 17 00:00:00 2001 From: Joel McKinnon <JoelMcKinnon@users.noreply.github.com> Date: Mon, 10 Aug 2020 10:59:18 -0700 Subject: [PATCH] ESLint rules: array-callback-return, no-invalid-this, func-style (#3151) * satisfied array-callback-return rule * satisfying no-invalid-this rule * fixed invalid-this issues * changed isNotEqual to arrow function * added rule func-style * added return false to satisfy array-callback-return rule Co-authored-by: Joel McKinnon <jmckinnon@apple.com> Co-authored-by: Joshi <simplyrender@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> --- .eslintrc.js | 6 +++ example/generator/WorkerInterface.js | 4 +- package.json | 4 +- .../commonUI/edit/src/actions/SaveAsAction.js | 2 +- .../edit/src/creation/CreateWizard.js | 5 +- .../test/services/MockCopyService.js | 4 +- .../test/services/MockLinkService.js | 6 +-- .../test/services/MockMoveService.js | 4 +- platform/forms/src/FileInputService.js | 1 + .../src/register/CustomRegistrars.js | 1 + .../test/services/SearchAggregatorSpec.js | 25 ++++----- platform/telemetry/src/TelemetryCapability.js | 13 ++--- src/api/telemetry/TelemetryMetadataManager.js | 2 +- .../autoflow/AutoflowTabularPluginSpec.js | 1 + .../components/ConditionCollection.vue | 43 ++++++++------- .../inspector/ConditionalStylesView.vue | 16 +++--- .../components/inspector/StylesView.vue | 16 +++--- src/plugins/condition/utils/evaluator.js | 4 +- src/plugins/condition/utils/operations.js | 16 +++--- src/plugins/condition/utils/styleUtils.js | 50 ++++++++--------- src/plugins/condition/utils/time.js | 28 +++++----- .../components/SubobjectView.vue | 2 +- .../flexibleLayout/components/frame.vue | 2 +- src/plugins/imagery/ImageryViewProvider.js | 4 +- src/plugins/notebook/components/notebook.vue | 2 +- .../notebook/utils/notebook-entries.js | 28 +++++----- src/plugins/objectMigration/Migrations.js | 2 + .../plot/src/configuration/XAxisModel.js | 4 +- .../plot/src/configuration/YAxisModel.js | 16 +++--- .../src/inspector/PlotModelFormController.js | 12 +++-- src/plugins/plot/src/lib/extend.js | 3 +- .../plot/src/plot/MCTPlotController.js | 11 ++-- .../plot/src/telemetry/PlotController.js | 10 ++-- src/plugins/staticRootPlugin/plugin.js | 9 ++-- src/plugins/summaryWidget/src/Rule.js | 3 ++ .../summaryWidget/src/input/ColorPalette.js | 1 + .../summaryWidget/src/input/IconPalette.js | 1 + .../summaryWidget/test/input/KeySelectSpec.js | 20 +++---- .../test/input/ObjectSelectSpec.js | 12 ++--- .../test/input/OperationSelectSpec.js | 20 +++---- .../src/MeanTelemetryProviderSpec.js | 2 +- src/plugins/themes/installTheme.js | 4 +- .../timeConductor/ConductorHistory.vue | 9 ++-- src/plugins/timeConductor/plugin.js | 7 ++- src/selection/Selection.js | 5 +- src/ui/layout/Layout.vue | 54 +++++++++---------- src/ui/registries/ToolbarRegistry.js | 6 +-- src/ui/router/Browse.js | 4 +- src/ui/toolbar/Toolbar.vue | 4 +- 49 files changed, 262 insertions(+), 246 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index fbb81b8cf5..bfcd58bdbc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -120,6 +120,12 @@ module.exports = { "no-useless-computed-key": "error", // https://eslint.org/docs/rules/rest-spread-spacing "rest-spread-spacing": ["error"], + // https://eslint.org/docs/rules/array-callback-return + "array-callback-return": "error", + // https://eslint.org/docs/rules/no-invalid-this + "no-invalid-this": "error", // Believe this one actually surfaces some bugs + // https://eslint.org/docs/rules/func-style + "func-style": ["error", "declaration"], // https://eslint.org/docs/rules/no-unused-expressions "no-unused-expressions": "error", // https://eslint.org/docs/rules/no-useless-concat diff --git a/example/generator/WorkerInterface.js b/example/generator/WorkerInterface.js index b3d179cd7f..e698076389 100644 --- a/example/generator/WorkerInterface.js +++ b/example/generator/WorkerInterface.js @@ -72,6 +72,7 @@ define([ }); var messageId; + let self = this; function callback(message) { if (message.error) { deferred.reject(message.error); @@ -79,7 +80,8 @@ define([ deferred.resolve(message.data); } - delete this.callbacks[messageId]; + delete self.callbacks[messageId]; + } messageId = this.dispatch('request', request, callback.bind(this)); diff --git a/package.json b/package.json index 7318106888..46e9991799 100644 --- a/package.json +++ b/package.json @@ -54,12 +54,12 @@ "markdown-toc": "^0.11.7", "marked": "^0.3.5", "mini-css-extract-plugin": "^0.4.1", - "minimist": "^1.1.1", + "minimist": "^1.2.5", "moment": "2.25.3", "moment-duration-format": "^2.2.2", "moment-timezone": "0.5.28", "node-bourbon": "^4.2.3", - "node-sass": "^4.9.2", + "node-sass": "^4.14.1", "painterro": "^1.0.35", "printj": "^1.2.1", "raw-loader": "^0.5.1", diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 1cda7b700e..2972944804 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -164,7 +164,7 @@ function ( } function saveAfterClone(clonedObject) { - return this.openmct.editor.save().then(() => { + return self.openmct.editor.save().then(() => { // Force mutation for search indexing return clonedObject; }); diff --git a/platform/commonUI/edit/src/creation/CreateWizard.js b/platform/commonUI/edit/src/creation/CreateWizard.js index df7ce327ac..4d262ab9a3 100644 --- a/platform/commonUI/edit/src/creation/CreateWizard.js +++ b/platform/commonUI/edit/src/creation/CreateWizard.js @@ -56,10 +56,11 @@ define( */ CreateWizard.prototype.getFormStructure = function (includeLocation) { var sections = [], - domainObject = this.domainObject; + domainObject = this.domainObject, + self = this; function validateLocation(parent) { - return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter')); + return parent && self.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter')); } sections.push({ diff --git a/platform/entanglement/test/services/MockCopyService.js b/platform/entanglement/test/services/MockCopyService.js index 1a7aaaf0df..efbc0abdbb 100644 --- a/platform/entanglement/test/services/MockCopyService.js +++ b/platform/entanglement/test/services/MockCopyService.js @@ -60,7 +60,7 @@ define( ] ); - mockCopyService.perform.and.callFake(function () { + mockCopyService.perform.and.callFake(() => { var performPromise, callExtensions, spy; @@ -79,7 +79,7 @@ define( } }; - spy = this.perform; + spy = mockCopyService.perform; Object.keys(callExtensions).forEach(function (key) { spy.calls.mostRecent()[key] = callExtensions[key]; diff --git a/platform/entanglement/test/services/MockLinkService.js b/platform/entanglement/test/services/MockLinkService.js index 426e059fb9..d2e1dc1631 100644 --- a/platform/entanglement/test/services/MockLinkService.js +++ b/platform/entanglement/test/services/MockLinkService.js @@ -63,11 +63,11 @@ define( ] ); - mockLinkService.perform.and.callFake(function (object) { + mockLinkService.perform.and.callFake(object => { var performPromise = new ControlledPromise(); - this.perform.calls.mostRecent().promise = performPromise; - this.perform.calls.all()[this.perform.calls.count() - 1].promise = + mockLinkService.perform.calls.mostRecent().promise = performPromise; + mockLinkService.perform.calls.all()[mockLinkService.perform.calls.count() - 1].promise = performPromise; return performPromise.then(function (overrideObject) { diff --git a/platform/entanglement/test/services/MockMoveService.js b/platform/entanglement/test/services/MockMoveService.js index 38f2059ae9..ecc836c193 100644 --- a/platform/entanglement/test/services/MockMoveService.js +++ b/platform/entanglement/test/services/MockMoveService.js @@ -60,7 +60,7 @@ define( ] ); - mockMoveService.perform.and.callFake(function () { + mockMoveService.perform.and.callFake(() => { var performPromise, callExtensions, spy; @@ -79,7 +79,7 @@ define( } }; - spy = this.perform; + spy = mockMoveService.perform; Object.keys(callExtensions).forEach(function (key) { spy.calls.mostRecent()[key] = callExtensions[key]; diff --git a/platform/forms/src/FileInputService.js b/platform/forms/src/FileInputService.js index 753768f816..f5307d7747 100644 --- a/platform/forms/src/FileInputService.js +++ b/platform/forms/src/FileInputService.js @@ -47,6 +47,7 @@ define(["zepto"], function ($) { return new Promise(function (resolve, reject) { input.trigger("click"); input.on('change', function (event) { + // eslint-disable-next-line no-invalid-this file = this.files[0]; input.remove(); if (file) { diff --git a/platform/framework/src/register/CustomRegistrars.js b/platform/framework/src/register/CustomRegistrars.js index bc65822cc3..bbc4f9d792 100644 --- a/platform/framework/src/register/CustomRegistrars.js +++ b/platform/framework/src/register/CustomRegistrars.js @@ -19,6 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ +/* eslint-disable no-invalid-this */ /** * Module defining CustomRegistrars. Created by vwoeltje on 11/3/14. diff --git a/platform/search/test/services/SearchAggregatorSpec.js b/platform/search/test/services/SearchAggregatorSpec.js index 3502a5880f..72664a32a7 100644 --- a/platform/search/test/services/SearchAggregatorSpec.js +++ b/platform/search/test/services/SearchAggregatorSpec.js @@ -91,18 +91,19 @@ define([ }); it('filters results with a function', function () { - var modelResults = { - hits: [ - {model: {thing: 1}}, - {model: {thing: 2}}, - {model: {thing: 3}} - ], - total: 3 - }, - filterFunc = function (model) { - return model.thing < 2; - }, - filtered = aggregator.applyFilter(modelResults, filterFunc); + const modelResults = { + hits: [ + {model: {thing: 1}}, + {model: {thing: 2}}, + {model: {thing: 3}} + ], + total: 3 + }; + let filtered = aggregator.applyFilter(modelResults, filterFunc); + + function filterFunc(model) { + return model.thing < 2; + } expect(filtered.hits).toEqual([ {model: {thing: 1}} diff --git a/platform/telemetry/src/TelemetryCapability.js b/platform/telemetry/src/TelemetryCapability.js index 6d56c160a8..12a2048af5 100644 --- a/platform/telemetry/src/TelemetryCapability.js +++ b/platform/telemetry/src/TelemetryCapability.js @@ -33,14 +33,11 @@ define( _ ) { - var ZERO = function () { - return 0; - }, - EMPTY_SERIES = { - getPointCount: ZERO, - getDomainValue: ZERO, - getRangeValue: ZERO - }; + const EMPTY_SERIES = { + getPointCount: () => 0, + getDomainValue: () => 0, + getRangeValue: () => 0 + }; /** * Provides metadata about telemetry associated with a diff --git a/src/api/telemetry/TelemetryMetadataManager.js b/src/api/telemetry/TelemetryMetadataManager.js index 1227467039..75e0de8272 100644 --- a/src/api/telemetry/TelemetryMetadataManager.js +++ b/src/api/telemetry/TelemetryMetadataManager.js @@ -114,7 +114,7 @@ define([ hints ) { function hasHint(hint) { - /*jshint validthis: true */ + // eslint-disable-next-line no-invalid-this return this.hints.hasOwnProperty(hint); } diff --git a/src/plugins/autoflow/AutoflowTabularPluginSpec.js b/src/plugins/autoflow/AutoflowTabularPluginSpec.js index 61450fd7fe..26315b8c3b 100644 --- a/src/plugins/autoflow/AutoflowTabularPluginSpec.js +++ b/src/plugins/autoflow/AutoflowTabularPluginSpec.js @@ -339,6 +339,7 @@ define([ } for (var height = 0; height < rowHeight * count * 2; height += rowHeight / 2) { + // eslint-disable-next-line no-invalid-this promiseChain = promiseChain.then(setHeight.bind(this, height)); } diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index 3bee84d1fe..e0b83c9069 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -169,28 +169,7 @@ export default { }, dropCondition(targetIndex) { const oldIndexArr = Object.keys(this.conditionCollection); - const move = function (arr, old_index, new_index) { - while (old_index < 0) { - old_index += arr.length; - } - - while (new_index < 0) { - new_index += arr.length; - } - - if (new_index >= arr.length) { - var k = new_index - arr.length; - while ((k--) + 1) { - arr.push(undefined); - } - } - - arr.splice(new_index, 0, arr.splice(old_index, 1)[0]); - - return arr; - }; - - const newIndexArr = move(oldIndexArr, this.moveIndex, targetIndex); + const newIndexArr = this.rearrangeIndices(oldIndexArr, this.moveIndex, targetIndex); const reorderPlan = []; for (let i = 0; i < oldIndexArr.length; i++) { @@ -205,6 +184,26 @@ export default { dragComplete() { this.isDragging = false; }, + rearrangeIndices(arr, old_index, new_index) { + while (old_index < 0) { + old_index += arr.length; + } + + while (new_index < 0) { + new_index += arr.length; + } + + if (new_index >= arr.length) { + var k = new_index - arr.length; + while ((k--) + 1) { + arr.push(undefined); + } + } + + arr.splice(new_index, 0, arr.splice(old_index, 1)[0]); + + return arr; + }, addTelemetryObject(domainObject) { this.telemetryObjs.push(domainObject); this.$emit('telemetryUpdated', this.telemetryObjs); diff --git a/src/plugins/condition/components/inspector/ConditionalStylesView.vue b/src/plugins/condition/components/inspector/ConditionalStylesView.vue index 46ce93fcaf..04ded8121b 100644 --- a/src/plugins/condition/components/inspector/ConditionalStylesView.vue +++ b/src/plugins/condition/components/inspector/ConditionalStylesView.vue @@ -223,20 +223,22 @@ export default { }, addConditionSet() { let conditionSetDomainObject; - const handleItemSelection = (item) => { + let self = this; + + function handleItemSelection(item) { if (item) { conditionSetDomainObject = item; } - }; + } - const dismissDialog = (overlay, initialize) => { + function dismissDialog(overlay, initialize) { overlay.dismiss(); if (initialize && conditionSetDomainObject) { - this.conditionSetDomainObject = conditionSetDomainObject; - this.conditionalStyles = []; - this.initializeConditionalStyles(); + self.conditionSetDomainObject = conditionSetDomainObject; + self.conditionalStyles = []; + self.initializeConditionalStyles(); } - }; + } let vm = new Vue({ provide: { diff --git a/src/plugins/condition/components/inspector/StylesView.vue b/src/plugins/condition/components/inspector/StylesView.vue index 5a71ba51f5..13c90af97f 100644 --- a/src/plugins/condition/components/inspector/StylesView.vue +++ b/src/plugins/condition/components/inspector/StylesView.vue @@ -431,20 +431,22 @@ export default { }, addConditionSet() { let conditionSetDomainObject; - const handleItemSelection = (item) => { + let self = this; + function handleItemSelection(item) { if (item) { conditionSetDomainObject = item; } - }; + } - const dismissDialog = (overlay, initialize) => { + function dismissDialog(overlay, initialize) { overlay.dismiss(); + if (initialize && conditionSetDomainObject) { - this.conditionSetDomainObject = conditionSetDomainObject; - this.conditionalStyles = []; - this.initializeConditionalStyles(); + self.conditionSetDomainObject = conditionSetDomainObject; + self.conditionalStyles = []; + self.initializeConditionalStyles(); } - }; + } let vm = new Vue({ provide: { diff --git a/src/plugins/condition/utils/evaluator.js b/src/plugins/condition/utils/evaluator.js index a751876788..831de2d950 100644 --- a/src/plugins/condition/utils/evaluator.js +++ b/src/plugins/condition/utils/evaluator.js @@ -21,7 +21,7 @@ *****************************************************************************/ import { TRIGGER } from "./constants"; -export const evaluateResults = (results, trigger) => { +export function evaluateResults(results, trigger) { if (trigger && trigger === TRIGGER.XOR) { return matchExact(results, 1); } else if (trigger && trigger === TRIGGER.NOT) { @@ -31,7 +31,7 @@ export const evaluateResults = (results, trigger) => { } else { return matchAny(results); } -}; +} function matchAll(results) { for (const result of results) { diff --git a/src/plugins/condition/utils/operations.js b/src/plugins/condition/utils/operations.js index 9867e9b3cb..8b22596f86 100644 --- a/src/plugins/condition/utils/operations.js +++ b/src/plugins/condition/utils/operations.js @@ -20,23 +20,23 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -const convertToNumbers = (input) => { +function convertToNumbers(input) { let numberInputs = []; input.forEach(inputValue => numberInputs.push(Number(inputValue))); return numberInputs; -}; +} -const convertToStrings = (input) => { +function convertToStrings(input) { let stringInputs = []; input.forEach(inputValue => stringInputs.push(inputValue !== undefined ? inputValue.toString() : '')); return stringInputs; -}; +} -const joinValues = (values, length) => { +function joinValues(values, length) { return values.slice(0, length).join(', '); -}; +} export const OPERATIONS = [ { @@ -313,8 +313,8 @@ export const INPUT_TYPES = { 'number': 'number' }; -export const getOperatorText = (operationName, values) => { +export function getOperatorText(operationName, values) { const found = OPERATIONS.find((operation) => operation.name === operationName); return found ? found.getDescription(values) : ''; -}; +} diff --git a/src/plugins/condition/utils/styleUtils.js b/src/plugins/condition/utils/styleUtils.js index fbde5bda16..5b918c8d75 100644 --- a/src/plugins/condition/utils/styleUtils.js +++ b/src/plugins/condition/utils/styleUtils.js @@ -64,7 +64,7 @@ const styleProps = { } }; -const aggregateStyleValues = (accumulator, currentStyle) => { +function aggregateStyleValues(accumulator, currentStyle) { const styleKeys = Object.keys(currentStyle); const properties = Object.keys(styleProps); properties.forEach((property) => { @@ -79,11 +79,24 @@ const aggregateStyleValues = (accumulator, currentStyle) => { }); return accumulator; -}; +} + +function getStaticStyleForItem(domainObject, id) { + let domainObjectStyles = domainObject && domainObject.configuration && domainObject.configuration.objectStyles; + if (domainObjectStyles) { + if (id) { + if (domainObjectStyles[id] && domainObjectStyles[id].staticStyle) { + return domainObjectStyles[id].staticStyle.style; + } + } else if (domainObjectStyles.staticStyle) { + return domainObjectStyles.staticStyle.style; + } + } +} // Returns a union of styles used by multiple items. // Styles that are common to all items but don't have the same value are added to the mixedStyles list -export const getConsolidatedStyleValues = (multipleItemStyles) => { +export function getConsolidatedStyleValues(multipleItemStyles) { let aggregatedStyleValues = multipleItemStyles.reduce(aggregateStyleValues, {}); let styleValues = {}; @@ -105,22 +118,9 @@ export const getConsolidatedStyleValues = (multipleItemStyles) => { styles: styleValues, mixedStyles }; -}; +} -const getStaticStyleForItem = (domainObject, id) => { - let domainObjectStyles = domainObject && domainObject.configuration && domainObject.configuration.objectStyles; - if (domainObjectStyles) { - if (id) { - if (domainObjectStyles[id] && domainObjectStyles[id].staticStyle) { - return domainObjectStyles[id].staticStyle.style; - } - } else if (domainObjectStyles.staticStyle) { - return domainObjectStyles.staticStyle.style; - } - } -}; - -export const getConditionalStyleForItem = (domainObject, id) => { +export function getConditionalStyleForItem(domainObject, id) { let domainObjectStyles = domainObject && domainObject.configuration && domainObject.configuration.objectStyles; if (domainObjectStyles) { if (id) { @@ -131,9 +131,9 @@ export const getConditionalStyleForItem = (domainObject, id) => { return domainObjectStyles.styles; } } -}; +} -export const getConditionSetIdentifierForItem = (domainObject, id) => { +export function getConditionSetIdentifierForItem(domainObject, id) { let domainObjectStyles = domainObject && domainObject.configuration && domainObject.configuration.objectStyles; if (domainObjectStyles) { if (id) { @@ -144,10 +144,10 @@ export const getConditionSetIdentifierForItem = (domainObject, id) => { return domainObjectStyles.conditionSetIdentifier; } } -}; +} //Returns either existing static styles or uses SVG defaults if available -export const getApplicableStylesForItem = (domainObject, item) => { +export function getApplicableStylesForItem(domainObject, item) { const type = item && item.type; const id = item && item.id; let style = {}; @@ -170,9 +170,9 @@ export const getApplicableStylesForItem = (domainObject, item) => { }); return style; -}; +} -export const getStylesWithoutNoneValue = (style) => { +export function getStylesWithoutNoneValue(style) { if (isEmpty(style) || !style) { return; } @@ -190,4 +190,4 @@ export const getStylesWithoutNoneValue = (style) => { }); return styleObj; -}; +} diff --git a/src/plugins/condition/utils/time.js b/src/plugins/condition/utils/time.js index d6090ffbc7..67516fa833 100644 --- a/src/plugins/condition/utils/time.js +++ b/src/plugins/condition/utils/time.js @@ -20,12 +20,22 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -export const getLatestTimestamp = ( +function updateLatestTimeStamp(timestamp, timeSystems) { + let latest = {}; + + timeSystems.forEach(timeSystem => { + latest[timeSystem.key] = timestamp[timeSystem.key]; + }); + + return latest; +} + +export function getLatestTimestamp( currentTimestamp, compareTimestamp, timeSystems, currentTimeSystem -) => { +) { let latest = { ...currentTimestamp }; const compare = { ...compareTimestamp }; const key = currentTimeSystem.key; @@ -38,20 +48,10 @@ export const getLatestTimestamp = ( latest = updateLatestTimeStamp(compare, timeSystems); } - return latest; -}; - -function updateLatestTimeStamp(timestamp, timeSystems) { - let latest = {}; - - timeSystems.forEach(timeSystem => { - latest[timeSystem.key] = timestamp[timeSystem.key]; - }); - return latest; } -export const subscribeForStaleness = (callback, timeout) => { +export function subscribeForStaleness(callback, timeout) { let stalenessTimer = setTimeout(() => { clearTimeout(stalenessTimer); callback(); @@ -74,4 +74,4 @@ export const subscribeForStaleness = (callback, timeout) => { } } }; -}; +} diff --git a/src/plugins/displayLayout/components/SubobjectView.vue b/src/plugins/displayLayout/components/SubobjectView.vue index 59a1819ba0..e0a1587646 100644 --- a/src/plugins/displayLayout/components/SubobjectView.vue +++ b/src/plugins/displayLayout/components/SubobjectView.vue @@ -137,7 +137,7 @@ export default { setObject(domainObject) { this.domainObject = domainObject; this.currentObjectPath = [this.domainObject].concat(this.objectPath.slice()); - this.$nextTick(function () { + this.$nextTick(() => { let childContext = this.$refs.objectFrame.getSelectionContext(); childContext.item = domainObject; childContext.layoutItem = this.item; diff --git a/src/plugins/flexibleLayout/components/frame.vue b/src/plugins/flexibleLayout/components/frame.vue index fbdb3d497a..1869d61256 100644 --- a/src/plugins/flexibleLayout/components/frame.vue +++ b/src/plugins/flexibleLayout/components/frame.vue @@ -115,7 +115,7 @@ export default { this.setSelection(); }, setSelection() { - this.$nextTick(function () { + this.$nextTick(() => { if (this.$refs && this.$refs.objectFrame) { let childContext = this.$refs.objectFrame.getSelectionContext(); childContext.item = this.domainObject; diff --git a/src/plugins/imagery/ImageryViewProvider.js b/src/plugins/imagery/ImageryViewProvider.js index e5d9f6e26a..aeb7555d77 100644 --- a/src/plugins/imagery/ImageryViewProvider.js +++ b/src/plugins/imagery/ImageryViewProvider.js @@ -4,14 +4,14 @@ import Vue from 'vue'; export default function ImageryViewProvider(openmct) { const type = 'example.imagery'; - const hasImageTelemetry = function (domainObject) { + function hasImageTelemetry(domainObject) { const metadata = openmct.telemetry.getMetadata(domainObject); if (!metadata) { return false; } return metadata.valuesForHints(['image']).length > 0; - }; + } return { key: type, diff --git a/src/plugins/notebook/components/notebook.vue b/src/plugins/notebook/components/notebook.vue index ebb46bfc7d..51c1c5bb7a 100644 --- a/src/plugins/notebook/components/notebook.vue +++ b/src/plugins/notebook/components/notebook.vue @@ -190,7 +190,7 @@ export default { } }, updated: function () { - this.$nextTick(function () { + this.$nextTick(() => { this.focusOnEntryId(); }); }, diff --git a/src/plugins/notebook/utils/notebook-entries.js b/src/plugins/notebook/utils/notebook-entries.js index 5579f269a8..2a65a1ac68 100644 --- a/src/plugins/notebook/utils/notebook-entries.js +++ b/src/plugins/notebook/utils/notebook-entries.js @@ -7,7 +7,7 @@ const TIME_BOUNDS = { END_DELTA: 'tc.endDelta' }; -export const getHistoricLinkInFixedMode = (openmct, bounds, historicLink) => { +export function getHistoricLinkInFixedMode(openmct, bounds, historicLink) { if (historicLink.includes('tc.mode=fixed')) { return historicLink; } @@ -35,9 +35,9 @@ export const getHistoricLinkInFixedMode = (openmct, bounds, historicLink) => { }); return params.join('&'); -}; +} -export const getNotebookDefaultEntries = (notebookStorage, domainObject) => { +export function getNotebookDefaultEntries(notebookStorage, domainObject) { if (!notebookStorage || !domainObject) { return null; } @@ -64,9 +64,9 @@ export const getNotebookDefaultEntries = (notebookStorage, domainObject) => { } return entries[defaultSection.id][defaultPage.id]; -}; +} -export const createNewEmbed = (snapshotMeta, snapshot = '') => { +export function createNewEmbed(snapshotMeta, snapshot = '') { const { bounds, link, @@ -100,9 +100,9 @@ export const createNewEmbed = (snapshotMeta, snapshot = '') => { snapshot, type }; -}; +} -export const addNotebookEntry = (openmct, domainObject, notebookStorage, embed = null) => { +export function addNotebookEntry(openmct, domainObject, notebookStorage, embed = null) { if (!openmct || !domainObject || !notebookStorage) { return; } @@ -131,9 +131,9 @@ export const addNotebookEntry = (openmct, domainObject, notebookStorage, embed = openmct.objects.mutate(domainObject, 'configuration.entries', entries); return id; -}; +} -export const getNotebookEntries = (domainObject, selectedSection, selectedPage) => { +export function getNotebookEntries(domainObject, selectedSection, selectedPage) { if (!domainObject || !selectedSection || !selectedPage) { return null; } @@ -152,9 +152,9 @@ export const getNotebookEntries = (domainObject, selectedSection, selectedPage) } return entries[selectedSection.id][selectedPage.id]; -}; +} -export const getEntryPosById = (entryId, domainObject, selectedSection, selectedPage) => { +export function getEntryPosById(entryId, domainObject, selectedSection, selectedPage) { if (!domainObject || !selectedSection || !selectedPage) { return; } @@ -170,9 +170,9 @@ export const getEntryPosById = (entryId, domainObject, selectedSection, selected }); return foundId; -}; +} -export const deleteNotebookEntries = (openmct, domainObject, selectedSection, selectedPage) => { +export function deleteNotebookEntries(openmct, domainObject, selectedSection, selectedPage) { if (!domainObject || !selectedSection) { return; } @@ -194,4 +194,4 @@ export const deleteNotebookEntries = (openmct, domainObject, selectedSection, se delete entries[selectedSection.id][selectedPage.id]; openmct.objects.mutate(domainObject, 'configuration.entries', entries); -}; +} diff --git a/src/plugins/objectMigration/Migrations.js b/src/plugins/objectMigration/Migrations.js index b41d4d04de..5561adb7a5 100644 --- a/src/plugins/objectMigration/Migrations.js +++ b/src/plugins/objectMigration/Migrations.js @@ -226,6 +226,8 @@ define([ .then(object => { telemetryObjects[element.id] = object; }); + } else { + return Promise.resolve(false); } }); diff --git a/src/plugins/plot/src/configuration/XAxisModel.js b/src/plugins/plot/src/configuration/XAxisModel.js index e2a316af25..fa4ad78e79 100644 --- a/src/plugins/plot/src/configuration/XAxisModel.js +++ b/src/plugins/plot/src/configuration/XAxisModel.js @@ -38,11 +38,11 @@ define([ } }); - this.on('change:frozen', function (frozen, oldValue, model) { + this.on('change:frozen', ((frozen, oldValue, model) => { if (!frozen) { model.set('range', this.get('range')); } - }); + })); if (this.get('range')) { this.set('range', this.get('range')); diff --git a/src/plugins/plot/src/configuration/YAxisModel.js b/src/plugins/plot/src/configuration/YAxisModel.js index 7b050fc742..b89e105738 100644 --- a/src/plugins/plot/src/configuration/YAxisModel.js +++ b/src/plugins/plot/src/configuration/YAxisModel.js @@ -60,14 +60,14 @@ define([ }, listenToSeriesCollection: function (seriesCollection) { this.seriesCollection = seriesCollection; - this.listenTo(this.seriesCollection, 'add', function (series) { + this.listenTo(this.seriesCollection, 'add', (series => { this.trackSeries(series); this.updateFromSeries(this.seriesCollection); - }, this); - this.listenTo(this.seriesCollection, 'remove', function (series) { + }), this); + this.listenTo(this.seriesCollection, 'remove', (series => { this.untrackSeries(series); this.updateFromSeries(this.seriesCollection); - }, this); + }), this); this.seriesCollection.forEach(this.trackSeries, this); this.updateFromSeries(this.seriesCollection); }, @@ -144,16 +144,16 @@ define([ }, this); }, trackSeries: function (series) { - this.listenTo(series, 'change:stats', function (seriesStats) { + this.listenTo(series, 'change:stats', seriesStats => { if (!seriesStats) { this.resetStats(); } else { this.updateStats(seriesStats); } - }, this); - this.listenTo(series, 'change:yKey', function () { + }); + this.listenTo(series, 'change:yKey', () => { this.updateFromSeries(this.seriesCollection); - }, this); + }); }, untrackSeries: function (series) { this.stopListening(series); diff --git a/src/plugins/plot/src/inspector/PlotModelFormController.js b/src/plugins/plot/src/inspector/PlotModelFormController.js index 1f8765bbb8..8aa770f4f2 100644 --- a/src/plugins/plot/src/inspector/PlotModelFormController.js +++ b/src/plugins/plot/src/inspector/PlotModelFormController.js @@ -122,6 +122,8 @@ define([ } var formPath = 'form.' + formProp; + let self = this; + if (!coerce) { coerce = function (v) { return v; @@ -142,11 +144,11 @@ define([ } this.listenTo(this.model, 'change:' + prop, function (newVal, oldVal) { - if (!_.isEqual(coerce(_.get(this.$scope, formPath)), coerce(newVal))) { - _.set(this.$scope, formPath, coerce(newVal)); + if (!_.isEqual(coerce(_.get(self.$scope, formPath)), coerce(newVal))) { + _.set(self.$scope, formPath, coerce(newVal)); } - }, this); - this.model.listenTo(this.$scope, 'change:' + formPath, function (newVal, oldVal) { + }); + this.model.listenTo(this.$scope, 'change:' + formPath, (newVal, oldVal) => { var validationResult = validate(newVal, this.model); if (validationResult === true) { delete this.$scope.validation[formProp]; @@ -170,7 +172,7 @@ define([ ); } } - }, this); + }); _.set(this.$scope, formPath, coerce(this.model.get(prop))); }; diff --git a/src/plugins/plot/src/lib/extend.js b/src/plugins/plot/src/lib/extend.js index d2886256cc..dbc95a8bc7 100644 --- a/src/plugins/plot/src/lib/extend.js +++ b/src/plugins/plot/src/lib/extend.js @@ -28,7 +28,7 @@ define([ ) { function extend(props) { - /*jshint validthis: true*/ + // eslint-disable-next-line no-invalid-this var parent = this, child, Surrogate; @@ -37,6 +37,7 @@ define([ child = props.constructor; } else { child = function () { + // eslint-disable-next-line no-invalid-this return parent.apply(this, arguments); }; } diff --git a/src/plugins/plot/src/plot/MCTPlotController.js b/src/plugins/plot/src/plot/MCTPlotController.js index efdac84671..c2309b6340 100644 --- a/src/plugins/plot/src/plot/MCTPlotController.js +++ b/src/plugins/plot/src/plot/MCTPlotController.js @@ -220,21 +220,18 @@ define([ if (!point) { this.$scope.highlights = []; - this.$scope.series.map(function (series) { - delete series.closest; - }); + this.$scope.series.forEach(series => delete series.closest); } else { this.$scope.highlights = this.$scope.series - .filter(function (series) { - return series.data.length > 0; - }).map(function (series) { + .filter(series => series.data.length > 0) + .map(series => { series.closest = series.nearestPoint(point); return { series: series, point: series.closest }; - }, this); + }); } this.$scope.$digest(); diff --git a/src/plugins/plot/src/telemetry/PlotController.js b/src/plugins/plot/src/telemetry/PlotController.js index e5722800e8..a1a3ffb8b1 100644 --- a/src/plugins/plot/src/telemetry/PlotController.js +++ b/src/plugins/plot/src/telemetry/PlotController.js @@ -134,11 +134,11 @@ define([ }; PlotController.prototype.addSeries = function (series) { - this.listenTo(series, 'change:yKey', function () { + this.listenTo(series, 'change:yKey', () => { this.loadSeriesData(series); }, this); - this.listenTo(series, 'change:interpolate', function () { + this.listenTo(series, 'change:interpolate', () => { this.loadSeriesData(series); }, this); @@ -184,18 +184,18 @@ define([ }; PlotController.prototype.loadMoreData = function (range, purge) { - this.config.series.map(function (plotSeries) { + this.config.series.forEach(plotSeries => { this.startLoading(); plotSeries.load({ size: this.$element[0].offsetWidth, start: range.min, end: range.max }) - .then(this.stopLoading.bind(this)); + .then(this.stopLoading()); if (purge) { plotSeries.purgeRecordsOutsideRange(range); } - }, this); + }); }; /** diff --git a/src/plugins/staticRootPlugin/plugin.js b/src/plugins/staticRootPlugin/plugin.js index ada025bc3b..ecbf433b8a 100644 --- a/src/plugins/staticRootPlugin/plugin.js +++ b/src/plugins/staticRootPlugin/plugin.js @@ -16,7 +16,7 @@ define([ var cachedProvider; - var loadProvider = function () { + function loadProvider() { return fetch(exportUrl) .then(function (response) { return response.json(); @@ -26,16 +26,15 @@ define([ return cachedProvider; }); + } - }; - - var getProvider = function () { + function getProvider() { if (!cachedProvider) { cachedProvider = loadProvider(); } return Promise.resolve(cachedProvider); - }; + } return function install(openmct) { openmct.objects.addRoot(rootIdentifier); diff --git a/src/plugins/summaryWidget/src/Rule.js b/src/plugins/summaryWidget/src/Rule.js index a450d145c3..229692bd54 100644 --- a/src/plugins/summaryWidget/src/Rule.js +++ b/src/plugins/summaryWidget/src/Rule.js @@ -159,6 +159,7 @@ define([ */ function onDragStart(event) { $('.t-drag-indicator').each(function () { + // eslint-disable-next-line no-invalid-this $(this).html($('.widget-rule-header', self.domElement).clone().get(0)); }); self.widgetDnD.setDragImage($('.widget-rule-header', self.domElement).clone().get(0)); @@ -203,6 +204,7 @@ define([ Object.keys(this.textInputs).forEach(function (inputKey) { self.textInputs[inputKey].prop('value', self.config[inputKey] || ''); self.listenTo(self.textInputs[inputKey], 'input', function () { + // eslint-disable-next-line no-invalid-this onTextInput(this, inputKey); }); }); @@ -221,6 +223,7 @@ define([ this.listenTo(this.grippy, 'mousedown', onDragStart); this.widgetDnD.on('drop', function () { + // eslint-disable-next-line no-invalid-this this.domElement.show(); $('.t-drag-indicator').hide(); }, this); diff --git a/src/plugins/summaryWidget/src/input/ColorPalette.js b/src/plugins/summaryWidget/src/input/ColorPalette.js index 24e861cbe4..162e3ddedf 100644 --- a/src/plugins/summaryWidget/src/input/ColorPalette.js +++ b/src/plugins/summaryWidget/src/input/ColorPalette.js @@ -41,6 +41,7 @@ function ( $('.c-palette', domElement).addClass('c-palette--color'); $('.c-palette__item', domElement).each(function () { + // eslint-disable-next-line no-invalid-this var elem = this; $(elem).css('background-color', elem.dataset.item); }); diff --git a/src/plugins/summaryWidget/src/input/IconPalette.js b/src/plugins/summaryWidget/src/input/IconPalette.js index ae167bccac..ea6e6fbd32 100644 --- a/src/plugins/summaryWidget/src/input/IconPalette.js +++ b/src/plugins/summaryWidget/src/input/IconPalette.js @@ -56,6 +56,7 @@ define([ $('.c-palette', domElement).addClass('c-palette--icon'); $('.c-palette-item', domElement).each(function () { + // eslint-disable-next-line no-invalid-this var elem = this; $(elem).addClass(elem.dataset.item); }); diff --git a/src/plugins/summaryWidget/test/input/KeySelectSpec.js b/src/plugins/summaryWidget/test/input/KeySelectSpec.js index 739f8f50f9..2505232bc8 100644 --- a/src/plugins/summaryWidget/test/input/KeySelectSpec.js +++ b/src/plugins/summaryWidget/test/input/KeySelectSpec.js @@ -48,22 +48,22 @@ define(['../../src/input/KeySelect'], function (KeySelect) { 'triggerCallback' ]); - mockObjectSelect.on.and.callFake(function (event, callback) { - this.callbacks = this.callbacks || {}; - this.callbacks[event] = callback; + mockObjectSelect.on.and.callFake((event, callback) => { + mockObjectSelect.callbacks = mockObjectSelect.callbacks || {}; + mockObjectSelect.callbacks[event] = callback; }); - mockObjectSelect.triggerCallback.and.callFake(function (event, key) { - this.callbacks[event](key); + mockObjectSelect.triggerCallback.and.callFake((event, key) => { + mockObjectSelect.callbacks[event](key); }); - mockManager.on.and.callFake(function (event, callback) { - this.callbacks = this.callbacks || {}; - this.callbacks[event] = callback; + mockManager.on.and.callFake((event, callback) => { + mockManager.callbacks = mockManager.callbacks || {}; + mockManager.callbacks[event] = callback; }); - mockManager.triggerCallback.and.callFake(function (event) { - this.callbacks[event](); + mockManager.triggerCallback.and.callFake(event => { + mockManager.callbacks[event](); }); mockManager.getTelemetryMetadata.and.callFake(function (key) { diff --git a/src/plugins/summaryWidget/test/input/ObjectSelectSpec.js b/src/plugins/summaryWidget/test/input/ObjectSelectSpec.js index dd844b4d1a..f72818a1ec 100644 --- a/src/plugins/summaryWidget/test/input/ObjectSelectSpec.js +++ b/src/plugins/summaryWidget/test/input/ObjectSelectSpec.js @@ -31,16 +31,16 @@ define(['../../src/input/ObjectSelect'], function (ObjectSelect) { 'getComposition' ]); - mockManager.on.and.callFake(function (event, callback) { - this.callbacks = this.callbacks || {}; - this.callbacks[event] = callback; + mockManager.on.and.callFake((event, callback) => { + mockManager.callbacks = mockManager.callbacks || {}; + mockManager.callbacks[event] = callback; }); - mockManager.triggerCallback.and.callFake(function (event, newObj) { + mockManager.triggerCallback.and.callFake((event, newObj) => { if (event === 'add') { - this.callbacks.add(newObj); + mockManager.callbacks.add(newObj); } else { - this.callbacks[event](); + mockManager.callbacks[event](); } }); diff --git a/src/plugins/summaryWidget/test/input/OperationSelectSpec.js b/src/plugins/summaryWidget/test/input/OperationSelectSpec.js index 3885e6a3ca..33f9fdad09 100644 --- a/src/plugins/summaryWidget/test/input/OperationSelectSpec.js +++ b/src/plugins/summaryWidget/test/input/OperationSelectSpec.js @@ -65,22 +65,22 @@ define(['../../src/input/OperationSelect'], function (OperationSelect) { return (mockOperations[operation].appliesTo.includes(type)); }); - mockKeySelect.on.and.callFake(function (event, callback) { - this.callbacks = this.callbacks || {}; - this.callbacks[event] = callback; + mockKeySelect.on.and.callFake((event, callback) => { + mockKeySelect.callbacks = mockKeySelect.callbacks || {}; + mockKeySelect.callbacks[event] = callback; }); - mockKeySelect.triggerCallback.and.callFake(function (event, key) { - this.callbacks[event](key); + mockKeySelect.triggerCallback.and.callFake((event, key) => { + mockKeySelect.callbacks[event](key); }); - mockManager.on.and.callFake(function (event, callback) { - this.callbacks = this.callbacks || {}; - this.callbacks[event] = callback; + mockManager.on.and.callFake((event, callback) => { + mockManager.callbacks = mockManager.callbacks || {}; + mockManager.callbacks[event] = callback; }); - mockManager.triggerCallback.and.callFake(function (event) { - this.callbacks[event](); + mockManager.triggerCallback.and.callFake(event => { + mockManager.callbacks[event](); }); mockManager.getTelemetryPropertyType.and.callFake(function (object, key) { diff --git a/src/plugins/telemetryMean/src/MeanTelemetryProviderSpec.js b/src/plugins/telemetryMean/src/MeanTelemetryProviderSpec.js index a727c17d9a..c2e6ac208c 100644 --- a/src/plugins/telemetryMean/src/MeanTelemetryProviderSpec.js +++ b/src/plugins/telemetryMean/src/MeanTelemetryProviderSpec.js @@ -19,7 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*jshint latedef: nofunc */ +/* eslint-disable no-invalid-this */ define([ "./MeanTelemetryProvider", "./MockTelemetryApi" diff --git a/src/plugins/themes/installTheme.js b/src/plugins/themes/installTheme.js index 08d3ce0fa7..ffdf0924ba 100644 --- a/src/plugins/themes/installTheme.js +++ b/src/plugins/themes/installTheme.js @@ -1,6 +1,6 @@ const dataAttribute = 'theme'; -export const installTheme = (openmct, themeName) => { +export function installTheme(openmct, themeName) { const currentTheme = document.querySelector(`link[data-${dataAttribute}]`); if (currentTheme) { currentTheme.remove(); @@ -15,4 +15,4 @@ export const installTheme = (openmct, themeName) => { newTheme.dataset[dataAttribute] = themeName; document.head.appendChild(newTheme); -}; +} diff --git a/src/plugins/timeConductor/ConductorHistory.vue b/src/plugins/timeConductor/ConductorHistory.vue index d11c24cb5b..feac7a5881 100644 --- a/src/plugins/timeConductor/ConductorHistory.vue +++ b/src/plugins/timeConductor/ConductorHistory.vue @@ -144,13 +144,14 @@ export default { start: this.bounds.start, end: this.bounds.end }; + let self = this; - const isNotEqual = function (entry) { - const start = entry.start !== this.start; - const end = entry.end !== this.end; + function isNotEqual(entry) { + const start = entry.start !== self.start; + const end = entry.end !== self.end; return start || end; - }; + } currentHistory = currentHistory.filter(isNotEqual, timespan); diff --git a/src/plugins/timeConductor/plugin.js b/src/plugins/timeConductor/plugin.js index b46793c7f1..0399754215 100644 --- a/src/plugins/timeConductor/plugin.js +++ b/src/plugins/timeConductor/plugin.js @@ -71,13 +71,16 @@ function validateConfiguration(config, openmct) { }, {}); return config.menuOptions.map(function (menuOption) { + let message = ''; if (menuOption.timeSystem && !systems[menuOption.timeSystem]) { - return `Time system '${menuOption.timeSystem}' has not been registered: \r\n ${JSON.stringify(menuOption)}`; + message = `Time system '${menuOption.timeSystem}' has not been registered: \r\n ${JSON.stringify(menuOption)}`; } if (menuOption.clock && !clocks[menuOption.clock]) { - return `Clock '${menuOption.clock}' has not been registered: \r\n ${JSON.stringify(menuOption)}`; + message = `Clock '${menuOption.clock}' has not been registered: \r\n ${JSON.stringify(menuOption)}`; } + + return message; }).filter(isTruthy).join('\n'); } diff --git a/src/selection/Selection.js b/src/selection/Selection.js index 59b420f3b1..5c8c646e9a 100644 --- a/src/selection/Selection.js +++ b/src/selection/Selection.js @@ -29,7 +29,6 @@ define( EventEmitter, _ ) { - /** * Manages selection state for Open MCT * @private @@ -115,9 +114,7 @@ define( * @private */ Selection.prototype.setSelectionStyles = function (selectable) { - this.selected.map(selectionPath => { - this.removeSelectionAttributes(selectionPath); - }); + this.selected.forEach(selectionPath => this.removeSelectionAttributes(selectionPath)); this.addSelectionAttributes(selectable); }; diff --git a/src/ui/layout/Layout.vue b/src/ui/layout/Layout.vue index 8ffe87baf9..97e8e78e34 100644 --- a/src/ui/layout/Layout.vue +++ b/src/ui/layout/Layout.vue @@ -98,32 +98,6 @@ import AppLogo from './AppLogo.vue'; import Indicators from './status-bar/Indicators.vue'; import NotificationBanner from './status-bar/NotificationBanner.vue'; -var enterFullScreen = () => { - var docElm = document.documentElement; - - if (docElm.requestFullscreen) { - docElm.requestFullscreen(); - } else if (docElm.mozRequestFullScreen) { /* Firefox */ - docElm.mozRequestFullScreen(); - } else if (docElm.webkitRequestFullscreen) { /* Chrome, Safari and Opera */ - docElm.webkitRequestFullscreen(); - } else if (docElm.msRequestFullscreen) { /* IE/Edge */ - docElm.msRequestFullscreen(); - } -}; - -var exitFullScreen = () => { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.webkitCancelFullScreen) { - document.webkitCancelFullScreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } -}; - export default { inject: ['openmct'], components: { @@ -168,6 +142,30 @@ export default { this.openmct.selection.on('change', this.toggleHasToolbar); }, methods: { + enterFullScreen() { + var docElm = document.documentElement; + + if (docElm.requestFullscreen) { + docElm.requestFullscreen(); + } else if (docElm.mozRequestFullScreen) { /* Firefox */ + docElm.mozRequestFullScreen(); + } else if (docElm.webkitRequestFullscreen) { /* Chrome, Safari and Opera */ + docElm.webkitRequestFullscreen(); + } else if (docElm.msRequestFullscreen) { /* IE/Edge */ + docElm.msRequestFullscreen(); + } + }, + exitFullScreen() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + }, toggleShellHead() { this.headExpanded = !this.headExpanded; @@ -183,10 +181,10 @@ export default { fullScreenToggle() { if (this.fullScreen) { this.fullScreen = false; - exitFullScreen(); + this.exitFullScreen(); } else { this.fullScreen = true; - enterFullScreen(); + this.enterFullScreen(); } }, openInNewTab(event) { diff --git a/src/ui/registries/ToolbarRegistry.js b/src/ui/registries/ToolbarRegistry.js index fd3a8f5e53..fcab309999 100644 --- a/src/ui/registries/ToolbarRegistry.js +++ b/src/ui/registries/ToolbarRegistry.js @@ -47,10 +47,8 @@ define([], function () { var structure = []; - providers.map(function (provider) { - provider.toolbar(selection).forEach(function (item) { - structure.push(item); - }); + providers.forEach(provider => { + provider.toolbar(selection).forEach(item => structure.push(item)); }); return structure; diff --git a/src/ui/router/Browse.js b/src/ui/router/Browse.js index c5f0291697..2f19c6f556 100644 --- a/src/ui/router/Browse.js +++ b/src/ui/router/Browse.js @@ -57,7 +57,7 @@ define([ path = path.split('/'); } - return pathToObjects(path).then((objects) => { + return pathToObjects(path).then(objects => { isRoutingInProgress = false; if (currentNavigation !== navigateCall) { @@ -72,7 +72,7 @@ define([ // API for this. openmct.router.path = objects.reverse(); - unobserve = this.openmct.objects.observe(openmct.router.path[0], '*', (newObject) => { + unobserve = openmct.objects.observe(openmct.router.path[0], '*', (newObject) => { openmct.router.path[0] = newObject; browseObject = newObject; }); diff --git a/src/ui/toolbar/Toolbar.vue b/src/ui/toolbar/Toolbar.vue index cb5ba0f6a6..ce2477d95b 100644 --- a/src/ui/toolbar/Toolbar.vue +++ b/src/ui/toolbar/Toolbar.vue @@ -167,7 +167,7 @@ export default { let value = {}; let values = {}; - toolbarItem.formKeys.map(key => { + toolbarItem.formKeys.forEach(key => { values[key] = []; if (toolbarItem.applicableSelectedItems) { @@ -221,7 +221,7 @@ export default { // If value is an object, iterate the toolbar structure and mutate all keys in form. // Otherwise, mutate the property. if (value === Object(value)) { - this.structure.map(s => { + this.structure.forEach(s => { if (s.formKeys) { s.formKeys.forEach(key => { if (item.applicableSelectedItems) {