Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Adi-204 committed Jan 21, 2025
1 parent 6062adb commit aadce2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/commands/start/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export default class StartStudio extends Command {
filePath = ((await load()).getFilePath());
this.log(`Loaded specification from: ${filePath}`);
} catch (error) {
filePath = "";
filePath = '';
this.log('No file specified.');
}
}
try {
this.specFile = await load(filePath);
} catch (error) {
if(filePath){
if (filePath) {
this.error(error as Error);
}
}
Expand Down
34 changes: 16 additions & 18 deletions src/core/models/Studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ export function start(filePath: string, port: number = DEFAULT_PORT): void {
if (filePath) {
chokidar.watch(filePath).on('all', (event, path) => {
switch (event) {
case 'add':
case 'change':
getFileContent(path).then((code: string) => {
messageQueue.push(JSON.stringify({
type: 'file:changed',
code,
}));
sendQueuedMessages();
});
break;
case 'unlink':
case 'add':
case 'change':
getFileContent(path).then((code: string) => {
messageQueue.push(JSON.stringify({
type: 'file:deleted',
filePath,
type: 'file:changed',
code,
}));
sendQueuedMessages();
break;
});
break;
case 'unlink':
messageQueue.push(JSON.stringify({
type: 'file:deleted',
filePath,
}));
sendQueuedMessages();
break;
}
});
}
Expand Down Expand Up @@ -81,8 +81,7 @@ export function start(filePath: string, port: number = DEFAULT_PORT): void {
}));
sendQueuedMessages();
});
}
else{
} else {
messageQueue.push(JSON.stringify({
type: 'file:loaded',
code: '',
Expand Down Expand Up @@ -115,8 +114,7 @@ export function start(filePath: string, port: number = DEFAULT_PORT): void {
console.log(`You can open this URL in your web browser, and if needed, press ${gray('Ctrl + C')} to stop the process.`);
if (filePath) {
console.log(`Watching changes on file ${filePath}`);
}
else{
} else {
console.log(
'Hint : No file was provided, and we couldn\'t find a default file (like "asyncapi.yaml" or "asyncapi.json") in the current folder. Starting Studio with a blank workspace.'
);
Expand Down

0 comments on commit aadce2d

Please sign in to comment.