mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
ESLint rules: rules requiring minor changes (#3139)
* implemented trivial code changes necessary batch of rules Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
7e7141a5a0
commit
0b4a843617
14
.eslintrc.js
14
.eslintrc.js
@ -120,6 +120,20 @@ module.exports = {
|
|||||||
"no-useless-computed-key": "error",
|
"no-useless-computed-key": "error",
|
||||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
// https://eslint.org/docs/rules/rest-spread-spacing
|
||||||
"rest-spread-spacing": ["error"],
|
"rest-spread-spacing": ["error"],
|
||||||
|
// https://eslint.org/docs/rules/no-unused-expressions
|
||||||
|
"no-unused-expressions": "error",
|
||||||
|
// https://eslint.org/docs/rules/no-useless-concat
|
||||||
|
"no-useless-concat": "error",
|
||||||
|
// https://eslint.org/docs/rules/radix
|
||||||
|
"radix": "error",
|
||||||
|
// https://eslint.org/docs/rules/require-await
|
||||||
|
"require-await": "error",
|
||||||
|
// https://eslint.org/docs/rules/no-alert
|
||||||
|
"no-alert": "error",
|
||||||
|
// https://eslint.org/docs/rules/no-useless-constructor
|
||||||
|
"no-useless-constructor": "error",
|
||||||
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-coercion
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
||||||
"no-implicit-coercion": "error",
|
"no-implicit-coercion": "error",
|
||||||
|
@ -80,7 +80,7 @@ define(
|
|||||||
control: "button",
|
control: "button",
|
||||||
csslass: "icon-save",
|
csslass: "icon-save",
|
||||||
click: function () {
|
click: function () {
|
||||||
window.alert("Save");
|
console.log("Save");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ define(
|
|||||||
csslass: "icon-x",
|
csslass: "icon-x",
|
||||||
description: "Button B",
|
description: "Button B",
|
||||||
click: function () {
|
click: function () {
|
||||||
window.alert("Cancel");
|
console.log("Cancel");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -97,7 +97,7 @@ define(
|
|||||||
description: "Button C",
|
description: "Button C",
|
||||||
disabled: true,
|
disabled: true,
|
||||||
click: function () {
|
click: function () {
|
||||||
window.alert("Delete");
|
console.log("Delete");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -72,21 +72,25 @@ define([
|
|||||||
ObjectServiceProvider.prototype.create = async function (object) {
|
ObjectServiceProvider.prototype.create = async function (object) {
|
||||||
let model = utils.toOldFormat(object);
|
let model = utils.toOldFormat(object);
|
||||||
|
|
||||||
return this.getPersistenceService().createObject(
|
let result = await this.getPersistenceService().createObject(
|
||||||
this.getSpace(utils.makeKeyString(object.identifier)),
|
this.getSpace(utils.makeKeyString(object.identifier)),
|
||||||
object.identifier.key,
|
object.identifier.key,
|
||||||
model
|
model
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
ObjectServiceProvider.prototype.update = async function (object) {
|
ObjectServiceProvider.prototype.update = async function (object) {
|
||||||
let model = utils.toOldFormat(object);
|
let model = utils.toOldFormat(object);
|
||||||
|
|
||||||
return this.getPersistenceService().updateObject(
|
let result = await this.getPersistenceService().updateObject(
|
||||||
this.getSpace(utils.makeKeyString(object.identifier)),
|
this.getSpace(utils.makeKeyString(object.identifier)),
|
||||||
object.identifier.key,
|
object.identifier.key,
|
||||||
model
|
model
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,8 +108,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { OPERATIONS } from '../utils/operations';
|
import { OPERATIONS, INPUT_TYPES } from '../utils/operations';
|
||||||
import { INPUT_TYPES } from '../utils/operations';
|
|
||||||
import {TRIGGER_CONJUNCTION} from "../utils/constants";
|
import {TRIGGER_CONJUNCTION} from "../utils/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -34,9 +34,6 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
|
|||||||
* @param telemetryDomainObjectDefinition {id: uuid, operation: enum, input: Array, metadata: string, key: {domainObject.identifier} }
|
* @param telemetryDomainObjectDefinition {id: uuid, operation: enum, input: Array, metadata: string, key: {domainObject.identifier} }
|
||||||
* @param openmct
|
* @param openmct
|
||||||
*/
|
*/
|
||||||
constructor(telemetryDomainObjectDefinition, openmct) {
|
|
||||||
super(telemetryDomainObjectDefinition, openmct);
|
|
||||||
}
|
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.telemetryObjects = { ...this.telemetryDomainObjectDefinition.telemetryObjects };
|
this.telemetryObjects = { ...this.telemetryDomainObjectDefinition.telemetryObjects };
|
||||||
|
@ -119,7 +119,7 @@ describe("The telemetry criterion", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('the LAD request', () => {
|
describe('the LAD request', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(() => {
|
||||||
let telemetryRequestResolve;
|
let telemetryRequestResolve;
|
||||||
let telemetryRequestPromise = new Promise((resolve) => {
|
let telemetryRequestPromise = new Promise((resolve) => {
|
||||||
telemetryRequestResolve = resolve;
|
telemetryRequestResolve = resolve;
|
||||||
@ -133,7 +133,7 @@ describe("The telemetry criterion", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns results for slow LAD requests", async function () {
|
it("returns results for slow LAD requests", function () {
|
||||||
const criteriaRequest = telemetryCriterion.requestLAD();
|
const criteriaRequest = telemetryCriterion.requestLAD();
|
||||||
telemetryCriterion.destroy();
|
telemetryCriterion.destroy();
|
||||||
expect(telemetryCriterion.telemetryObject).toBeUndefined();
|
expect(telemetryCriterion.telemetryObject).toBeUndefined();
|
||||||
|
@ -70,7 +70,7 @@ export default {
|
|||||||
document.removeEventListener('click', this.hideMenu);
|
document.removeEventListener('click', this.hideMenu);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async setNotebookTypes() {
|
setNotebookTypes() {
|
||||||
const notebookTypes = [];
|
const notebookTypes = [];
|
||||||
const defaultNotebook = getDefaultNotebook();
|
const defaultNotebook = getDefaultNotebook();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ define([
|
|||||||
|
|
||||||
self.options.forEach(function (option, index) {
|
self.options.forEach(function (option, index) {
|
||||||
$('select', self.domElement)
|
$('select', self.domElement)
|
||||||
.append('<option value = "' + option[0] + '"' + ' >'
|
.append('<option value = "' + option[0] + '" >'
|
||||||
+ option[1] + '</option>');
|
+ option[1] + '</option>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,21 +68,22 @@ export default {
|
|||||||
setFilterNames() {
|
setFilterNames() {
|
||||||
let names = [];
|
let names = [];
|
||||||
let composition = this.openmct.composition.get(this.table.configuration.domainObject);
|
let composition = this.openmct.composition.get(this.table.configuration.domainObject);
|
||||||
|
if (composition !== undefined) {
|
||||||
|
composition.load().then((domainObjects) => {
|
||||||
|
domainObjects.forEach(telemetryObject => {
|
||||||
|
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
||||||
|
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
||||||
|
let filters = this.filteredTelemetry[keyString];
|
||||||
|
|
||||||
composition && composition.load().then((domainObjects) => {
|
if (filters !== undefined) {
|
||||||
domainObjects.forEach(telemetryObject => {
|
names.push(this.getFilterNamesFromMetadata(filters, metadataValues));
|
||||||
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
}
|
||||||
let metadataValues = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
});
|
||||||
let filters = this.filteredTelemetry[keyString];
|
|
||||||
|
|
||||||
if (filters !== undefined) {
|
names = _.flatten(names);
|
||||||
names.push(this.getFilterNamesFromMetadata(filters, metadataValues));
|
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
names = _.flatten(names);
|
|
||||||
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getFilterNamesFromMetadata(filters, metadataValues) {
|
getFilterNamesFromMetadata(filters, metadataValues) {
|
||||||
let filterNames = [];
|
let filterNames = [];
|
||||||
|
@ -104,7 +104,7 @@ export default {
|
|||||||
resizeColumn(event) {
|
resizeColumn(event) {
|
||||||
let delta = event.clientX - this.resizeStartX;
|
let delta = event.clientX - this.resizeStartX;
|
||||||
let newWidth = this.resizeStartWidth + delta;
|
let newWidth = this.resizeStartWidth + delta;
|
||||||
let minWidth = parseInt(window.getComputedStyle(this.$el).minWidth);
|
let minWidth = parseInt(window.getComputedStyle(this.$el).minWidth, 10);
|
||||||
if (newWidth > minWidth) {
|
if (newWidth > minWidth) {
|
||||||
this.$emit('resizeColumn', this.headerKey, newWidth);
|
this.$emit('resizeColumn', this.headerKey, newWidth);
|
||||||
}
|
}
|
||||||
|
@ -190,13 +190,23 @@ export default {
|
|||||||
|
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
this.dragX = $event.clientX;
|
this.dragX = $event.clientX;
|
||||||
this.inPanMode ? this.pan() : this.zoom();
|
|
||||||
|
if (this.inPanMode) {
|
||||||
|
this.pan();
|
||||||
|
} else {
|
||||||
|
this.zoom();
|
||||||
|
}
|
||||||
|
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dragEnd() {
|
dragEnd() {
|
||||||
this.inPanMode ? this.endPan() : this.endZoom();
|
if (this.inPanMode) {
|
||||||
|
this.endPan();
|
||||||
|
} else {
|
||||||
|
this.endZoom();
|
||||||
|
}
|
||||||
|
|
||||||
document.removeEventListener('mousemove', this.drag);
|
document.removeEventListener('mousemove', this.drag);
|
||||||
this.dragStartX = undefined;
|
this.dragStartX = undefined;
|
||||||
|
@ -103,7 +103,7 @@ export default {
|
|||||||
},
|
},
|
||||||
updatePosition: function (event) {
|
updatePosition: function (event) {
|
||||||
let size = this.getNewSize(event);
|
let size = this.getNewSize(event);
|
||||||
let intSize = parseInt(size.substr(0, size.length - 2));
|
let intSize = parseInt(size.substr(0, size.length - 2), 10);
|
||||||
if (intSize < COLLAPSE_THRESHOLD_PX && this.collapsable === true) {
|
if (intSize < COLLAPSE_THRESHOLD_PX && this.collapsable === true) {
|
||||||
this.dragCollapse = true;
|
this.dragCollapse = true;
|
||||||
this.end();
|
this.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user