Skip to content

Commit a80f7fc

Browse files
build: enable JS semicolons (electron#22787)
1 parent 83e7b00 commit a80f7fc

File tree

292 files changed

+12536
-12534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+12536
-12534
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"browser": true
77
},
88
"rules": {
9+
"semi": ["error", "always"],
910
"no-var": "error",
1011
"no-unused-vars": 0,
1112
"no-global-assign": 0,

default_app/default_app.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron'
2-
import * as path from 'path'
1+
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
2+
import * as path from 'path';
33

4-
let mainWindow: BrowserWindow | null = null
4+
let mainWindow: BrowserWindow | null = null;
55

66
// Quit when all windows are closed.
77
app.on('window-all-closed', () => {
8-
app.quit()
9-
})
8+
app.quit();
9+
});
1010

1111
function decorateURL (url: string) {
1212
// safely add `?utm_source=default_app
13-
const parsedUrl = new URL(url)
14-
parsedUrl.searchParams.append('utm_source', 'default_app')
15-
return parsedUrl.toString()
13+
const parsedUrl = new URL(url);
14+
parsedUrl.searchParams.append('utm_source', 'default_app');
15+
return parsedUrl.toString();
1616
}
1717

1818
// Find the shortest path to the electron binary
19-
const absoluteElectronPath = process.execPath
20-
const relativeElectronPath = path.relative(process.cwd(), absoluteElectronPath)
19+
const absoluteElectronPath = process.execPath;
20+
const relativeElectronPath = path.relative(process.cwd(), absoluteElectronPath);
2121
const electronPath = absoluteElectronPath.length < relativeElectronPath.length
2222
? absoluteElectronPath
23-
: relativeElectronPath
23+
: relativeElectronPath;
2424

25-
const indexPath = path.resolve(app.getAppPath(), 'index.html')
25+
const indexPath = path.resolve(app.getAppPath(), 'index.html');
2626

2727
function isTrustedSender (webContents: Electron.WebContents) {
2828
if (webContents !== (mainWindow && mainWindow.webContents)) {
29-
return false
29+
return false;
3030
}
3131

32-
const parsedUrl = new URL(webContents.getURL())
32+
const parsedUrl = new URL(webContents.getURL());
3333
const urlPath = process.platform === 'win32'
3434
// Strip the prefixed "/" that occurs on windows
3535
? path.resolve(parsedUrl.pathname.substr(1))
36-
: parsedUrl.pathname
37-
return parsedUrl.protocol === 'file:' && urlPath === indexPath
36+
: parsedUrl.pathname;
37+
return parsedUrl.protocol === 'file:' && urlPath === indexPath;
3838
}
3939

4040
ipcMain.handle('bootstrap', (event) => {
41-
return isTrustedSender(event.sender) ? electronPath : null
42-
})
41+
return isTrustedSender(event.sender) ? electronPath : null;
42+
});
4343

4444
async function createWindow () {
45-
await app.whenReady()
45+
await app.whenReady();
4646

4747
const options: Electron.BrowserWindowConstructorOptions = {
4848
width: 900,
@@ -57,46 +57,46 @@ async function createWindow () {
5757
},
5858
useContentSize: true,
5959
show: false
60-
}
60+
};
6161

6262
if (process.platform === 'linux') {
63-
options.icon = path.join(__dirname, 'icon.png')
63+
options.icon = path.join(__dirname, 'icon.png');
6464
}
6565

66-
mainWindow = new BrowserWindow(options)
67-
mainWindow.on('ready-to-show', () => mainWindow!.show())
66+
mainWindow = new BrowserWindow(options);
67+
mainWindow.on('ready-to-show', () => mainWindow!.show());
6868

6969
mainWindow.webContents.on('new-window', (event, url) => {
70-
event.preventDefault()
71-
shell.openExternal(decorateURL(url))
72-
})
70+
event.preventDefault();
71+
shell.openExternal(decorateURL(url));
72+
});
7373

7474
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {
75-
const parsedUrl = new URL(webContents.getURL())
75+
const parsedUrl = new URL(webContents.getURL());
7676

7777
const options: Electron.MessageBoxOptions = {
7878
title: 'Permission Request',
7979
message: `Allow '${parsedUrl.origin}' to access '${permission}'?`,
8080
buttons: ['OK', 'Cancel'],
8181
cancelId: 1
82-
}
82+
};
8383

8484
dialog.showMessageBox(mainWindow!, options).then(({ response }) => {
85-
done(response === 0)
86-
})
87-
})
85+
done(response === 0);
86+
});
87+
});
8888

89-
return mainWindow
89+
return mainWindow;
9090
}
9191

9292
export const loadURL = async (appUrl: string) => {
93-
mainWindow = await createWindow()
94-
mainWindow.loadURL(appUrl)
95-
mainWindow.focus()
96-
}
93+
mainWindow = await createWindow();
94+
mainWindow.loadURL(appUrl);
95+
mainWindow.focus();
96+
};
9797

9898
export const loadFile = async (appPath: string) => {
99-
mainWindow = await createWindow()
100-
mainWindow.loadFile(appPath)
101-
mainWindow.focus()
102-
}
99+
mainWindow = await createWindow();
100+
mainWindow.loadFile(appPath);
101+
mainWindow.focus();
102+
};

0 commit comments

Comments
 (0)