Use eslint&prettier for code linting&formatting

This commit is contained in:
Francesco Stasi
2021-06-16 15:08:48 +02:00
committed by Francesco Stasi
parent 2a3873a923
commit 0592199858
173 changed files with 8963 additions and 3841 deletions

View File

@@ -1,18 +1,23 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import { ArduinoMenus } from '../menu/arduino-menus';
import { SketchContribution, Command, CommandRegistry, MenuModelRegistry, URI } from './contribution';
import {
SketchContribution,
Command,
CommandRegistry,
MenuModelRegistry,
URI,
} from './contribution';
import { FileDialogService } from '@theia/filesystem/lib/browser';
@injectable()
export class AddFile extends SketchContribution {
@inject(FileDialogService)
protected readonly fileDialogService: FileDialogService;
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(AddFile.Commands.ADD_FILE, {
execute: () => this.addFile()
execute: () => this.addFile(),
});
}
@@ -20,7 +25,7 @@ export class AddFile extends SketchContribution {
registry.registerMenuAction(ArduinoMenus.SKETCH__UTILS_GROUP, {
commandId: AddFile.Commands.ADD_FILE.id,
label: 'Add File...',
order: '2'
order: '2',
});
}
@@ -33,7 +38,7 @@ export class AddFile extends SketchContribution {
title: 'Add File',
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false
canSelectMany: false,
});
if (!toAddUri) {
return;
@@ -47,22 +52,24 @@ export class AddFile extends SketchContribution {
type: 'question',
title: 'Replace',
buttons: ['Cancel', 'OK'],
message: `Replace the existing version of ${filename}?`
message: `Replace the existing version of ${filename}?`,
});
if (response === 0) { // Cancel
if (response === 0) {
// Cancel
return;
}
}
await this.fileService.copy(toAddUri, targetUri, { overwrite: true });
this.messageService.info('One file added to the sketch.', { timeout: 2000 });
this.messageService.info('One file added to the sketch.', {
timeout: 2000,
});
}
}
export namespace AddFile {
export namespace Commands {
export const ADD_FILE: Command = {
id: 'arduino-add-file'
id: 'arduino-add-file',
};
}
}