diff --git a/.prettierrc b/.prettierrc index 544138be4..4c112c074 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,4 @@ { - "singleQuote": true + "singleQuote": true, + "trailingComma" : "none" } diff --git a/etc/scripts/generate-make-graph.ts b/etc/scripts/generate-make-graph.ts index 9068990d1..adc1912e4 100644 --- a/etc/scripts/generate-make-graph.ts +++ b/etc/scripts/generate-make-graph.ts @@ -63,7 +63,7 @@ make.stdout.on('data', (data: Buffer) => { graph.push({ type: 'target', name, - depth: depthString.length / 2, + depth: depthString.length / 2 }); continue; } @@ -79,7 +79,7 @@ make.stdout.on('data', (data: Buffer) => { depth = depthString.length / 2; graph.push({ type: 'end', - depth, + depth }); depth = undefined; continue; @@ -89,7 +89,7 @@ make.stdout.on('data', (data: Buffer) => { graph.push({ type: 'code', value: msg.toString(), - depth, + depth }); continue; } @@ -107,7 +107,7 @@ const printGraph = (): void => { const spacer = ' '.repeat(cellWidth - g.name.length - 2); console.log(`${padLeft}┌${bar}┐${padRight}`); console.log( - `${padLeft}│ ${chalk.cyan.bold(g.name)}${spacer} |${padRight}`, + `${padLeft}│ ${chalk.cyan.bold(g.name)}${spacer} |${padRight}` ); continue; } diff --git a/packages/code-snippet/src/CodeSnippetService.ts b/packages/code-snippet/src/CodeSnippetService.ts index 3ff85c777..94693b46f 100644 --- a/packages/code-snippet/src/CodeSnippetService.ts +++ b/packages/code-snippet/src/CodeSnippetService.ts @@ -57,13 +57,13 @@ export class CodeSnippetService { static deleteCodeSnippet(codeSnippet: IMetadata): Promise { return showDialog({ title: `Delete snippet '${codeSnippet.display_name}'?`, - buttons: [Dialog.cancelButton(), Dialog.okButton()], + buttons: [Dialog.cancelButton(), Dialog.okButton()] }).then((result: any) => { // Do nothing if the cancel button is pressed if (result.button.accept) { return MetadataService.deleteMetadata( CODE_SNIPPET_SCHEMASPACE, - codeSnippet.name, + codeSnippet.name ).then(() => true); } else { return false; diff --git a/packages/code-snippet/src/CodeSnippetWidget.tsx b/packages/code-snippet/src/CodeSnippetWidget.tsx index f28f06f56..2ac46c9a6 100644 --- a/packages/code-snippet/src/CodeSnippetWidget.tsx +++ b/packages/code-snippet/src/CodeSnippetWidget.tsx @@ -25,13 +25,13 @@ import { MetadataCommonService, MetadataDisplay, MetadataWidget, - METADATA_ITEM, + METADATA_ITEM } from '@elyra/metadata-common'; import { ExpandableComponent, importIcon, RequestErrors, - trashIcon, + trashIcon } from '@elyra/ui-components'; import { JupyterFrontEnd } from '@jupyterlab/application'; @@ -40,7 +40,7 @@ import { CodeCell, MarkdownCell, ICodeCellModel, - IMarkdownCellModel /*RawCell*/, + IMarkdownCellModel /*RawCell*/ } from '@jupyterlab/cells'; import { CodeEditor, IEditorServices } from '@jupyterlab/codeeditor'; import { PathExt } from '@jupyterlab/coreutils'; @@ -49,13 +49,13 @@ import { FileEditor } from '@jupyterlab/fileeditor'; import * as nbformat from '@jupyterlab/nbformat'; import { Notebook, - /*NotebookModel,*/ NotebookPanel /*,NotebookActions*/, + /*NotebookModel,*/ NotebookPanel /*,NotebookActions*/ } from '@jupyterlab/notebook'; import { copyIcon, editIcon, pasteIcon, - LabIcon, + LabIcon } from '@jupyterlab/ui-components'; import { find } from '@lumino/algorithm'; @@ -70,7 +70,7 @@ import React from 'react'; import { CodeSnippetService, CODE_SNIPPET_SCHEMASPACE, - CODE_SNIPPET_SCHEMA, + CODE_SNIPPET_SCHEMA } from './CodeSnippetService'; const METADATA_EDITOR_ID = 'elyra-metadata-editor'; @@ -138,7 +138,7 @@ class CodeSnippetDisplay extends MetadataDisplay { snippetLanguage.toLowerCase() !== 'markdown' ) { fileEditor.replaceSelection?.( - this.addMarkdownCodeBlock(snippetLanguage, codeSnippet), + this.addMarkdownCodeBlock(snippetLanguage, codeSnippet) ); } else if (editorLanguage) { this.verifyLanguageAndInsert(snippet, editorLanguage, fileEditor); @@ -165,14 +165,14 @@ class CodeSnippetDisplay extends MetadataDisplay { this.verifyLanguageAndInsert( snippet, kernelLanguage, - notebookCellEditor, + notebookCellEditor ); } else if ( notebookCell instanceof MarkdownCell && snippetLanguage.toLowerCase() !== 'markdown' ) { notebookCellEditor.replaceSelection?.( - this.addMarkdownCodeBlock(snippetLanguage, codeSnippet), + this.addMarkdownCodeBlock(snippetLanguage, codeSnippet) ); } else { notebookCellEditor.replaceSelection?.(codeSnippet); @@ -183,7 +183,7 @@ class CodeSnippetDisplay extends MetadataDisplay { const contentFactory = new NotebookPanel.ContentFactory({ editorFactory: - this.props.editorServices.factoryService.newInlineEditor, + this.props.editorServices.factoryService.newInlineEditor }); /* @@ -198,7 +198,7 @@ class CodeSnippetDisplay extends MetadataDisplay { const options: CodeCell.IOptions = { model: notebookContent.activeCell?.model as ICodeCellModel, rendermime: notebookContent.rendermime, - contentFactory: contentFactory, + contentFactory: contentFactory }; const codeCell: any = contentFactory.createCodeCell(options); @@ -209,7 +209,7 @@ class CodeSnippetDisplay extends MetadataDisplay { // codeCell: SharedCell.Cell widget.content.model?.sharedModel.insertCell( activeCellIndex, - codeCell as Partial & { cell_type: string }, + codeCell as Partial & { cell_type: string } ); //update the active cell index to the newly inserted cell @@ -224,14 +224,14 @@ class CodeSnippetDisplay extends MetadataDisplay { // Verify if a given widget is a FileEditor private isFileEditor = ( - widget: Widget, + widget: Widget ): widget is DocumentWidget => { return (widget as DocumentWidget).content instanceof FileEditor; }; // Return the language of the editor or empty string private getEditorLanguage = ( - widget: DocumentWidget, + widget: DocumentWidget ): string | undefined => { const editorLanguage = widget.context.sessionContext.kernelPreference.language; @@ -247,7 +247,7 @@ class CodeSnippetDisplay extends MetadataDisplay { private verifyLanguageAndInsert = async ( snippet: IMetadata, editorLanguage: string, - editor: CodeEditor.IEditor, + editor: CodeEditor.IEditor ): Promise => { const codeSnippet: string = snippet.metadata.code.join('\n'); const snippetLanguage = snippet.metadata.language; @@ -257,7 +257,7 @@ class CodeSnippetDisplay extends MetadataDisplay { ) { const result = await this.showWarnDialog( editorLanguage, - snippet.display_name, + snippet.display_name ); if (result.button.accept) { editor.replaceSelection?.(codeSnippet); @@ -271,12 +271,12 @@ class CodeSnippetDisplay extends MetadataDisplay { // Display warning dialog when inserting a code snippet incompatible with editor's language private showWarnDialog = async ( editorLanguage: string, - snippetName: string, + snippetName: string ): Promise> => { return showDialog({ title: 'Warning', body: `Code snippet "${snippetName}" is incompatible with ${editorLanguage}. Continue?`, - buttons: [Dialog.cancelButton(), Dialog.okButton()], + buttons: [Dialog.cancelButton(), Dialog.okButton()] }); }; @@ -285,14 +285,14 @@ class CodeSnippetDisplay extends MetadataDisplay { return showDialog({ title: 'Error', body: errMsg, - buttons: [Dialog.okButton()], + buttons: [Dialog.okButton()] }); }; // Initial setup to handle dragging a code snippet private handleDragSnippet( event: React.MouseEvent, - metadata: IMetadata, + metadata: IMetadata ): void { const { button } = event; @@ -304,7 +304,7 @@ class CodeSnippetDisplay extends MetadataDisplay { this._dragData = { pressX: event.clientX, pressY: event.clientY, - dragImage: null, + dragImage: null }; const mouseUpListener = (event: MouseEvent): void => { @@ -317,7 +317,7 @@ class CodeSnippetDisplay extends MetadataDisplay { const target = event.target as HTMLElement; target.addEventListener('mouseup', mouseUpListener, { once: true, - capture: true, + capture: true }); target.addEventListener('mousemove', mouseMoveListener, true); @@ -328,7 +328,7 @@ class CodeSnippetDisplay extends MetadataDisplay { private _evtMouseUp( event: MouseEvent, metadata: IMetadata, - mouseMoveListener: (event: MouseEvent) => void, + mouseMoveListener: (event: MouseEvent) => void ): void { event.preventDefault(); event.stopPropagation(); @@ -341,7 +341,7 @@ class CodeSnippetDisplay extends MetadataDisplay { event: MouseEvent, metadata: IMetadata, mouseMoveListener: (event: MouseEvent) => void, - mouseUpListener: (event: MouseEvent) => void, + mouseUpListener: (event: MouseEvent) => void ): void { event.preventDefault(); event.stopPropagation(); @@ -354,7 +354,7 @@ class CodeSnippetDisplay extends MetadataDisplay { data.pressX, data.pressY, event.clientX, - event.clientY, + event.clientY ) ) { // Create drag image @@ -372,7 +372,7 @@ class CodeSnippetDisplay extends MetadataDisplay { data.dragImage, metadata, event.clientX, - event.clientY, + event.clientY ); } } @@ -390,7 +390,7 @@ class CodeSnippetDisplay extends MetadataDisplay { prevX: number, prevY: number, nextX: number, - nextY: number, + nextY: number ): boolean { const dx = Math.abs(nextX - prevX); const dy = Math.abs(nextY - prevY); @@ -401,7 +401,7 @@ class CodeSnippetDisplay extends MetadataDisplay { dragImage: HTMLElement, metadata: IMetadata, clientX: number, - clientY: number, + clientY: number ): Promise { const widget: NotebookPanel = this.props.getCurrentWidget() as NotebookPanel; @@ -410,19 +410,19 @@ class CodeSnippetDisplay extends MetadataDisplay { //const activeCellIndex = notebookContent.activeCellIndex ?? -1; const contentFactory = new NotebookPanel.ContentFactory({ - editorFactory: this.props.editorServices.factoryService.newInlineEditor, + editorFactory: this.props.editorServices.factoryService.newInlineEditor }); const options: CodeCell.IOptions = { model: notebookContent.activeCell?.model as ICodeCellModel, rendermime: notebookContent.rendermime, - contentFactory: contentFactory, + contentFactory: contentFactory }; const options2: MarkdownCell.IOptions = { model: notebookContent.activeCell?.model as IMarkdownCellModel, rendermime: notebookContent.rendermime, - contentFactory: contentFactory, + contentFactory: contentFactory }; const codeCell = contentFactory.createCodeCell(options); @@ -455,7 +455,7 @@ class CodeSnippetDisplay extends MetadataDisplay { dragImage: dragImage, supportedActions: 'copy-move', proposedAction: 'copy', - source: this, + source: this }); const selected: nbformat.ICell[] = [model.model.toJSON()]; @@ -476,14 +476,14 @@ class CodeSnippetDisplay extends MetadataDisplay { feedback: 'Copied!', onClick: (): void => { Clipboard.copyToSystem(metadata.metadata.code.join('\n')); - }, + } }, { title: 'Insert', icon: importIcon, onClick: (): void => { this.insertCodeSnippet(metadata); - }, + } }, { title: 'Edit', @@ -493,9 +493,9 @@ class CodeSnippetDisplay extends MetadataDisplay { onSave: this.props.updateMetadata, schemaspace: CODE_SNIPPET_SCHEMASPACE, schema: CODE_SNIPPET_SCHEMA, - name: metadata.name, + name: metadata.name }); - }, + } }, { title: 'Duplicate', @@ -504,13 +504,13 @@ class CodeSnippetDisplay extends MetadataDisplay { MetadataCommonService.duplicateMetadataInstance( CODE_SNIPPET_SCHEMASPACE, metadata, - this.props.metadata, + this.props.metadata ) .then((response: any): void => { this.props.updateMetadata(); }) .catch((error) => RequestErrors.serverError(error)); - }, + } }, { title: 'Delete', @@ -528,7 +528,7 @@ class CodeSnippetDisplay extends MetadataDisplay { value.id === `${METADATA_EDITOR_ID}:${CODE_SNIPPET_SCHEMASPACE}:${CODE_SNIPPET_SCHEMA}:${metadata.name}` ); - }, + } ); if (editorWidget) { editorWidget.dispose(); @@ -536,8 +536,8 @@ class CodeSnippetDisplay extends MetadataDisplay { } }) .catch((error) => RequestErrors.serverError(error)); - }, - }, + } + } ]; }; @@ -547,7 +547,7 @@ class CodeSnippetDisplay extends MetadataDisplay { sortMetadata(): void { this.props.metadata.sort((a, b) => - this.getDisplayName(a).localeCompare(this.getDisplayName(b)), + this.getDisplayName(a).localeCompare(this.getDisplayName(b)) ); } @@ -599,7 +599,7 @@ class CodeSnippetDisplay extends MetadataDisplay { if (codeSnippet.name in this.editors) { // Make sure code is up to date this.editors[codeSnippet.name].model.selections.has( - codeSnippet.metadata.code.join('\n'), + codeSnippet.metadata.code.join('\n') ); } else { // Add new snippets @@ -615,9 +615,9 @@ class CodeSnippetDisplay extends MetadataDisplay { mimeType: getMimeTypeByLanguage({ value: codeSnippet.metadata.code.join('\n'), name: codeSnippet.metadata.language, - codemirror_mode: codeSnippet.metadata.language, - }), - }), + codemirror_mode: codeSnippet.metadata.language + }) + }) }); } }); @@ -663,7 +663,7 @@ export class CodeSnippetWidget extends MetadataWidget { // Request code snippets from server async fetchMetadata(): Promise { return CodeSnippetService.findAll().catch((error) => - RequestErrors.serverError(error), + RequestErrors.serverError(error) ); } diff --git a/packages/code-snippet/src/index.ts b/packages/code-snippet/src/index.ts index 70abdfef3..e37042ce0 100644 --- a/packages/code-snippet/src/index.ts +++ b/packages/code-snippet/src/index.ts @@ -21,7 +21,7 @@ import { codeSnippetIcon } from '@elyra/ui-components'; import { JupyterFrontEnd, JupyterFrontEndPlugin, - ILayoutRestorer, + ILayoutRestorer } from '@jupyterlab/application'; import { ICommandPalette } from '@jupyterlab/apputils'; import { Cell } from '@jupyterlab/cells'; @@ -34,14 +34,14 @@ import { Widget } from '@lumino/widgets'; import { CODE_SNIPPET_SCHEMASPACE, - CODE_SNIPPET_SCHEMA, + CODE_SNIPPET_SCHEMA } from './CodeSnippetService'; import { CodeSnippetWidget } from './CodeSnippetWidget'; const CODE_SNIPPET_EXTENSION_ID = 'elyra-code-snippet-extension'; const commandIDs = { - saveAsSnippet: 'codesnippet:save-as-snippet', + saveAsSnippet: 'codesnippet:save-as-snippet' }; /** @@ -55,7 +55,7 @@ export const code_snippet_extension: JupyterFrontEndPlugin = { app: JupyterFrontEnd, palette: ICommandPalette, restorer: ILayoutRestorer, - editorServices: IEditorServices, + editorServices: IEditorServices ) => { console.log('Elyra - code-snippet extension is activated!'); @@ -71,7 +71,7 @@ export const code_snippet_extension: JupyterFrontEndPlugin = { icon: codeSnippetIcon, getCurrentWidget, editorServices, - titleContext: 'code snippet', + titleContext: 'code snippet' }); const codeSnippetWidgetId = `elyra-metadata:${CODE_SNIPPET_SCHEMASPACE}`; codeSnippetWidget.id = codeSnippetWidgetId; @@ -126,7 +126,7 @@ export const code_snippet_extension: JupyterFrontEndPlugin = { schemaspace: CODE_SNIPPET_SCHEMASPACE, schema: CODE_SNIPPET_SCHEMA, code: selection.split('\n'), - onSave: codeSnippetWidget.updateMetadata, + onSave: codeSnippetWidget.updateMetadata }); } else { const selectedCells = getSelectedCellContents(); @@ -136,30 +136,30 @@ export const code_snippet_extension: JupyterFrontEndPlugin = { schemaspace: CODE_SNIPPET_SCHEMASPACE, schema: CODE_SNIPPET_SCHEMA, code: code, - onSave: codeSnippetWidget.updateMetadata, + onSave: codeSnippetWidget.updateMetadata }); } - }, + } }); app.contextMenu.addItem({ command: commandIDs.saveAsSnippet, - selector: '.jp-Cell', + selector: '.jp-Cell' }); app.contextMenu.addItem({ command: commandIDs.saveAsSnippet, - selector: '.jp-FileEditor', + selector: '.jp-FileEditor' }); app.contextMenu.addItem({ command: commandIDs.saveAsSnippet, - selector: '.jp-MarkdownViewer', + selector: '.jp-MarkdownViewer' }); const getTextSelection = ( editor: any, - markdownPreview?: boolean, + markdownPreview?: boolean ): string => { const selectionObj = editor.getSelection(); const start = editor.getOffsetAt(selectionObj.start); @@ -221,7 +221,7 @@ export const code_snippet_extension: JupyterFrontEndPlugin = { return notebookCell?.editor; } }; - }, + } }; export default code_snippet_extension; diff --git a/packages/metadata-common/src/FilterTools.tsx b/packages/metadata-common/src/FilterTools.tsx index 65e95425c..4177543f5 100644 --- a/packages/metadata-common/src/FilterTools.tsx +++ b/packages/metadata-common/src/FilterTools.tsx @@ -61,7 +61,7 @@ export class FilterTools extends React.Component< componentDidMount(): void { this.setState({ selectedTags: [], - searchValue: '', + searchValue: '' }); } @@ -70,14 +70,14 @@ export class FilterTools extends React.Component< this.setState((state) => ({ selectedTags: state.selectedTags .filter((tag) => this.props.tags.includes(tag)) - .sort(), + .sort() })); } } createFilterBox(): void { const filterOption = document.querySelector( - `#${this.props.schemaspace} .${FILTER_OPTION}`, + `#${this.props.schemaspace} .${FILTER_OPTION}` ); filterOption?.classList.toggle('idle'); @@ -149,20 +149,16 @@ export class FilterTools extends React.Component< this.setState( (state) => ({ - selectedTags: this.updateTagsCss( - target, - state.selectedTags, - clickedTag, - ), + selectedTags: this.updateTagsCss(target, state.selectedTags, clickedTag) }), - this.filterMetadata, + this.filterMetadata ); } updateTagsCss( target: HTMLElement, currentTags: string[], - clickedTag: string, + clickedTag: string ): string[] { if (target.classList.contains('unapplied-tag')) { target.classList.replace('unapplied-tag', 'applied-tag'); @@ -187,7 +183,7 @@ export class FilterTools extends React.Component< ?.classList.contains('idle'); this.props.onFilter( this.state.searchValue, - isTagFilterOpen ? [] : this.state.selectedTags, + isTagFilterOpen ? [] : this.state.selectedTags ); } diff --git a/packages/metadata-common/src/MetadataCommonService.tsx b/packages/metadata-common/src/MetadataCommonService.tsx index 2b392d57d..0b742e69f 100644 --- a/packages/metadata-common/src/MetadataCommonService.tsx +++ b/packages/metadata-common/src/MetadataCommonService.tsx @@ -32,7 +32,7 @@ export class MetadataCommonService { static duplicateMetadataInstance( schemaSpace: string, metadataInstance: IMetadata, - existingInstances: IMetadata[], + existingInstances: IMetadata[] ): Promise { // iterate through the list of currently defined // instance names and find the next available one @@ -46,7 +46,7 @@ export class MetadataCommonService { while ( existingInstances.find( - (element) => element.display_name === `${base_name}-Copy${count}`, + (element) => element.display_name === `${base_name}-Copy${count}` ) !== undefined ) { count += 1; @@ -58,7 +58,7 @@ export class MetadataCommonService { delete duplicated_metadata.name; return MetadataService.postMetadata( schemaSpace, - JSON.stringify(duplicated_metadata), + JSON.stringify(duplicated_metadata) ); } } diff --git a/packages/metadata-common/src/MetadataEditor.tsx b/packages/metadata-common/src/MetadataEditor.tsx index 75472d30a..b5ec08e18 100644 --- a/packages/metadata-common/src/MetadataEditor.tsx +++ b/packages/metadata-common/src/MetadataEditor.tsx @@ -75,7 +75,7 @@ export const MetadataEditor: React.FC = ({ allTags, componentRegistry, getDefaultChoices, - titleContext, + titleContext }: IMetadataEditorComponentProps) => { const [invalidForm, setInvalidForm] = React.useState(name === undefined); @@ -96,7 +96,7 @@ export const MetadataEditor: React.FC = ({ const newMetadata: any = { schema_name: schemaName, display_name: metadata?.['_noCategory']?.['display_name'], - metadata: flattenFormData(metadata), + metadata: flattenFormData(metadata) }; if (!name) { @@ -111,7 +111,7 @@ export const MetadataEditor: React.FC = ({ MetadataService.putMetadata( schemaspace, name, - JSON.stringify(newMetadata), + JSON.stringify(newMetadata) ) .then((response: any): void => { setDirty(false); @@ -146,7 +146,7 @@ export const MetadataEditor: React.FC = ({ * Triggers save and close on pressing enter key (outside of a text area) */ const onKeyPress: React.KeyboardEventHandler = ( - event: React.KeyboardEvent, + event: React.KeyboardEvent ) => { const targetElement = event.nativeEvent.target as HTMLElement; if (event.key === 'Enter' && targetElement?.tagName !== 'TEXTAREA') { diff --git a/packages/metadata-common/src/MetadataEditorWidget.tsx b/packages/metadata-common/src/MetadataEditorWidget.tsx index efc7bf453..4fb376e4a 100644 --- a/packages/metadata-common/src/MetadataEditorWidget.tsx +++ b/packages/metadata-common/src/MetadataEditorWidget.tsx @@ -121,7 +121,7 @@ export class MetadataEditorWidget extends ReactWidget { // Load all schema and all metadata in schemaspace. const allSchema = await MetadataService.getSchema(this.props.schemaspace); const allMetadata = (this.allMetadata = await MetadataService.getMetadata( - this.props.schemaspace, + this.props.schemaspace )); // Loads all tags to display as options in the editor. @@ -130,7 +130,7 @@ export class MetadataEditorWidget extends ReactWidget { acc.push( ...metadata.metadata.tags.filter((tag: string) => { return !acc.includes(tag); - }), + }) ); } return acc; @@ -152,7 +152,7 @@ export class MetadataEditorWidget extends ReactWidget { if (properties[prop].const !== undefined) { properties[prop].default = properties[prop].const; properties[prop].uihints = { - 'ui:readonly': true, + 'ui:readonly': true }; } } @@ -169,13 +169,13 @@ export class MetadataEditorWidget extends ReactWidget { display_name: { title: this.props.translator.__('Display Name'), description: this.props.translator.__( - 'Name used to identify an instance of metadata.', + 'Name used to identify an instance of metadata.' ), - type: 'string', - }, + type: 'string' + } }, - required: ['display_name'], - }, + required: ['display_name'] + } }; // Adds required fields to the wrapper required fields. @@ -198,7 +198,7 @@ export class MetadataEditorWidget extends ReactWidget { schemaPropertiesByCategory[category] = { type: 'object', properties: {}, - required: [], + required: [] }; } if (schema.properties.metadata.required?.includes(schemaProperty)) { @@ -236,7 +236,7 @@ export class MetadataEditorWidget extends ReactWidget { if (!isFocused) { const input = document.querySelector( - `.${this.widgetClass} .display_nameField input`, + `.${this.widgetClass} .display_nameField input` ) as HTMLInputElement; if (input) { input.focus(); @@ -278,7 +278,7 @@ export class MetadataEditorWidget extends ReactWidget { showDialog({ title: this.props.translator.__('Close without saving?'), body:

Metadata has unsaved changes, close without saving?

, - buttons: [Dialog.cancelButton(), Dialog.okButton()], + buttons: [Dialog.cancelButton(), Dialog.okButton()] }).then((response: any): void => { if (response.button.accept) { this.dispose(); diff --git a/packages/metadata-common/src/MetadataWidget.tsx b/packages/metadata-common/src/MetadataWidget.tsx index 1ffe9980d..c531fc77d 100644 --- a/packages/metadata-common/src/MetadataWidget.tsx +++ b/packages/metadata-common/src/MetadataWidget.tsx @@ -19,7 +19,7 @@ import { ExpandableComponent, JSONComponent, RequestErrors, - trashIcon, + trashIcon } from '@elyra/ui-components'; import { JupyterFrontEnd } from '@jupyterlab/application'; @@ -27,14 +27,14 @@ import { Dialog, ReactWidget, showDialog, - UseSignal, + UseSignal } from '@jupyterlab/apputils'; import { addIcon, copyIcon, editIcon, LabIcon, - refreshIcon, + refreshIcon } from '@jupyterlab/ui-components'; import { Message } from '@lumino/messaging'; import { Signal } from '@lumino/signaling'; @@ -54,7 +54,7 @@ const METADATA_HEADER_BUTTON_CLASS = 'elyra-metadataHeader-button'; const METADATA_JSON_CLASS = 'jp-RenderedJSON CodeMirror cm-s-jupyter'; const commands = { - OPEN_METADATA_EDITOR: 'elyra-metadata-editor:open', + OPEN_METADATA_EDITOR: 'elyra-metadata-editor:open' }; export interface IMetadata { @@ -101,7 +101,7 @@ export interface IMetadataDisplayState { * A React Component for displaying a list of metadata */ export class MetadataDisplay< - T extends IMetadataDisplayProps, + T extends IMetadataDisplayProps // U extends IMetadataDisplayState, > extends React.Component { constructor(props: T) { @@ -111,7 +111,7 @@ export class MetadataDisplay< searchValue: '', filterTags: [], matchesSearch: this.matchesSearch.bind(this), - matchesTags: this.matchesTags.bind(this), + matchesTags: this.matchesTags.bind(this) }; } @@ -120,13 +120,13 @@ export class MetadataDisplay< title: `Delete ${ this.props.labelName ? this.props.labelName(metadata) : '' } ${this.props.titleContext || ''} '${metadata.display_name}'?`, - buttons: [Dialog.cancelButton(), Dialog.okButton()], + buttons: [Dialog.cancelButton(), Dialog.okButton()] }).then((result: any) => { // Do nothing if the cancel button is pressed if (result.button.accept) { MetadataService.deleteMetadata( this.props.schemaspace, - metadata.name, + metadata.name ).catch((error) => RequestErrors.serverError(error)); } }); @@ -142,9 +142,9 @@ export class MetadataDisplay< onSave: this.props.updateMetadata, schemaspace: this.props.schemaspace, schema: metadata.schema_name, - name: metadata.name, + name: metadata.name }); - }, + } }, { title: 'Duplicate', @@ -153,13 +153,13 @@ export class MetadataDisplay< MetadataCommonService.duplicateMetadataInstance( this.props.schemaspace, metadata, - this.props.metadata, + this.props.metadata ) .then((response: any): void => { this.props.updateMetadata(); }) .catch((error) => RequestErrors.serverError(error)); - }, + } }, { title: 'Delete', @@ -168,8 +168,8 @@ export class MetadataDisplay< this.deleteMetadata(metadata).then((response: any): void => { this.props.updateMetadata(); }); - }, - }, + } + } ]; } @@ -214,7 +214,7 @@ export class MetadataDisplay< */ sortMetadata(): void { this.props.metadata.sort((a, b) => - a.display_name.localeCompare(b.display_name), + a.display_name.localeCompare(b.display_name) ); } @@ -228,7 +228,7 @@ export class MetadataDisplay< .toLowerCase() .includes(searchValue.toLowerCase()) ); - }, + } ); // filter with tags @@ -246,7 +246,7 @@ export class MetadataDisplay< this.setState({ metadata: filteredMetadata, searchValue: searchValue, - filterTags: filterTags, + filterTags: filterTags }); }; @@ -286,7 +286,7 @@ export class MetadataDisplay< static getDerivedStateFromProps( props: IMetadataDisplayProps, - state: IMetadataDisplayState, + state: IMetadataDisplayState ): IMetadataDisplayState { if (state.searchValue === '' && state.filterTags.length === 0) { return { @@ -294,7 +294,7 @@ export class MetadataDisplay< searchValue: '', filterTags: [], matchesSearch: state.matchesSearch, - matchesTags: state.matchesTags, + matchesTags: state.matchesTags }; } @@ -305,14 +305,14 @@ export class MetadataDisplay< const newMetadata = props.metadata.filter( (metadata) => state.matchesSearch(searchValue, metadata) && - state.matchesTags(filterTags, metadata), + state.matchesTags(filterTags, metadata) ); return { metadata: newMetadata, searchValue: state.searchValue, filterTags: state.filterTags, matchesSearch: state.matchesSearch, - matchesTags: state.matchesTags, + matchesTags: state.matchesTags }; } return state; @@ -392,8 +392,8 @@ export class MetadataWidget extends ReactWidget { schema: schema.name, title: schema.title, titleContext: this.props.titleContext, - appendToTitle: this.props.appendToTitle, - } as any, + appendToTitle: this.props.appendToTitle + } as any }); } } @@ -408,7 +408,7 @@ export class MetadataWidget extends ReactWidget { onSave: this.updateMetadata, schemaspace: this.props.schemaspace, schema: schema, - titleContext, + titleContext }); } @@ -525,7 +525,7 @@ export class MetadataWidget extends ReactWidget { ? (): void => this.addMetadata( this.schemas?.[0].name, - this.titleContext, + this.titleContext ) : (event: any): void => { this.props.app.contextMenu.open(event); diff --git a/packages/metadata/src/index.ts b/packages/metadata/src/index.ts index dba5d1576..195ae18d8 100644 --- a/packages/metadata/src/index.ts +++ b/packages/metadata/src/index.ts @@ -22,12 +22,12 @@ import { RequestErrors, CodeBlock, TagsField, - PasswordField, + PasswordField } from '@elyra/ui-components'; import { JupyterFrontEnd, JupyterFrontEndPlugin, - ILabStatus, + ILabStatus } from '@jupyterlab/application'; import { ICommandPalette, MainAreaWidget } from '@jupyterlab/apputils'; import { IEditorServices } from '@jupyterlab/codeeditor'; @@ -36,7 +36,7 @@ import { textEditorIcon, LabIcon, IFormRendererRegistry, - IFormRenderer, + IFormRenderer } from '@jupyterlab/ui-components'; import { find } from '@lumino/algorithm'; @@ -47,7 +47,7 @@ const METADATA_WIDGET_ID = 'elyra-metadata'; const commandIDs = { openMetadata: 'elyra-metadata:open', - closeTabCommand: 'elyra-metadata:close', + closeTabCommand: 'elyra-metadata:close' }; /** @@ -61,7 +61,7 @@ const extension: JupyterFrontEndPlugin = { IEditorServices, ILabStatus, IFormRendererRegistry, - ITranslator, + ITranslator ], activate: async ( app: JupyterFrontEnd, @@ -69,25 +69,25 @@ const extension: JupyterFrontEndPlugin = { editorServices: IEditorServices, status: ILabStatus, componentRegistry: IFormRendererRegistry, - translator: ITranslator, + translator: ITranslator ) => { console.log('Elyra - metadata extension is activated!'); componentRegistry.addRenderer( 'code', - CodeBlock as unknown as IFormRenderer, + CodeBlock as unknown as IFormRenderer ); componentRegistry.addRenderer( 'tags', - TagsField as unknown as IFormRenderer, + TagsField as unknown as IFormRenderer ); componentRegistry.addRenderer( 'dropdown', - DropDown as unknown as IFormRenderer, + DropDown as unknown as IFormRenderer ); componentRegistry.addRenderer( 'password', - PasswordField as unknown as IFormRenderer, + PasswordField as unknown as IFormRenderer ); const openMetadataEditor = (args: { @@ -110,7 +110,7 @@ const extension: JupyterFrontEndPlugin = { app.shell.widgets('main'), (widget: Widget, index: number) => { return widget.id === widgetId; - }, + } ); if (openWidget) { app.shell.activateById(widgetId); @@ -123,7 +123,7 @@ const extension: JupyterFrontEndPlugin = { editorServices, status, translator: translator.load('jupyterlab'), - componentRegistry, + componentRegistry }); const main = new MainAreaWidget({ content: metadataEditorWidget }); main.title.label = widgetLabel; @@ -142,7 +142,7 @@ const extension: JupyterFrontEndPlugin = { }, execute: (args: any) => { openMetadataEditor(args); - }, + } }); const openMetadataWidget = (args: { @@ -156,7 +156,7 @@ const extension: JupyterFrontEndPlugin = { app, display_name: args.display_name, schemaspace: args.schemaspace, - icon: labIcon, + icon: labIcon }); metadataWidget.id = widgetId; metadataWidget.title.icon = labIcon; @@ -178,7 +178,7 @@ const extension: JupyterFrontEndPlugin = { // Rank has been chosen somewhat arbitrarily to give priority // to the running sessions widget in the sidebar. openMetadataWidget(args); - }, + } }); // Add command to close metadata tab @@ -187,7 +187,7 @@ const extension: JupyterFrontEndPlugin = { label: 'Close Tab', execute: (args) => { const contextNode: HTMLElement | undefined = app.contextMenuHitTest( - (node) => !!node.dataset.id, + (node) => !!node.dataset.id ); if (contextNode) { const id = contextNode.dataset['id']!; @@ -195,18 +195,18 @@ const extension: JupyterFrontEndPlugin = { app.shell.widgets('left'), (widget: Widget, index: number) => { return widget.id === id; - }, + } ); if (widget) { widget.dispose(); } } - }, + } }); app.contextMenu.addItem({ selector: '[data-id^="elyra-metadata:"]:not([data-id$="code-snippets"]):not([data-id$="runtimes"])', - command: closeTabCommand, + command: closeTabCommand }); try { @@ -228,15 +228,15 @@ const extension: JupyterFrontEndPlugin = { label: `Manage ${title}`, display_name: schema.uihints.title, schemaspace: schema.schemaspace, - icon: icon, + icon: icon }, - category: 'Elyra', + category: 'Elyra' }); } } catch (error) { RequestErrors.serverError(error); } - }, + } }; export default extension; diff --git a/packages/pipeline-editor/src/ComponentCatalogsWidget.tsx b/packages/pipeline-editor/src/ComponentCatalogsWidget.tsx index c934203d4..47e503c7e 100644 --- a/packages/pipeline-editor/src/ComponentCatalogsWidget.tsx +++ b/packages/pipeline-editor/src/ComponentCatalogsWidget.tsx @@ -21,7 +21,7 @@ import { MetadataDisplay, IMetadataDisplayProps, //IMetadataDisplayState, - IMetadataActionButton, + IMetadataActionButton } from '@elyra/metadata-common'; import { IDictionary, MetadataService } from '@elyra/services'; import { RequestErrors } from '@elyra/ui-components'; @@ -60,12 +60,12 @@ class ComponentCatalogsDisplay extends MetadataDisplay { .catch((error) => console.error( 'An error occurred while refreshing components from catalog:', - error, - ), + error + ) ); - }, + } }, - ...super.actionButtons(metadata), + ...super.actionButtons(metadata) ]; } @@ -141,14 +141,14 @@ export class ComponentCatalogsWidget extends MetadataWidget { const schemas = await MetadataService.getSchema(this.props.schemaspace); this.runtimeTypes = await PipelineService.getRuntimeTypes(); const sortedSchema = schemas.sort((a: any, b: any) => - a.title.localeCompare(b.title), + a.title.localeCompare(b.title) ); this.schemas = sortedSchema.filter((schema: any) => { return !!this.runtimeTypes.find( (r) => schema.properties?.metadata?.properties?.runtime_type?.enum?.includes( - r.id, - ) && r.runtime_enabled, + r.id + ) && r.runtime_enabled ); }); if (this.schemas?.length ?? 0 > 1) { @@ -162,8 +162,8 @@ export class ComponentCatalogsWidget extends MetadataWidget { schema: schema.name, title: schema.title, titleContext: this.props.titleContext, - appendToTitle: this.props.appendToTitle, - } as any, + appendToTitle: this.props.appendToTitle + } as any }); } } diff --git a/packages/pipeline-editor/src/EmptyPipelineContent.tsx b/packages/pipeline-editor/src/EmptyPipelineContent.tsx index 3af93d71d..a8c24cd19 100644 --- a/packages/pipeline-editor/src/EmptyPipelineContent.tsx +++ b/packages/pipeline-editor/src/EmptyPipelineContent.tsx @@ -28,7 +28,7 @@ export interface IEmptyGenericPipelineProps { } export const EmptyGenericPipeline: React.FC = ({ - onOpenSettings, + onOpenSettings }) => { return (
diff --git a/packages/pipeline-editor/src/FileSubmissionDialog.tsx b/packages/pipeline-editor/src/FileSubmissionDialog.tsx index a40f23229..69482d794 100644 --- a/packages/pipeline-editor/src/FileSubmissionDialog.tsx +++ b/packages/pipeline-editor/src/FileSubmissionDialog.tsx @@ -63,7 +63,7 @@ export const FileSubmissionDialog: React.FC = ({ env, images, dependencyFileExtension, - runtimeData, + runtimeData }) => { const [includeDependency, setIncludeDependency] = React.useState(true); diff --git a/packages/pipeline-editor/src/ParameterInputForm.tsx b/packages/pipeline-editor/src/ParameterInputForm.tsx index 45306a1f4..0f800f871 100644 --- a/packages/pipeline-editor/src/ParameterInputForm.tsx +++ b/packages/pipeline-editor/src/ParameterInputForm.tsx @@ -31,14 +31,14 @@ export interface IParameterProps { } export const ParameterInputForm: React.FC = ({ - parameters, + parameters }) => { return parameters && parameters.length > 0 ? (