Skip to content

Commit

Permalink
lint: switch to using lintit
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlucas committed Mar 22, 2016
1 parent 240c9ea commit c70ce6f
Show file tree
Hide file tree
Showing 28 changed files with 34 additions and 52 deletions.
9 changes: 2 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const patch = require('virtual-dom/patch')
const createElement = require('virtual-dom/create-element')
const debug = require('debug')('eyearesee:app')
const auth = require('./lib/auth')
const path = require('path')
const fs = require('fs')
const CommandManager = require('./lib/commands')
const mapUtil = require('map-util')
const Tooltip = require('./lib/tooltip')
Expand All @@ -21,9 +19,6 @@ const Themes = require('./lib/themes')

module.exports = window.App = App

const HOME = process.env.EYEARESEE_HOME
const RESOURCES = process.env.EYEARESEE_RESOURCE_PATH

const Connection = require('./lib/models/connection')
const Channel = require('./lib/models/channel')
const ConnSettings = require('./lib/models/connection-settings')
Expand Down Expand Up @@ -114,7 +109,6 @@ App.prototype.playMessageSound = function playMessageSound() {
}

App.prototype._addCommands = function _addCommands() {
const m = this.commandManager
this.commandManager.addDefaults()
}

Expand Down Expand Up @@ -250,6 +244,8 @@ App.prototype.previousPanel = function previousPanel() {
if (prevCon._panels.size) {
// show the last panel in the previous connection
const last = mapUtil.lastVal(prevCon._panels)
if (last)
return this.nav.showConnection(last)
}

// if no panels, just show the previous connection
Expand Down Expand Up @@ -279,7 +275,6 @@ App.prototype.previousPanel = function previousPanel() {
App.prototype.render = function render() {
const views = this.views

var view
var columns = 2

var active = this.nav.current
Expand Down
13 changes: 9 additions & 4 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const inherits = require('util').inherits
const EE = require('events')
const electron = require('electron')
const path = require('path')
const app = electron.app
const Menu = electron.Menu
const ipcMain = electron.ipcMain
Expand Down Expand Up @@ -42,10 +41,16 @@ App.prototype.handleEvents = function() {
this.on('app:minimize', () => {
Menu.sendActionToFirstResponder('performMiniaturize:')
})
this.on('app:zoom', () => Menu.sendActionToFirstResponder('zoom:'))
this.on('app:zoom', () => {
Menu.sendActionToFirstResponder('zoom:')
})
} else {
this.on('app:minimize', () => BrowserWindow.getFocusedWindow().minimize())
this.on('app:zoom', () => BrowserWindow.getFocusedWindow().maximize())
this.on('app:minimize', () => {
BrowserWindow.getFocusedWindow().minimize()
})
this.on('app:zoom', () => {
BrowserWindow.getFocusedWindow().maximize()
})
}

this.openPathOnEvent('app:about', '/about')
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Manager.prototype.addDefaults = function addDefaults() {
this.add('/notice', 'Send notice to target', '[nickname|channel] [msg]')
this.alias('/part', '/leave')
this.add('/quit', 'Terminate session', '[msg]')
this.add('/topic', `Set/remove a channel's topic`, '[channel] [topic]')
this.add('/topic', 'Set/remove a channel\'s topic', '[channel] [topic]')
}

Manager.prototype.first = function first() {
Expand Down
2 changes: 1 addition & 1 deletion lib/handle-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Handler.prototype.join = function join(msg) {
}

const conn = msg.conn
msg.conn.write(`JOIN ${msg.chan}`)
conn.write(`JOIN ${msg.chan}`)
}

Handler.prototype.nick = function nick(msg) {
Expand Down
1 change: 0 additions & 1 deletion lib/handlers/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const debug = require('debug')('eyearesee:handlers:message')
module.exports = function handleMessage(msg, type, conn) {
debug('handleMessage', type)
const to = msg.to
const from = msg.from.toLowerCase()
const channel = to.toLowerCase()
const nick = conn.user.nickname.toLowerCase()

Expand Down
4 changes: 3 additions & 1 deletion lib/handlers/part.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ module.exports = function handlePart(msg, conn) {
return
}

const channels = msg.channels.map((m) => m.toLowerCase())
const channels = msg.channels.map((m) => {
m.toLowerCase()
})
for (var i = 0; i < channels.length; i++) {
const channel = channels[i].toLowerCase()
if (!conn.channels.has(channel)) {
Expand Down
2 changes: 0 additions & 2 deletions lib/list-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const remote = require('remote')
const ipc = electron.ipcRenderer
const EE = require('events')
const inherits = require('util').inherits
const delegate = require('delegate-dom')
const h = require('virtual-dom/h')
const diff = require('virtual-dom/diff')
const patch = require('virtual-dom/patch')
Expand All @@ -16,7 +15,6 @@ const fs = require('fs')

module.exports = window.ListWindow = ListWindow

const HOME = process.env.EYEARESEE_HOME
const RESOURCES = process.env.EYEARESEE_RESOURCE_PATH

function ListWindow() {
Expand Down
3 changes: 1 addition & 2 deletions lib/models/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const IRC = require('../irc')
const db = require('../db')
const auth = require('../auth')
const Logger = require('../logger')
const utils = require('../utils')
const linker = require('../linker')

module.exports = Connection
Expand Down Expand Up @@ -680,7 +679,7 @@ Connection.prototype.removePrivateMessage = function removePrivateMessage(n) {
n = n.toLowerCase()

if (!this.privateMessages.has(n)) {
debug('remove private message does not exist', n, this.privateMessages.keys())
debug('remove pm does not exist', n, this.privateMessages.keys())
return
}

Expand Down
6 changes: 5 additions & 1 deletion lib/models/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ function Message(opts) {

Message.prototype.process = function process() {
const chan = this.channel
this.formatted = utils.processMessage(this.message, chan.colorMap, chan._connection)
this.formatted = utils.processMessage(
this.message
, chan.colorMap
, chan._connection
)
}

Message.prototype.processJoinPart = function processJoinPart() {
Expand Down
1 change: 0 additions & 1 deletion lib/router/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'

const pathToRE = require('path-to-regexp')
const URL = require('url')

module.exports = class Route {
constructor(path, fn) {
Expand Down
3 changes: 0 additions & 3 deletions lib/settings.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
'use strict'

const debug = require('debug')('eyearesee:settings')
const db = require('./db')

module.exports = Settings

function Settings(db) {
Expand Down
1 change: 0 additions & 1 deletion lib/styles/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ Manager.prototype.addStyleSheet = function addStyleSheet(source, params) {

Manager.prototype.addElement = function addElement(ele) {
const sourcePath = ele.sourcePath
const context = ele.context

this.elements.push(ele)
this.elementsByPath.set(sourcePath, ele)
Expand Down
3 changes: 0 additions & 3 deletions lib/themes/theme.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
'use strict'

const path = require('path')
const fs = require('fs')

module.exports = Theme

function Theme(manager, file, name, active) {
Expand Down
10 changes: 5 additions & 5 deletions lib/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ Tooltip.prototype.getOptions = function getOptions(options) {

if (options.delay && typeof options.delay === 'number') {
options.delay = {
show: options.delay,
hide: options.delay
show: options.delay
, hide: options.delay
}
}

Expand Down Expand Up @@ -181,7 +181,7 @@ Tooltip.prototype.enter = function enter(event) {

if (!this.options.delay || !this.options.delay.show) return this.show()

this.timeout = setTimeout(function () {
this.timeout = setTimeout(function() {
if (this.hoverState === 'in') this.show()
}.bind(this), this.options.delay.show)
}
Expand Down Expand Up @@ -212,7 +212,7 @@ Tooltip.prototype.leave = function leave(event) {

if (!this.options.delay || !this.options.delay.hide) return this.hide()

this.timeout = setTimeout(function () {
this.timeout = setTimeout(function() {
if (this.hoverState === 'out') this.hide()
}.bind(this), this.options.delay.hide)
}
Expand Down Expand Up @@ -527,7 +527,7 @@ Tooltip.prototype.getDelegateComponent = function getDelegateComponent(el) {
return component
}

function extend () {
function extend() {
const args = new Array(arguments.length)
for (let i = 0; i < args.length; i++) {
args[i] = arguments[i]
Expand Down
1 change: 0 additions & 1 deletion lib/views/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Base = require('vdelement')
const Userbar = require('./userbar')
const linker = require('../linker')
const Message = require('./message-log')
const debug = require('debug')('eyearesee:views:channel')
const ShowHideButton = require('./components/show-hide-button')

module.exports = Channel
Expand Down
4 changes: 0 additions & 4 deletions lib/views/command-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const h = require('virtual-dom/h')
const inherits = require('util').inherits
const Base = require('vdelement')
const mapUtil = require('map-util')
const completor = require('completor')
const debug = require('debug')('eyearesee:views:command-bar')

Expand Down Expand Up @@ -78,10 +77,7 @@ CommandBar.prototype._getEles = function _getEles() {
const cmds = this.manager.commands
let items

const hidden = !this.isShowing()

if (this._filter) {
let i = 0
const names = this.manager._names
const matches = completor(this._filter, names)
if (!matches.length) {
Expand Down
1 change: 0 additions & 1 deletion lib/views/connection-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const h = require('virtual-dom/h')
const Base = require('vdelement')
const inherits = require('util').inherits
const utils = require('../utils')
const linker = require('../linker')

module.exports = Log

Expand Down
2 changes: 1 addition & 1 deletion lib/views/connection-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Settings.prototype.render = function render(settings) {
return [
h('irc-header.pure-g', [
h('.pure-u-1-1', [
h('h2.title', `Server Settings`)
h('h2.title', 'Server Settings')
, h('.p.subtitle', conn.name)
])
])
Expand Down
3 changes: 1 addition & 2 deletions lib/views/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const inherits = require('util').inherits
const Base = require('vdelement')
const parse = require('../parse-message')
const debug = require('debug')('eyearesee:views:input')
const utils = require('../utils')
const argsplit = require('argsplit')
const completor = require('completor')
const CommandBar = require('./command-bar')
Expand Down Expand Up @@ -108,7 +107,7 @@ Input.prototype.onKeyup = function onKeyup(e, nav) {
}

function printCode(code, ev) {
debug("%s %s", ev, Events.nameForCode(code))
debug('%s %s', ev, Events.nameForCode(code))
}

Input.prototype.onKeydown = function onKeydown(e, nav) {
Expand Down
1 change: 0 additions & 1 deletion lib/views/sidebar/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Channels.prototype.oncontextmenu = function oncontextmenu(e, chan) {
const remote = require('electron').remote
const Menu = remote.Menu
const MenuItem = remote.MenuItem
const nav = this.target.nav
const menu = new Menu()

menu.append(new MenuItem({
Expand Down
1 change: 0 additions & 1 deletion lib/views/sidebar/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Connection.prototype.oncontextmenu = function oncontextmenu(e, conn) {
const remote = require('electron').remote
const Menu = remote.Menu
const MenuItem = remote.MenuItem
const nav = this.target.nav
const menu = new Menu()
menu.append(new MenuItem({
label: 'Connect'
Expand Down
1 change: 0 additions & 1 deletion lib/views/sidebar/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Messages.prototype.oncontextmenu = function oncontextmenu(e, message) {
const remote = require('electron').remote
const Menu = remote.Menu
const MenuItem = remote.MenuItem
const nav = this.target.nav
const menu = new Menu()

menu.append(new MenuItem({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build-css": "lessc -x client/less/index.less > public/css/dusk.css",
"dev": "npm run build-css && npm start",
"lint": "eslint *.js lib/**.js test/**.js",
"lint": "lintit",
"package-osx": "make package-osx",
"start": "electron .",
"test": "EYEARESEE_HOME=$(pwd)/test/fixtures/HOME tap test/*.js test/**/*.js test/**/**/*.js --cov"
Expand All @@ -33,8 +33,8 @@
"devDependencies": {
"electron-packager": "~5.2.1",
"electron-rebuild": "~1.0.2",
"eslint": "~1.10.3",
"less": "~2.5.3",
"lintit": "~1.0.1",
"tap": "~5.0.0"
},
"license": "MIT",
Expand Down
1 change: 0 additions & 1 deletion test/models/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const test = require('tap').test
const Channel = require('../../lib/models/channel')
const User = require('../../lib/models/user')

test('Channel - type channel', (t) => {
const conn = {
Expand Down
1 change: 0 additions & 1 deletion test/models/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const test = require('tap').test
const Connection = require('../../lib/models/connection')
const Channel = require('../../lib/models/channel')
const Settings = require('../../lib/models/connection-settings')
const auth = require('../../lib/auth')
const IRC = require('../../lib/irc')
Expand Down
1 change: 1 addition & 0 deletions test/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test('load', (t) => {

// now let's try to load it
settings.load((err) => {
t.error(err, 'err should not exist')
t.equal(settings.get('logLimit'), 300)
settings.del('logLimit', (err) => {
if (err) throw err
Expand Down
4 changes: 2 additions & 2 deletions test/views/message-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('MessageLogView', (t) => {
}
})

const u1 = chan.addUser({
chan.addUser({
nickname: 'evanlucas'
, username: 'evanlucas'
, address: 'biscuits.local'
Expand All @@ -39,7 +39,7 @@ test('MessageLogView', (t) => {
, color: 'green'
})

const u2 = chan.addUser({
chan.addUser({
nickname: 'evanlucas2'
, username: 'evanlucas2'
, address: 'biscuits.local'
Expand Down
1 change: 0 additions & 1 deletion test/views/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const SidebarView = require('../../lib/views/sidebar')
const ConnectionView = require('../../lib/views/sidebar/connection')
const Connection = require('../../lib/models/connection')
const Channel = require('../../lib/models/channel')
const Settings = require('../../lib/models/connection-settings')
const LogoView = require('../../lib/views/logo')
const common = require('../common')

Expand Down

0 comments on commit c70ce6f

Please sign in to comment.