New eslint rules auto fix (#3058)

* no-implicit-coercion and no-unneeded-ternary

* End every line with a semicolon

* Spacing and formatting

* Enabled semi-spacing

* Applies npm run lint:fix to code after master merge

* Fix merge issues

* Switched operator-linebreak to 'before'

Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
Andrew Henry
2020-07-31 12:11:03 -07:00
committed by GitHub
parent 573a63d359
commit a09da30768
739 changed files with 4660 additions and 2339 deletions

View File

@ -22,11 +22,12 @@
export default function ladTableCompositionPolicy(openmct) {
return function (parent, child) {
if(parent.type === 'LadTable') {
if (parent.type === 'LadTable') {
return openmct.telemetry.isTelemetryObject(child);
} else if(parent.type === 'LadTableSet') {
} else if (parent.type === 'LadTableSet') {
return child.type === 'LadTable';
}
return true;
}
};
}

View File

@ -38,7 +38,7 @@ export default function LADTableSetViewProvider(openmct) {
return {
show: function (element) {
component = new Vue({
component = new Vue({
el: element,
components: {
LadTableSet: LadTableSet

View File

@ -38,7 +38,7 @@ export default function LADTableViewProvider(openmct) {
return {
show: function (element) {
component = new Vue({
component = new Vue({
el: element,
components: {
LadTableComponent: LadTable

View File

@ -60,7 +60,7 @@ export default {
value: '---',
valueClass: '',
currentObjectPath
}
};
},
computed: {
formattedTimestamp() {
@ -94,7 +94,7 @@ export default {
.metadata
.valuesForHints(['range'])[0];
this.valueKey = this.valueMetadata.key
this.valueKey = this.valueMetadata.key;
this.unsubscribe = this.openmct
.telemetry
@ -113,7 +113,7 @@ export default {
let newTimestamp = this.getParsedTimestamp(datum),
limit;
if(this.shouldUpdate(newTimestamp)) {
if (this.shouldUpdate(newTimestamp)) {
this.timestamp = newTimestamp;
this.value = this.formats[this.valueKey].format(datum);
limit = this.limitEvaluator.evaluate(datum, this.valueMetadata);
@ -129,8 +129,8 @@ export default {
noExistingTimestamp = this.timestamp === undefined,
newTimestampIsLatest = newTimestamp > this.timestamp;
return newTimestampInBounds &&
(noExistingTimestamp || newTimestampIsLatest);
return newTimestampInBounds
&& (noExistingTimestamp || newTimestampIsLatest);
},
requestHistory() {
this.openmct
@ -148,7 +148,7 @@ export default {
},
updateBounds(bounds, isTick) {
this.bounds = bounds;
if(!isTick) {
if (!isTick) {
this.resetValues();
this.requestHistory();
}
@ -169,24 +169,25 @@ export default {
this.valueClass = '';
},
getParsedTimestamp(timestamp) {
if(this.timeSystemFormat()) {
if (this.timeSystemFormat()) {
return this.formats[this.timestampKey].parse(timestamp);
}
},
getFormattedTimestamp(timestamp) {
if(this.timeSystemFormat()) {
if (this.timeSystemFormat()) {
return this.formats[this.timestampKey].format(timestamp);
}
},
timeSystemFormat() {
if(this.formats[this.timestampKey]) {
if (this.formats[this.timestampKey]) {
return true;
} else {
console.warn(`No formatter for ${this.timestampKey} time system for ${this.domainObject.name}.`);
return false;
}
}
}
}
};
</script>

View File

@ -52,7 +52,7 @@ export default {
data() {
return {
items: []
}
};
},
mounted() {
this.composition = this.openmct.composition.get(this.domainObject);
@ -86,5 +86,5 @@ export default {
});
}
}
}
};
</script>

View File

@ -64,7 +64,7 @@ export default {
primaryTelemetryObjects: [],
secondaryTelemetryObjects: {},
compositions: []
}
};
},
mounted() {
this.composition = this.openmct.composition.get(this.domainObject);
@ -99,14 +99,18 @@ export default {
composition.on('remove', removeCallback);
composition.load();
this.compositions.push({composition, addCallback, removeCallback});
this.compositions.push({
composition,
addCallback,
removeCallback
});
},
removePrimary(identifier) {
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
primary = this.primaryTelemetryObjects[index];
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
this.primaryTelemetryObjects.splice(index,1);
this.primaryTelemetryObjects.splice(index, 1);
primary = undefined;
},
reorderPrimary(reorderPlan) {
@ -125,7 +129,7 @@ export default {
array.push(secondary);
this.$set(this.secondaryTelemetryObjects, primary.key, array);
}
};
},
removeSecondary(primary) {
return (identifier) => {
@ -135,8 +139,8 @@ export default {
array.splice(index, 1);
this.$set(this.secondaryTelemetryObjects, primary.key, array);
}
};
}
}
}
};
</script>

View File

@ -37,7 +37,7 @@ const TABLE_BODY_FIRST_ROW_THIRD_DATA = TABLE_BODY_FIRST_ROW + ' .js-third-data'
const LAD_SET_TABLE_HEADERS = '.js-lad-table-set__table-headers';
function utcTimeFormat(value) {
return new Date(value).toISOString().replace('T', ' ')
return new Date(value).toISOString().replace('T', ' ');
}
describe("The LAD Table", () => {
@ -49,7 +49,10 @@ describe("The LAD Table", () => {
child,
telemetryCount = 3,
timeFormat = 'utc',
mockTelemetry = getMockTelemetry({ count: telemetryCount, format: timeFormat }),
mockTelemetry = getMockTelemetry({
count: telemetryCount,
format: timeFormat
}),
mockObj = getMockObjects({
objectKeyStrings: ['ladTable', 'telemetry'],
format: timeFormat
@ -81,7 +84,10 @@ describe("The LAD Table", () => {
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
openmct.time.bounds({ start: bounds.start, end: bounds.end });
openmct.time.bounds({
start: bounds.start,
end: bounds.end
});
openmct.on('start', done);
openmct.startHeadless(appHolder);
@ -116,7 +122,7 @@ describe("The LAD Table", () => {
});
it("should reject non-telemtry producing objects", () => {
expect(()=> {
expect(() => {
ladTableCompositionCollection.add(mockObj.ladTable);
}).toThrow();
});
@ -131,7 +137,10 @@ describe("The LAD Table", () => {
overwrite: {
telemetry: {
name: "New Telemetry Object",
identifier: { namespace: "", key: "another-telemetry-object" }
identifier: {
namespace: "",
key: "another-telemetry-object"
}
}
}
}).telemetry;
@ -151,22 +160,28 @@ describe("The LAD Table", () => {
}),
anotherTelemetryObjectPromise = new Promise((resolve) => {
anotherTelemetryObjectResolve = resolve;
})
});
openmct.telemetry.request.and.callFake(() => {
telemetryRequestResolve(mockTelemetry);
return telemetryRequestPromise;
});
openmct.objects.get.and.callFake((obj) => {
if(obj.key === 'telemetry-object') {
if (obj.key === 'telemetry-object') {
telemetryObjectResolve(mockObj.telemetry);
return telemetryObjectPromise;
} else {
anotherTelemetryObjectResolve(anotherTelemetryObj);
return anotherTelemetryObjectPromise;
}
});
openmct.time.bounds({ start: bounds.start, end: bounds.end });
openmct.time.bounds({
start: bounds.start,
end: bounds.end
});
applicableViews = openmct.objectViews.get(mockObj.ladTable);
ladTableViewProvider = applicableViews.find((viewProvider) => viewProvider.key === ladTableKey);
@ -175,6 +190,7 @@ describe("The LAD Table", () => {
await Promise.all([telemetryRequestPromise, telemetryObjectPromise, anotherTelemetryObjectPromise]);
await Vue.nextTick();
return;
});
@ -225,7 +241,10 @@ describe("The LAD Table Set", () => {
child,
telemetryCount = 3,
timeFormat = 'utc',
mockTelemetry = getMockTelemetry({ count: telemetryCount, format: timeFormat }),
mockTelemetry = getMockTelemetry({
count: telemetryCount,
format: timeFormat
}),
mockObj = getMockObjects({
objectKeyStrings: ['ladTable', 'ladTableSet', 'telemetry']
}),
@ -255,7 +274,10 @@ describe("The LAD Table Set", () => {
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
openmct.time.bounds({ start: bounds.start, end: bounds.end });
openmct.time.bounds({
start: bounds.start,
end: bounds.end
});
openmct.on('start', done);
openmct.start(appHolder);
@ -290,7 +312,7 @@ describe("The LAD Table Set", () => {
});
it("should reject non lad table objects", () => {
expect(()=> {
expect(() => {
ladTableSetCompositionCollection.add(mockObj.telemetry);
}).toThrow();
});
@ -305,7 +327,10 @@ describe("The LAD Table Set", () => {
overwrite: {
ladTable: {
name: "New LAD Table Object",
identifier: { namespace: "", key: "another-lad-object" }
identifier: {
namespace: "",
key: "another-lad-object"
}
}
}
});
@ -326,24 +351,30 @@ describe("The LAD Table Set", () => {
}),
anotherLadObjectPromise = new Promise((resolve) => {
anotherLadObjectResolve = resolve;
})
});
openmct.telemetry.request.and.callFake(() => {
telemetryRequestResolve(mockTelemetry);
return telemetryRequestPromise;
});
openmct.objects.get.and.callFake((obj) => {
if(obj.key === 'lad-object') {
if (obj.key === 'lad-object') {
ladObjectResolve(mockObj.ladObject);
return ladObjectPromise;
} else if(obj.key === 'another-lad-object') {
} else if (obj.key === 'another-lad-object') {
anotherLadObjectResolve(otherObj.ladObject);
return anotherLadObjectPromise;
}
return Promise.resolve({});
});
openmct.time.bounds({ start: bounds.start, end: bounds.end });
openmct.time.bounds({
start: bounds.start,
end: bounds.end
});
applicableViews = openmct.objectViews.get(mockObj.ladTableSet);
ladTableSetViewProvider = applicableViews.find((viewProvider) => viewProvider.key === ladTableSetKey);
@ -352,6 +383,7 @@ describe("The LAD Table Set", () => {
await Promise.all([telemetryRequestPromise, ladObjectPromise, anotherLadObjectPromise]);
await Vue.nextTick();
return;
});