Skip to content

Commit

Permalink
use eslint + airbnb eslintrc and rearrange files
Browse files Browse the repository at this point in the history
  • Loading branch information
timche committed May 15, 2016
1 parent 2f1b2a8 commit f001b52
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "airbnb-base",
"rules": {
"comma-dangle": [2, "never"],
"semi": [2, "never"]
}
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"productName": "Gmail Desktop",
"version": "0.1.0",
"description": "An unofficial Gmail Desktop App built with Electron",
"main": "index.js",
"main": "src/index.js",
"scripts": {
"clean": "rimraf build/",
"lint": "standard --verbose | snazzy",
"lint": "eslint src",
"test": "npm run lint",
"start": "electron .",
"build:osx": "electron-packager . --out=build --overwrite --platform=darwin --arch=x64 --icon=assets/icons/icon.icns --app-version=$npm_package_version",
"build:osx": "electron-packager . --out=build --overwrite --platform=darwin --arch=x64 --icon=src/assets/icons/icon.icns --app-version=$npm_package_version",
"build": "npm run clean && npm run build:osx"
},
"repository": {
Expand Down Expand Up @@ -38,11 +38,11 @@
"babel-core": "^6.7.7",
"babel-eslint": "^6.0.3",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.5.0",
"electron-packager": "^7.0.1",
"electron-prebuilt": "^0.37.7",
"rimraf": "^2.5.2",
"snazzy": "^3.0.1",
"standard": "^6.0.8"
"eslint": "^2.10.1",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.0",
"rimraf": "^2.5.2"
}
}
19 changes: 10 additions & 9 deletions app.js → src/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* eslint-disable import/no-unresolved */
import { app, shell, BrowserWindow, Menu } from 'electron'
/* eslint-enable import/no-unresolved */
import menu from './menu'

let mainWindow
let isQuitting = false

let isAlreadyRunning = app.makeSingleInstance(() => {
const isAlreadyRunning = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore()
Expand All @@ -18,13 +20,13 @@ if (isAlreadyRunning) {
app.quit()
}

function updateBadge (title) {
let unreadCount = (/^.+\s\((\d+)\)/).exec(title)
function updateBadge(title) {
const unreadCount = (/^.+\s\((\d+)\)/).exec(title)

app.dock.setBadge(unreadCount ? unreadCount[1] : '')
}

function createWindow () {
function createWindow() {
mainWindow = new BrowserWindow({
title: app.getName(),
width: 1280,
Expand All @@ -46,10 +48,9 @@ function createWindow () {

app.on('ready', () => {
createWindow()

Menu.setApplicationMenu(menu)

let {webContents} = mainWindow
const { webContents } = mainWindow

webContents.on('dom-ready', () => {
mainWindow.show()
Expand All @@ -60,13 +61,13 @@ app.on('ready', () => {
e.preventDefault()
mainWindow.loadURL(url)
} else {
e.preventDefault()
shell.openExternal(url)
e.preventDefault()
shell.openExternal(url)
}
})
})

app.on('activate', function () {
app.on('activate', () => {
mainWindow.show()
})

Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions menu.js → src/menu.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable import/no-unresolved */
import { app, shell, Menu } from 'electron'
/* eslint-enable import/no-unresolved */

const APP_NAME = app.getName()

let darwinMenu = [
const darwinMenu = [
{
label: APP_NAME,
submenu: [
Expand Down Expand Up @@ -30,7 +32,7 @@ let darwinMenu = [
{
label: `Quit ${APP_NAME}`,
accelerator: 'Cmd+Q',
click () {
click() {
app.quit()
}
}
Expand Down Expand Up @@ -96,13 +98,13 @@ let darwinMenu = [
submenu: [
{
label: `${APP_NAME} Website`,
click () {
click() {
shell.openExternal('https://github.com/timche/gmail-desktop')
}
},
{
label: 'Report an issue',
click () {
click() {
shell.openExternal('https://github.com/timche/gmail-desktop/issues/new')
}
}
Expand Down

0 comments on commit f001b52

Please sign in to comment.