Skip to content

Commit

Permalink
lib: fixup lint issues and add pretest hook to run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlucas committed Mar 31, 2016
1 parent 15636cf commit c4d3c54
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 66 deletions.
3 changes: 0 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const debug = require('debug')('eyearesee:app')
const CommandManager = require('./lib/commands')
const mapUtil = require('map-util')
const Tooltip = require('./lib/tooltip')
const nextVal = mapUtil.nextVal
const prevVal = mapUtil.prevVal
const Styles = require('./lib/styles/manager')
const Themes = require('./lib/themes')
const Router = require('./lib/router')
Expand All @@ -27,7 +25,6 @@ module.exports = window.App = App

const IRC = require('eyearesee-client')
const Connection = IRC.Connection
const Channel = IRC.Channel
const Settings = IRC.Settings
const auth = IRC.auth

Expand Down
1 change: 0 additions & 1 deletion lib/handle-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const debug = require('debug')('eyearesee:handle-input')
const IRC = require('eyearesee-client')
const Connection = IRC.Connection
const Channel = IRC.Channel
const Settings = IRC.Settings
const utils = require('./utils')

module.exports = Handler
Expand Down
1 change: 0 additions & 1 deletion lib/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const mapUtil = require('map-util')

const Connection = IRC.Connection
const Channel = IRC.Channel
const Settings = IRC.Settings
const prevVal = mapUtil.prevVal
const nextVal = mapUtil.nextVal
const firstVal = mapUtil.firstVal
Expand Down
15 changes: 8 additions & 7 deletions lib/views/connection-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ Settings.prototype.render = function render(settings) {
, text: 'Store password in keychain'
, checked: settings.get('persist.password')
})
, group( 'messages.limit'
, 'number'
, 'Max messages to keep in memory'
, settings.get('messages.limit')
, true
, settings.get('messages.limit')
)
, group(
'messages.limit'
, 'number'
, 'Max messages to keep in memory'
, settings.get('messages.limit')
, true
, settings.get('messages.limit')
)
, checkbox({
id: 'transcripts.enabled'
, text: 'Log transcripts'
Expand Down
15 changes: 0 additions & 15 deletions lib/views/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,6 @@ Login.prototype.render = function render() {
])
}

function checkbox(id, text, checked) {
return h('.form-group', [
h('.checkbox', [
h('label', [
h('input', {
type: 'checkbox'
, id: id
, checked: checked
})
, h('.setting-title', ` ${text}`)
])
])
])
}

function group(props, text) {
return h('.form-group', [
h('label.control-label', {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "lintit",
"package-osx": "make package-osx",
"start": "electron .",
"pretest": "npm run lint",
"test": "EYEARESEE_HOME=$(pwd)/test/fixtures/HOME tap test/*.js test/**/*.js test/**/**/*.js --cov"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion test/views/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,5 @@ test('Connection View', (t) => {
const out = settings.properties.onclick(opts)
t.equal(out, false, 'onclick returns false')

const body = res[1]
t.end()
})
33 changes: 1 addition & 32 deletions test/views/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,10 @@ test('LoginView', (t) => {
verify(outer, 'INPUT', opts, 0, type)
}

function verifyCB(node, id, text, checked) {
// node is the form-group
verify(node, 'DIV', {
className: 'form-group'
}, 2, `${text} form-group`)

const child = node.children[0]
verify(child, 'DIV', {
className: 'checkbox'
}, 1, `${text} col`)

const label = child.children[0]

verify(label, 'LABEL', {}, 2, `${text} checkbox`)

const input = label.children[0]
verify(input, 'INPUT', {
type: 'checkbox'
, id: id
, checked: checked
}, 0, `${text} input`)

const textPart = label.children[1]
verify(textPart, 'DIV', {
className: 'setting-title'
}, 1, 'setting-title')

const c = textPart.children[0]
t.equal(c.text, ` ${text}`)
}

verify(v, 'IRC-LOGIN', {
id: 'login'
, className: 'settings-container'
}, 2, 'loginForm')
}, 2, 'loginForm')

const formClass = v.children[1]
verify(formClass, 'DIV', {
Expand Down
6 changes: 0 additions & 6 deletions test/views/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const IRC = require('eyearesee-client')
const SidebarView = require('../../lib/views/sidebar')
const ConnectionView = require('../../lib/views/sidebar/connection')
const Connection = IRC.Connection
const Channel = IRC.Channel
const LogoView = require('../../lib/views/logo')
const common = require('../common')

Expand Down Expand Up @@ -142,11 +141,6 @@ test('SidebarView with active channel', (t) => {
}
})

const chan = new Channel({
name: '#node.js'
, connection: conn
})

const app = {
activeModel: conn
, connections: new Map([['Freenode', conn]])
Expand Down

0 comments on commit c4d3c54

Please sign in to comment.