Skip to content

Commit 01a1815

Browse files
committed
Hello Prettier
1 parent 8db046c commit 01a1815

Some content is hidden

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

57 files changed

+1419
-936
lines changed

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@
1414
],
1515
"plugins": [
1616
"import",
17+
"prettier"
1718
],
1819
"rules": {
1920
import/no-unresolved: 2,
2021
"react/jsx-indent-props": 0,
22+
"prettier/prettier": ["error", {
23+
"singleQuote": true,
24+
"trailingComma": "es5",
25+
"bracketSpacing": true,
26+
}],
27+
quotes: ["error", "single", { "avoidEscape": true }]
2128
}
2229
}

main.js

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const appMenuTemplate = require('./electron/app-menu-template');
77
const iconIdle = path.join(__dirname, 'images', 'tray-idleTemplate.png');
88
const iconActive = path.join(__dirname, 'images', 'tray-active.png');
99

10-
const isDarwin = (process.platform === 'darwin');
11-
const isLinux = (process.platform === 'linux');
12-
const isWindows = (process.platform === 'win32');
10+
const isDarwin = process.platform === 'darwin';
11+
const isLinux = process.platform === 'linux';
12+
const isWindows = process.platform === 'win32';
1313

1414
let appWindow;
1515
let appIcon = null;
@@ -18,7 +18,7 @@ let isQuitting = false;
1818
const autoStart = new AutoLaunch({
1919
name: 'Gitify',
2020
path: process.execPath.match(/.*?\.app/)[0],
21-
isHidden: true
21+
isHidden: true,
2222
});
2323

2424
app.on('ready', function() {
@@ -28,16 +28,18 @@ app.on('ready', function() {
2828
const trayMenu = Menu.buildFromTemplate([
2929
{
3030
label: 'Show Gitify',
31-
click () { appWindow.show(); }
31+
click() {
32+
appWindow.show();
33+
},
3234
},
3335
{
34-
type: 'separator'
36+
type: 'separator',
3537
},
3638
{
3739
label: 'Quit',
3840
accelerator: isDarwin ? 'Command+Q' : 'Alt+F4',
39-
role: 'quit'
40-
}
41+
role: 'quit',
42+
},
4143
]);
4244

4345
trayIcon.setToolTip('GitHub Notifications on your menu bar.');
@@ -46,28 +48,33 @@ app.on('ready', function() {
4648
}
4749

4850
function confirmAutoUpdate(updater) {
49-
dialog.showMessageBox({
50-
type: 'question',
51-
buttons: ['Update & Restart', 'Cancel'],
52-
title: 'Update Available',
53-
cancelId: 99,
54-
message: 'There is an update available. Would you like to update Gitify now?'
55-
}, (response) => {
56-
console.log('Exit: ' + response); // eslint-disable-line no-console
57-
58-
if (response === 0) {
59-
updater.install();
51+
dialog.showMessageBox(
52+
{
53+
type: 'question',
54+
buttons: ['Update & Restart', 'Cancel'],
55+
title: 'Update Available',
56+
cancelId: 99,
57+
message:
58+
'There is an update available. Would you like to update Gitify now?',
59+
},
60+
response => {
61+
console.log('Exit: ' + response); // eslint-disable-line no-console
62+
63+
if (response === 0) {
64+
updater.install();
65+
}
6066
}
61-
} );
67+
);
6268
}
6369

6470
function checkAutoUpdate(showAlert) {
65-
66-
if (isWindows || isLinux) { return; }
71+
if (isWindows || isLinux) {
72+
return;
73+
}
6774

6875
let autoUpdateOptions = {
6976
repo: 'manosim/gitify',
70-
currentVersion: app.getVersion()
77+
currentVersion: app.getVersion(),
7178
};
7279

7380
const updater = new GhReleases(autoUpdateOptions);
@@ -92,7 +99,7 @@ app.on('ready', function() {
9299
type: 'info',
93100
buttons: ['Close'],
94101
title: 'No update available',
95-
message: 'You are currently running the latest version of Gitify.'
102+
message: 'You are currently running the latest version of Gitify.',
96103
});
97104
}
98105
}
@@ -103,7 +110,7 @@ app.on('ready', function() {
103110
});
104111
}
105112

106-
function initWindow () {
113+
function initWindow() {
107114
let defaults = {
108115
width: 500,
109116
height: 600,
@@ -114,15 +121,15 @@ app.on('ready', function() {
114121
fullscreenable: false,
115122
titleBarStyle: 'hidden-inset',
116123
webPreferences: {
117-
overlayScrollbars: true
118-
}
124+
overlayScrollbars: true,
125+
},
119126
};
120127

121128
appWindow = new BrowserWindow(defaults);
122129
appWindow.loadURL('file://' + __dirname + '/index.html');
123130
appWindow.show();
124131

125-
appWindow.on('close', function (event) {
132+
appWindow.on('close', function(event) {
126133
if (!isQuitting) {
127134
event.preventDefault();
128135
appWindow.hide();
@@ -137,12 +144,12 @@ app.on('ready', function() {
137144
appIcon = createAppIcon();
138145
initWindow();
139146

140-
ipcMain.on('reopen-window', () => appWindow.show() );
141-
ipcMain.on('startup-enable', () => autoStart.enable() );
142-
ipcMain.on('startup-disable', () => autoStart.disable() );
143-
ipcMain.on('check-update', () => checkAutoUpdate(true) );
147+
ipcMain.on('reopen-window', () => appWindow.show());
148+
ipcMain.on('startup-enable', () => autoStart.enable());
149+
ipcMain.on('startup-disable', () => autoStart.disable());
150+
ipcMain.on('check-update', () => checkAutoUpdate(true));
144151
ipcMain.on('set-badge', (event, count) => app.setBadgeCount(count));
145-
ipcMain.on('app-quit', () => app.quit() );
152+
ipcMain.on('app-quit', () => app.quit());
146153

147154
ipcMain.on('update-icon', (event, arg) => {
148155
if (!appIcon.isDestroyed()) {
@@ -180,7 +187,7 @@ app.on('ready', function() {
180187
});
181188
});
182189

183-
app.on('activate', () => appWindow.show() );
190+
app.on('activate', () => appWindow.show());
184191

185192
app.on('window-all-closed', () => {
186193
if (!isDarwin) {

src/js/__mocks__/electron.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
window.Notification = function (title) {
1+
window.Notification = function(title) {
22
this.title = title;
33

44
return {
5-
onclick: jest.fn()
5+
onclick: jest.fn(),
66
};
77
};
88

@@ -16,11 +16,13 @@ window.Audio = class Audio {
1616

1717
window.localStorage = {
1818
store: {},
19-
getItem: function (key) { return this.store[key]; },
20-
setItem: function (key, item) {
19+
getItem: function(key) {
20+
return this.store[key];
21+
},
22+
setItem: function(key, item) {
2123
this.store[key] = item;
2224
},
23-
removeItem: jest.fn()
25+
removeItem: jest.fn(),
2426
};
2527

2628
window.alert = jest.fn();
@@ -32,7 +34,7 @@ const browserWindow = {
3234
},
3335
on: () => {},
3436
close: jest.fn(),
35-
destroy: jest.fn()
37+
destroy: jest.fn(),
3638
};
3739

3840
const dialog = {
@@ -44,14 +46,14 @@ module.exports = {
4446
BrowserWindow: () => browserWindow,
4547
dialog: dialog,
4648
app: {
47-
getVersion: () => '0.0.1'
48-
}
49+
getVersion: () => '0.0.1',
50+
},
4951
},
5052
ipcRenderer: {
5153
send: jest.fn(),
5254
on: jest.fn(),
5355
},
5456
shell: {
55-
openExternal: jest.fn()
57+
openExternal: jest.fn(),
5658
},
5759
};

0 commit comments

Comments
 (0)