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:
Joel McKinnon 2020-08-10 10:35:40 -07:00 committed by GitHub
parent 7e7141a5a0
commit 0b4a843617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 55 additions and 30 deletions

View File

@ -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",

View File

@ -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");
}
}
]

View File

@ -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;
};
/**

View File

@ -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 {

View File

@ -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 };

View File

@ -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();

View File

@ -70,7 +70,7 @@ export default {
document.removeEventListener('click', this.hideMenu);
},
methods: {
async setNotebookTypes() {
setNotebookTypes() {
const notebookTypes = [];
const defaultNotebook = getDefaultNotebook();

View File

@ -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>');
});

View File

@ -68,8 +68,8 @@ export default {
setFilterNames() {
let names = [];
let composition = this.openmct.composition.get(this.table.configuration.domainObject);
composition && composition.load().then((domainObjects) => {
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();
@ -83,6 +83,7 @@ export default {
names = _.flatten(names);
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
});
}
},
getFilterNamesFromMetadata(filters, metadataValues) {
let filterNames = [];

View File

@ -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);
}

View File

@ -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;

View File

@ -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();