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

@ -17,5 +17,5 @@
<script>
export default {
inject: ['popupMenuItems']
}
};
</script>

View File

@ -54,7 +54,7 @@ export default {
data() {
return {
popupMenuItems: []
}
};
},
watch: {
},
@ -68,12 +68,12 @@ export default {
cssClass: 'icon-trash',
name: this.removeActionString,
callback: this.getRemoveDialog.bind(this)
}
};
const preview = {
cssClass: 'icon-eye-open',
name: 'Preview',
callback: this.previewEmbed.bind(this)
}
};
this.popupMenuItems = [removeEmbed, preview];
},
@ -200,7 +200,7 @@ export default {
const options = {
name: this.removeActionString,
callback: this.removeEmbed.bind(this)
}
};
const removeDialog = new RemoveDialog(this.openmct, options);
removeDialog.show();
},
@ -222,7 +222,9 @@ export default {
const snapshotOverlay = this.openmct.overlays.overlay({
element: this.snapshot.$mount().$el,
onDestroy: () => { this.snapshot.$destroy(true) },
onDestroy: () => {
this.snapshot.$destroy(true);
},
size: 'large',
dismissable: true,
buttons: [
@ -262,5 +264,5 @@ export default {
this.$emit('updateEmbed', embed);
}
}
}
};
</script>

View File

@ -112,7 +112,7 @@ export default {
color: '#6e6e6e'
},
defaultText: 'add description'
}
};
},
watch: {
entry() {
@ -197,7 +197,7 @@ export default {
link: null,
objectPath,
openmct: this.openmct
}
};
const newEmbed = createNewEmbed(snapshotMeta);
const entries = getNotebookEntries(this.domainObject, this.selectedSection, this.selectedPage);
const currentEntryEmbeds = entries[entryPos].embeds;
@ -277,7 +277,7 @@ export default {
return;
}
const target = $event.target
const target = $event.target;
this.currentEntryValue = target ? target.innerText : '';
if (!this.entry.text.length) {
@ -312,5 +312,5 @@ export default {
this.$emit('updateEntries', entries);
}
}
}
};
</script>

View File

@ -59,7 +59,7 @@ export default {
notebookSnapshot: null,
notebookTypes: [],
showMenu: false
}
};
},
mounted() {
this.notebookSnapshot = new Snapshot(this.openmct);
@ -126,5 +126,5 @@ export default {
});
}
}
}
};
</script>

View File

@ -74,7 +74,7 @@ export default {
popupMenuItems: [],
removeActionString: 'Delete all snapshots',
snapshots: []
}
};
},
mounted() {
this.addPopupMenuItems();
@ -89,7 +89,7 @@ export default {
cssClass: 'icon-trash',
name: this.removeActionString,
callback: this.getRemoveDialog.bind(this)
}
};
this.popupMenuItems = [removeSnapshot];
},
@ -103,7 +103,7 @@ export default {
const options = {
name: this.removeActionString,
callback: this.removeAllSnapshots.bind(this)
}
};
const removeDialog = new RemoveDialog(this.openmct, options);
removeDialog.show();
},
@ -128,5 +128,5 @@ export default {
this.snapshotContainer.updateSnapshot(snapshot);
}
}
}
};
</script>

View File

@ -24,7 +24,7 @@ import { NOTEBOOK_SNAPSHOT_MAX_COUNT } from '../snapshot-container';
import Vue from 'vue';
export default {
inject: ['openmct','snapshotContainer'],
inject: ['openmct', 'snapshotContainer'],
data() {
return {
expanded: false,
@ -32,7 +32,7 @@ export default {
snapshotCount: 0,
snapshotMaxCount: NOTEBOOK_SNAPSHOT_MAX_COUNT,
flashIndicator: false
}
};
},
mounted() {
this.snapshotContainer.on(EVENT_SNAPSHOTS_UPDATED, this.snapshotsUpdated);
@ -50,6 +50,7 @@ export default {
if (this.snapshotContainer.getSnapshots().length > this.snapshotCount) {
this.notifyNewSnapshot();
}
this.updateSnapshotIndicatorTitle();
},
toggleSnapshot() {
@ -93,5 +94,5 @@ export default {
this.indicatorTitle = `${snapshotCount} ${snapshotTitleSuffix}`;
}
}
}
};
</script>

View File

@ -134,7 +134,7 @@ export default {
showTime: 0,
showNav: false,
sidebarCoversEntries: false
}
};
},
computed: {
filteredAndSortedEntries() {
@ -192,7 +192,7 @@ export default {
updated: function () {
this.$nextTick(function () {
this.focusOnEntryId();
})
});
},
methods: {
addDefaultClass() {
@ -243,7 +243,7 @@ export default {
notebookMeta,
section,
page
}
};
},
dragOver(event) {
event.preventDefault();
@ -306,7 +306,7 @@ export default {
const isPhone = Array.from(classList).includes('phone');
const isTablet = Array.from(classList).includes('tablet');
const isPortrait = window.screen.orientation.type.includes('portrait');
const isInLayout = !!this.$el.closest('.c-so-view');
const isInLayout = Boolean(this.$el.closest('.c-so-view'));
const sidebarCoversEntries = (isPhone || (isTablet && isPortrait) || isInLayout);
this.sidebarCoversEntries = sidebarCoversEntries;
},
@ -391,7 +391,7 @@ export default {
},
navigateToSectionPage() {
const { pageId, sectionId } = this.openmct.router.getParams();
if(!pageId || !sectionId) {
if (!pageId || !sectionId) {
return;
}
@ -461,7 +461,7 @@ export default {
const page = pages.find(p => p.id === id);
if (!page && defaultNotebookPage.id === id) {
this.defaultSectionId = null;
this.defaultPageId = null
this.defaultPageId = null;
this.removeDefaultClass(this.internalDomainObject);
clearDefaultNotebook();
@ -489,7 +489,7 @@ export default {
const section = sections.find(s => s.id === id);
if (!section && defaultNotebookSection.id === id) {
this.defaultSectionId = null;
this.defaultPageId = null
this.defaultPageId = null;
this.removeDefaultClass(this.internalDomainObject);
clearDefaultNotebook();
@ -560,5 +560,5 @@ export default {
this.updateDefaultNotebookSection(sections, id);
}
}
}
};
</script>

View File

@ -68,7 +68,7 @@ export default {
},
data() {
return {
}
};
},
watch: {
},
@ -102,7 +102,10 @@ export default {
pages[0].isSelected = true;
}
this.$emit('updatePage', { pages, id });
this.$emit('updatePage', {
pages,
id
});
},
selectPage(id) {
const pages = this.pages.map(page => {
@ -112,7 +115,10 @@ export default {
return page;
});
this.$emit('updatePage', { pages, id });
this.$emit('updatePage', {
pages,
id
});
// Add test here for whether or not to toggle the nav
if (this.sidebarCoversEntries) {
@ -125,8 +131,11 @@ export default {
page.id === id
? newPage
: page);
this.$emit('updatePage', { pages, id });
this.$emit('updatePage', {
pages,
id
});
}
}
}
};
</script>

View File

@ -44,7 +44,7 @@ export default {
return {
popupMenuItems: [],
removeActionString: `Delete ${this.pageTitle}`
}
};
},
watch: {
page(newPage) {
@ -63,7 +63,7 @@ export default {
cssClass: 'icon-trash',
name: this.removeActionString,
callback: this.getRemoveDialog.bind(this)
}
};
this.popupMenuItems = [removePage];
},
@ -80,7 +80,7 @@ export default {
name: this.removeActionString,
callback: this.deletePage.bind(this),
message
}
};
const removeDialog = new RemoveDialog(this.openmct, options);
removeDialog.show();
},
@ -92,6 +92,7 @@ export default {
if (page.className.indexOf('is-selected') > -1) {
input.contentEditable = true;
input.classList.add('c-input-inline');
return;
}
@ -123,5 +124,5 @@ export default {
this.$emit('renamePage', Object.assign(this.page, { name }));
}
}
}
};
</script>

View File

@ -30,7 +30,7 @@ export default {
data() {
return {
menuItems: null
}
};
},
mounted() {
},
@ -54,7 +54,7 @@ export default {
return {
x: eventPosX,
y: eventPosY
}
};
},
hideMenuItems() {
document.body.removeChild(this.menuItems.$el);
@ -89,5 +89,5 @@ export default {
}, 0);
}
}
}
};
</script>

View File

@ -23,7 +23,7 @@ export default {
components: {
NotebookEntry
},
props:{
props: {
results: {
type: Array,
default() {
@ -32,7 +32,7 @@ export default {
}
},
data() {
return {}
return {};
},
watch: {
results(newResults) {}
@ -46,5 +46,5 @@ export default {
this.$emit('changeSectionPage', data);
}
}
}
};
</script>

View File

@ -55,7 +55,7 @@ export default {
},
data() {
return {
}
};
},
watch: {
},
@ -88,7 +88,10 @@ export default {
sections[0].isSelected = true;
}
this.$emit('updateSection', { sections, id });
this.$emit('updateSection', {
sections,
id
});
},
selectSection(id, newSections) {
const currentSections = newSections || this.sections;
@ -98,7 +101,10 @@ export default {
return section;
});
this.$emit('updateSection', { sections, id });
this.$emit('updateSection', {
sections,
id
});
},
updateSection(newSection) {
const id = newSection.id;
@ -106,8 +112,11 @@ export default {
section.id === id
? newSection
: section);
this.$emit('updateSection', { sections, id });
this.$emit('updateSection', {
sections,
id
});
}
}
}
};
</script>

View File

@ -47,7 +47,7 @@ export default {
return {
popupMenuItems: [],
removeActionString: `Delete ${this.sectionTitle}`
}
};
},
watch: {
section(newSection) {
@ -66,7 +66,7 @@ export default {
cssClass: 'icon-trash',
name: this.removeActionString,
callback: this.getRemoveDialog.bind(this)
}
};
this.popupMenuItems = [removeSection];
},
@ -83,7 +83,7 @@ export default {
name: this.removeActionString,
callback: this.deleteSection.bind(this),
message
}
};
const removeDialog = new RemoveDialog(this.openmct, options);
removeDialog.show();
@ -96,6 +96,7 @@ export default {
if (section.className.indexOf('is-selected') > -1) {
input.contentEditable = true;
input.classList.add('c-input-inline');
return;
}
@ -128,5 +129,5 @@ export default {
this.$emit('renameSection', Object.assign(this.section, { name }));
}
}
}
};
</script>

View File

@ -120,7 +120,7 @@ export default {
},
data() {
return {
}
};
},
watch: {
pages(newpages) {
@ -147,43 +147,55 @@ export default {
const id = uuid();
const page = {
id,
isDefault : false,
isDefault: false,
isSelected: true,
name : `Unnamed ${pageTitle}`,
name: `Unnamed ${pageTitle}`,
pageTitle
};
this.pages.forEach(p => p.isSelected = false);
const pages = this.pages.concat(page);
this.updatePage({ pages, id });
this.updatePage({
pages,
id
});
},
addSection() {
const sectionTitle = this.sectionTitle;
const id = uuid();
const section = {
id,
isDefault : false,
isDefault: false,
isSelected: true,
name : `Unnamed ${sectionTitle}`,
pages : [],
name: `Unnamed ${sectionTitle}`,
pages: [],
sectionTitle
};
this.sections.forEach(s => s.isSelected = false);
const sections = this.sections.concat(section);
this.updateSection({ sections, id });
this.updateSection({
sections,
id
});
},
toggleNav() {
this.$emit('toggleNav');
},
updatePage({ pages, id }) {
this.$emit('updatePage', { pages, id });
this.$emit('updatePage', {
pages,
id
});
},
updateSection({ sections, id }) {
this.$emit('updateSection', { sections, id });
this.$emit('updateSection', {
sections,
id
});
}
}
}
};
</script>

View File

@ -3,7 +3,7 @@ import NotebookSnapshotIndicator from './components/notebook-snapshot-indicator.
import SnapshotContainer from './snapshot-container';
import Vue from 'vue';
let installed = false;
let installed = false;
export default function NotebookPlugin() {
return function install(openmct) {
@ -109,6 +109,7 @@ export default function NotebookPlugin() {
},
view: function (domainObject) {
let component;
return {
show(container) {
component = new Vue({

View File

@ -5,7 +5,7 @@ const TIME_BOUNDS = {
END_BOUND: 'tc.endBound',
START_DELTA: 'tc.startDelta',
END_DELTA: 'tc.endDelta'
}
};
export const getHistoricLinkInFixedMode = (openmct, bounds, historicLink) => {
if (historicLink.includes('tc.mode=fixed')) {
@ -35,7 +35,7 @@ export const getHistoricLinkInFixedMode = (openmct, bounds, historicLink) => {
});
return params.join('&');
}
};
export const getNotebookDefaultEntries = (notebookStorage, domainObject) => {
if (!notebookStorage || !domainObject) {
@ -64,7 +64,7 @@ export const getNotebookDefaultEntries = (notebookStorage, domainObject) => {
}
return entries[defaultSection.id][defaultPage.id];
}
};
export const createNewEmbed = (snapshotMeta, snapshot = '') => {
const {
@ -82,7 +82,10 @@ export const createNewEmbed = (snapshotMeta, snapshot = '') => {
const date = Date.now();
const historicLink = link
? getHistoricLinkInFixedMode(openmct, bounds, link)
: objectLink.computed.objectLink.call({ objectPath, openmct });
: objectLink.computed.objectLink.call({
objectPath,
openmct
});
const name = domainObject.name;
const type = domainObject.identifier.key;
@ -97,7 +100,7 @@ export const createNewEmbed = (snapshotMeta, snapshot = '') => {
snapshot,
type
};
}
};
export const addNotebookEntry = (openmct, domainObject, notebookStorage, embed = null) => {
if (!openmct || !domainObject || !notebookStorage) {
@ -128,7 +131,7 @@ export const addNotebookEntry = (openmct, domainObject, notebookStorage, embed =
openmct.objects.mutate(domainObject, 'configuration.entries', entries);
return id;
}
};
export const getNotebookEntries = (domainObject, selectedSection, selectedPage) => {
if (!domainObject || !selectedSection || !selectedPage) {
@ -149,7 +152,7 @@ export const getNotebookEntries = (domainObject, selectedSection, selectedPage)
}
return entries[selectedSection.id][selectedPage.id];
}
};
export const getEntryPosById = (entryId, domainObject, selectedSection, selectedPage) => {
if (!domainObject || !selectedSection || !selectedPage) {
@ -167,7 +170,7 @@ export const getEntryPosById = (entryId, domainObject, selectedSection, selected
});
return foundId;
}
};
export const deleteNotebookEntries = (openmct, domainObject, selectedSection, selectedPage) => {
if (!domainObject || !selectedSection) {
@ -191,4 +194,4 @@ export const deleteNotebookEntries = (openmct, domainObject, selectedSection, se
delete entries[selectedSection.id][selectedPage.id];
openmct.objects.mutate(domainObject, 'configuration.entries', entries);
}
};