Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit a958edb

Browse files
authored
Merge pull request #37 from skellock/welcome-to-lint-town
Lints hard and with a vengeance.
2 parents e64ce5e + cf5b60e commit a958edb

File tree

23 files changed

+133
-54
lines changed

23 files changed

+133
-54
lines changed

package-lock.json

Lines changed: 60 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
"standard": "10.0.2",
7272
"ts-node": "3.3.0",
7373
"tslint": "5.5.0",
74+
"tslint-eslint-rules": "4.1.1",
75+
"tslint-react": "3.2.0",
76+
"tslint-react-recommended": "1.0.15",
7477
"typescript": "2.4.2"
7578
},
7679
"electron-ava": {
@@ -110,6 +113,11 @@
110113
"pack": "electron-builder --dir",
111114
"postinstall": "electron-builder install-app-deps",
112115
"precommit": "lint-staged",
116+
"lint": "npm-run-all lint:*",
117+
"lint:ts": "tslint \"src/**/*.{ts,tsx}\"",
118+
"lint:js": "standard",
119+
"sanity": "npm-run-all check lint test",
120+
"prepush": "npm-run-all sanity",
113121
"start": "node fuse",
114122
"test": "npm-run-all test:main test:renderer",
115123
"test:main": "electron-ava src/main/**/*.test.js",

src/main/main-window/main-window.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ export function createMainWindow(appPath: string) {
1919
titleBarStyle: 'hidden',
2020
autoHideMenuBar: true,
2121
backgroundColor: '#fff',
22-
title: app.getName()
22+
title: app.getName(),
2323
})
2424

2525
// load entry html page in the renderer.
2626
window.loadURL(
2727
format({
2828
pathname: join(appPath, 'out/index.html'),
2929
protocol: 'file:',
30-
slashes: true
31-
})
30+
slashes: true,
31+
}),
3232
)
3333

3434
// only appear once we've loaded

src/main/menu/linux-menu.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ import { createSharedMenuItems } from './shared-menu'
22
import * as isDev from 'electron-is-dev'
33

44
export function createLinuxMenu(
5-
window: Electron.BrowserWindow
5+
window: Electron.BrowserWindow,
66
): Electron.MenuItemConstructorOptions[] {
77
const shared = createSharedMenuItems(window)
88

99
const fileMenu: Electron.MenuItemConstructorOptions = {
1010
label: '&File',
11-
submenu: [{ ...shared.quit, accelerator: 'Alt+F4' }]
11+
submenu: [{ ...shared.quit, accelerator: 'Alt+F4' }],
1212
}
1313

1414
const viewMenu: Electron.MenuItemConstructorOptions = {
1515
label: 'View',
1616
submenu: isDev
1717
? [
1818
{ ...shared.reload, accelerator: 'Ctrl+R' },
19-
{ ...shared.toggleDevTools, accelerator: 'Ctrl+Alt+I' }
20-
]
21-
: [{ ...shared.fullScreen, accelerator: 'Ctrl+Alt+F' }]
19+
{ ...shared.toggleDevTools, accelerator: 'Ctrl+Alt+I' },
20+
]
21+
: [{ ...shared.fullScreen, accelerator: 'Ctrl+Alt+F' }],
2222
}
2323

2424
const helpMenu: Electron.MenuItemConstructorOptions = {
2525
label: 'Help',
26-
submenu: [shared.visit]
26+
submenu: [shared.visit],
2727
}
2828

2929
return [fileMenu, viewMenu, helpMenu]

src/main/menu/macos-menu.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createSharedMenuItems } from './shared-menu'
33
import * as isDev from 'electron-is-dev'
44

55
export function createMacMenu(
6-
window: Electron.BrowserWindow
6+
window: Electron.BrowserWindow,
77
): Electron.MenuItemConstructorOptions[] {
88
const shared = createSharedMenuItems(window)
99
const name: string = app.getName()
@@ -17,23 +17,23 @@ export function createMacMenu(
1717
{ label: 'Hide Others', accelerator: 'Command+Option+H', role: 'hideOtherApplications' },
1818
{ label: 'Show All', role: 'unhideAllApplications' },
1919
{ type: 'separator' },
20-
{ ...shared.quit, accelerator: 'Command+Q' }
21-
]
20+
{ ...shared.quit, accelerator: 'Command+Q' },
21+
],
2222
}
2323

2424
const viewMenu: Electron.MenuItemConstructorOptions = {
2525
label: 'View',
2626
submenu: isDev
2727
? [
2828
{ ...shared.reload, accelerator: 'Command+R' },
29-
{ ...shared.toggleDevTools, accelerator: 'Alt+Command+I' }
30-
]
31-
: [{ ...shared.fullScreen, accelerator: 'Ctrl+Command+F' }]
29+
{ ...shared.toggleDevTools, accelerator: 'Alt+Command+I' },
30+
]
31+
: [{ ...shared.fullScreen, accelerator: 'Ctrl+Command+F' }],
3232
}
3333

3434
const helpMenu: Electron.MenuItemConstructorOptions = {
3535
label: 'Help',
36-
submenu: [shared.visit]
36+
submenu: [shared.visit],
3737
}
3838

3939
return [appMenu, viewMenu, helpMenu]

src/main/menu/shared-menu.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ export function createSharedMenuItems(window: Electron.BrowserWindow) {
55
label: 'Visit on Github',
66
click() {
77
shell.openExternal('https://github.com/skellock/electron-starter')
8-
}
8+
},
99
}
1010

1111
const reload: Electron.MenuItemConstructorOptions = {
1212
label: 'Reload',
1313
click() {
1414
window.webContents.reload()
15-
}
15+
},
1616
}
1717

1818
const quit: Electron.MenuItemConstructorOptions = { label: 'Quit', role: 'quit' }
@@ -21,21 +21,21 @@ export function createSharedMenuItems(window: Electron.BrowserWindow) {
2121
label: 'Toggle Developer Tools',
2222
click() {
2323
window.webContents.toggleDevTools()
24-
}
24+
},
2525
}
2626

2727
const fullScreen: Electron.MenuItemConstructorOptions = {
2828
label: 'Toggle Full Screen',
2929
click() {
3030
window.setFullScreen(!window.isFullScreen())
31-
}
31+
},
3232
}
3333

3434
return {
3535
visit,
3636
reload,
3737
quit,
3838
toggleDevTools,
39-
fullScreen
39+
fullScreen,
4040
}
4141
}

src/main/menu/windows-menu.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ import { createSharedMenuItems } from './shared-menu'
22
import * as isDev from 'electron-is-dev'
33

44
export function createWindowsMenu(
5-
window: Electron.BrowserWindow
5+
window: Electron.BrowserWindow,
66
): Electron.MenuItemConstructorOptions[] {
77
const shared = createSharedMenuItems(window)
88

99
const fileMenu: Electron.MenuItemConstructorOptions = {
1010
label: '&File',
11-
submenu: [{ ...shared.quit, accelerator: 'Alt+F4' }]
11+
submenu: [{ ...shared.quit, accelerator: 'Alt+F4' }],
1212
}
1313

1414
const viewMenu: Electron.MenuItemConstructorOptions = {
1515
label: 'View',
1616
submenu: isDev
1717
? [
1818
{ ...shared.reload, accelerator: 'Ctrl+R' },
19-
{ ...shared.toggleDevTools, accelerator: 'Ctrl+Alt+I' }
20-
]
21-
: [{ ...shared.fullScreen, accelerator: 'Ctrl+Alt+F' }]
19+
{ ...shared.toggleDevTools, accelerator: 'Ctrl+Alt+I' },
20+
]
21+
: [{ ...shared.fullScreen, accelerator: 'Ctrl+Alt+F' }],
2222
}
2323

2424
const helpMenu: Electron.MenuItemConstructorOptions = {
2525
label: 'Help',
26-
submenu: [shared.visit]
26+
submenu: [shared.visit],
2727
}
2828

2929
return [fileMenu, viewMenu, helpMenu]

src/main/updater/updater.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ Heads up: dev-app-update.yml is in the .gitignore file.
3434
* @param app The electron app.
3535
*/
3636
export function createUpdater(app: Electron.App): void {
37-
// jet if we shoulldn't be here
38-
if (!shouldCheck) return
37+
// jet if we shouldn't be here
38+
if (!shouldCheck) {
39+
return
40+
}
3941

4042
// configure the autoUpdater's logger
4143
autoUpdater.logger = log

src/renderer/features/example-using-tabs/dog-tab/dog-tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Logo } from '../logo/logo'
66

77
const TEXT_STYLE: CSSProperties = {
88
paddingTop: spacing.medium,
9-
paddingBottom: spacing.medium
9+
paddingBottom: spacing.medium,
1010
}
1111

1212
export class DogTab extends React.Component<{}, {}> {

src/renderer/features/example-using-tabs/header/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ROOT_STYLE: CSSProperties = {
99
textAlign: 'center',
1010
paddingTop: spacing.verySmall,
1111
backgroundColor: colors.headerBg,
12-
fontSize: fontSizes.small
12+
fontSize: fontSizes.small,
1313
}
1414

1515
const title = remote.require('../package.json').name

0 commit comments

Comments
 (0)