Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade standard to latest and lint it #153

Merged
merged 3 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const client = new Client({
})

if (args.clear) {
delete config['aliases']
delete config.aliases
saveConfig(configFilePath, config)
process.stdout.write('Aliases cleared\n')
process.exit(0)
Expand All @@ -138,7 +138,7 @@ if (args.aliases) {
var aliases = Object.keys(config.aliases)
if (aliases.length === 0) {
process.stdout.write("You don't have any saved aliases.\n\n")
process.stdout.write(`Save an alias by running\n`)
process.stdout.write('Save an alias by running\n')
process.stdout.write(`${chalk.magentaBright('cabal: ')} ${chalk.greenBright('--alias cabal://c001..c4b41')} `)
process.stdout.write(`${chalk.blueBright('--key your-alias-name')}\n`)
} else {
Expand Down Expand Up @@ -224,7 +224,7 @@ function start (keys) {
saveConfig(configFilePath, config)
}

var pendingCabals = args.new ? [ client.createCabal() ] : keys.map(client.addCabal.bind(client))
var pendingCabals = args.new ? [client.createCabal()] : keys.map(client.addCabal.bind(client))
Promise.all(pendingCabals).then(() => {
if (args.new) {
console.error(`created the cabal: ${chalk.greenBright('cabal://' + client.getCurrentCabal().key)}`) // log to terminal output (stdout is occupied by interface)
Expand Down Expand Up @@ -298,13 +298,13 @@ function saveConfig (path, config) {
// make sure config is well-formatted (contains all config options)
if (!config.cabals) { config.cabals = [] }
if (!config.aliases) { config.aliases = {} }
let data = yaml.safeDump(config, {
const data = yaml.safeDump(config, {
sortKeys: true
})
fs.writeFileSync(path, data, 'utf8')
}

function publishSingleMessage ({key, channel, message, messageType, timeout}) {
function publishSingleMessage ({ key, channel, message, messageType, timeout }) {
console.log(`Publishing message to channel - ${channel || 'default'}: ${message}`)
client.addCabal(key).then(cabal => cabal.publishMessage({
type: messageType || 'chat/text',
Expand Down
10 changes: 5 additions & 5 deletions commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ function Commander (view, client) {
logToView(`${slash}${command}`)
logToView(` ${this.commands[key].help()}`)
}
logToView(`alt-n`)
logToView(` move between channels/cabals panes`)
logToView(`ctrl+{n,p}`)
logToView(` move up/down channels/cabals`)
logToView('alt-n')
logToView(' move between channels/cabals panes')
logToView('ctrl+{n,p}')
logToView(' move up/down channels/cabals')
}
},
qr: {
Expand Down Expand Up @@ -173,7 +173,7 @@ function Commander (view, client) {
help: () => 'display the public keys associated with the passed in nick',
call: (arg) => {
const users = this.cabal.getUsers()
let whoisKeys = Object.keys(users).filter((k) => users[k].name && users[k].name === arg)
const whoisKeys = Object.keys(users).filter((k) => users[k].name && users[k].name === arg)
const logToView = this.logger()
logToView(`* ${arg}'s public keys:`)
// list all of arg's public keys in list
Expand Down
2 changes: 1 addition & 1 deletion debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function print (t, arr, printAll) {
function simplify (arr) {
if (arr.length && arr[0].value) {
return arr.map((m) => {
let content = m.value.content ? m.value.content.text : JSON.stringify(m.value)
const content = m.value.content ? m.value.content.text : JSON.stringify(m.value)
return `${m.value.timestamp}: ${content}`
})
}
Expand Down
8 changes: 5 additions & 3 deletions neat-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ function NeatScreen (props) {
this.commander = Commander(this, this.client)
var self = this

this.neat = neatLog(this.renderApp.bind(this), { fullscreen: true,
this.neat = neatLog(this.renderApp.bind(this), {
fullscreen: true,
style: function (start, cursor, end) {
if (!cursor) cursor = ' '
return start + chalk.underline(cursor) + end
} }
}
}
)
this.neat.input.on('update', () => this.neat.render())
this.neat.input.on('enter', (line) => this.commander.process(line))
Expand All @@ -29,7 +31,7 @@ function NeatScreen (props) {
this.neat.input.on('tab', () => {
var line = this.neat.input.rawLine()
if (line.length > 1 && line[0] === '/') {
let parts = line.split(/\s+/g)
const parts = line.split(/\s+/g)
// command completion
if (parts.length === 1) {
var soFar = line.slice(1)
Expand Down
Loading