Skip to content

Commit 6bd9a57

Browse files
committed
Fixed lint issues
1 parent bd3f214 commit 6bd9a57

1 file changed

Lines changed: 16 additions & 24 deletions

File tree

src/viewProviders/RokuAutomationViewViewProvider.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
5151
this.registerCommand(VscodeCommand.rokuAutomationViewImportAllAutomations, async () => {
5252
if (this.isRecording) {
5353
// Only allow importing when we aren't currently recording
54-
vscode.window.showInformationMessage('Cannot import automation scripts while recording. Please stop recording first.');
54+
void vscode.window.showInformationMessage('Cannot import automation scripts while recording. Please stop recording first.');
5555
return;
5656
}
5757

@@ -75,7 +75,7 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
7575
},
7676
defaultUri: vscode.Uri.file('automation.json'),
7777
canSelectMany: false
78-
})
78+
});
7979

8080
if (!filePath) {
8181
return;
@@ -96,18 +96,18 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
9696

9797
this.updateCurrentRunningStep();
9898
this.onImportAllAutomations();
99-
vscode.window.showInformationMessage('Automation scripts imported successfully from ' + filePath[0].fsPath);
99+
void vscode.window.showInformationMessage('Automation scripts imported successfully from ' + filePath[0].fsPath);
100100
} catch (err) {
101-
vscode.window.showErrorMessage('Failed to import automations: ' + (err as Error).message);
101+
void vscode.window.showErrorMessage('Failed to import automations: ' + (err as Error).message);
102102
}
103103
});
104104

105105
this.registerCommand(VscodeCommand.rokuAutomationViewExportAllAutomations, async () => {
106-
vscode.window.showInformationMessage('Exporting automation data...');
106+
void vscode.window.showInformationMessage('Exporting automation data...');
107107

108108
if (this.isRecording) {
109109
// Only allow exporting when we aren't currently recording
110-
vscode.window.showInformationMessage('Cannot export automation scripts while recording. Please stop recording first.');
110+
void vscode.window.showInformationMessage('Cannot export automation scripts while recording. Please stop recording first.');
111111
return;
112112
}
113113

@@ -127,33 +127,25 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {
127127
'JSON': ['json'],
128128
'All Files': ['*']
129129
},
130-
defaultUri: defaultUri,
130+
defaultUri: defaultUri
131131
});
132132

133133
if (!filePath) {
134134
return;
135135
}
136136

137137
try {
138-
// format the json to put each step on a single line for easier editing
139-
// Changing the code formatting modifies the json output. Not sure how to fix that.
140-
const json = `{
141-
"selectedConfig": ${JSON.stringify(this.selectedConfig)},
142-
"configs": [
143-
${this.rokuAutomationConfigs.map(config =>
144-
`{
145-
"name": ${JSON.stringify(config.name)},
146-
"steps": [${config.steps?.length ? '\n' + config.steps.map(step =>
147-
` {"type": ${JSON.stringify(step.type)},"value": ${JSON.stringify(step.value)}}`
148-
).join(',\n') + '\n ' : ''}]
149-
}`
150-
).join(',\n ')}
151-
]
152-
}`;
138+
const obj =
139+
{
140+
selectedConfig: this.selectedConfig,
141+
configs: this.rokuAutomationConfigs
142+
};
143+
const json = JSON.stringify(obj, null, 4);
144+
153145
fsExtra.outputFileSync(filePath.fsPath, json);
154-
vscode.window.showInformationMessage('Automation exported successfully to ' + filePath.fsPath);
146+
void vscode.window.showInformationMessage('Automation exported successfully to ' + filePath.fsPath);
155147
} catch (err) {
156-
vscode.window.showErrorMessage('Failed to export automation scripts: ' + (err as Error).message);
148+
void vscode.window.showErrorMessage('Failed to export automation scripts: ' + (err as Error).message);
157149
}
158150
});
159151

0 commit comments

Comments
 (0)