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",
|
||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
||||
"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
|
||||
"no-implicit-coercion": "error",
|
||||
|
@ -80,7 +80,7 @@ define(
|
||||
control: "button",
|
||||
csslass: "icon-save",
|
||||
click: function () {
|
||||
window.alert("Save");
|
||||
console.log("Save");
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -88,7 +88,7 @@ define(
|
||||
csslass: "icon-x",
|
||||
description: "Button B",
|
||||
click: function () {
|
||||
window.alert("Cancel");
|
||||
console.log("Cancel");
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -97,7 +97,7 @@ define(
|
||||
description: "Button C",
|
||||
disabled: true,
|
||||
click: function () {
|
||||
window.alert("Delete");
|
||||
console.log("Delete");
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -72,21 +72,25 @@ define([
|
||||
ObjectServiceProvider.prototype.create = async function (object) {
|
||||
let model = utils.toOldFormat(object);
|
||||
|
||||
return this.getPersistenceService().createObject(
|
||||
let result = await this.getPersistenceService().createObject(
|
||||
this.getSpace(utils.makeKeyString(object.identifier)),
|
||||
object.identifier.key,
|
||||
model
|
||||
);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
ObjectServiceProvider.prototype.update = async function (object) {
|
||||
let model = utils.toOldFormat(object);
|
||||
|
||||
return this.getPersistenceService().updateObject(
|
||||
let result = await this.getPersistenceService().updateObject(
|
||||
this.getSpace(utils.makeKeyString(object.identifier)),
|
||||
object.identifier.key,
|
||||
model
|
||||
);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -108,8 +108,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { OPERATIONS } from '../utils/operations';
|
||||
import { INPUT_TYPES } from '../utils/operations';
|
||||
import { OPERATIONS, INPUT_TYPES } from '../utils/operations';
|
||||
import {TRIGGER_CONJUNCTION} from "../utils/constants";
|
||||
|
||||
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 openmct
|
||||
*/
|
||||
constructor(telemetryDomainObjectDefinition, openmct) {
|
||||
super(telemetryDomainObjectDefinition, openmct);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.telemetryObjects = { ...this.telemetryDomainObjectDefinition.telemetryObjects };
|
||||
|
@ -119,7 +119,7 @@ describe("The telemetry criterion", function () {
|
||||
});
|
||||
|
||||
describe('the LAD request', () => {
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
let telemetryRequestResolve;
|
||||
let telemetryRequestPromise = new Promise((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();
|
||||
telemetryCriterion.destroy();
|
||||
expect(telemetryCriterion.telemetryObject).toBeUndefined();
|
||||
|
@ -70,7 +70,7 @@ export default {
|
||||
document.removeEventListener('click', this.hideMenu);
|
||||
},
|
||||
methods: {
|
||||
async setNotebookTypes() {
|
||||
setNotebookTypes() {
|
||||
const notebookTypes = [];
|
||||
const defaultNotebook = getDefaultNotebook();
|
||||
|
||||
|
@ -79,7 +79,7 @@ define([
|
||||
|
||||
self.options.forEach(function (option, index) {
|
||||
$('select', self.domElement)
|
||||
.append('<option value = "' + option[0] + '"' + ' >'
|
||||
.append('<option value = "' + option[0] + '" >'
|
||||
+ option[1] + '</option>');
|
||||
});
|
||||
|
||||
|
@ -68,21 +68,22 @@ export default {
|
||||
setFilterNames() {
|
||||
let names = [];
|
||||
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) => {
|
||||
domainObjects.forEach(telemetryObject => {
|
||||
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.push(this.getFilterNamesFromMetadata(filters, metadataValues));
|
||||
}
|
||||
});
|
||||
|
||||
if (filters !== undefined) {
|
||||
names.push(this.getFilterNamesFromMetadata(filters, metadataValues));
|
||||
}
|
||||
names = _.flatten(names);
|
||||
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) {
|
||||
let filterNames = [];
|
||||
|
@ -104,7 +104,7 @@ export default {
|
||||
resizeColumn(event) {
|
||||
let delta = event.clientX - this.resizeStartX;
|
||||
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) {
|
||||
this.$emit('resizeColumn', this.headerKey, newWidth);
|
||||
}
|
||||
|
@ -190,13 +190,23 @@ export default {
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
this.dragX = $event.clientX;
|
||||
this.inPanMode ? this.pan() : this.zoom();
|
||||
|
||||
if (this.inPanMode) {
|
||||
this.pan();
|
||||
} else {
|
||||
this.zoom();
|
||||
}
|
||||
|
||||
this.dragging = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
dragEnd() {
|
||||
this.inPanMode ? this.endPan() : this.endZoom();
|
||||
if (this.inPanMode) {
|
||||
this.endPan();
|
||||
} else {
|
||||
this.endZoom();
|
||||
}
|
||||
|
||||
document.removeEventListener('mousemove', this.drag);
|
||||
this.dragStartX = undefined;
|
||||
|
@ -103,7 +103,7 @@ export default {
|
||||
},
|
||||
updatePosition: function (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) {
|
||||
this.dragCollapse = true;
|
||||
this.end();
|
||||
|
Loading…
Reference in New Issue
Block a user