Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
fix(lint): standard --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alopezsanchez authored and zkat committed Nov 26, 2018
1 parent 914e2c4 commit a260db1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
8 changes: 4 additions & 4 deletions lib/commands/access.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const parseOpts = argv => Config(npmConfig().concat(argv).concat({
}))

const render = (opts, content = {}) => {
const { h, renderToString } = require('ink')
const { h, renderToString } = require('ink') // eslint-disable-line
const Table = require('ink-table').default

if (opts.json) {
Expand All @@ -90,7 +90,7 @@ const render = (opts, content = {}) => {
const data = Object.keys(content).map(collab => {
return { collab, role: content[collab] }
})
console.log(renderToString(<Table data={data}/>))
console.log(renderToString(<Table data={data} />))
}
}

Expand All @@ -103,7 +103,7 @@ async function accessRestricted (argv) {
}

async function accessGrant (argv) {
await access.grant(argv.spec, argv.team, argv.permissions, parseOpts(argv))
await access.grant(argv.spec, argv.team, argv.permissions, parseOpts(argv)) // eslint-disable-line
}

async function accessRevoke (argv) {
Expand All @@ -113,7 +113,7 @@ async function accessRevoke (argv) {
async function accessLsPackages (argv) {
const getPackagesByCurrentUser = async () => {
const whoami = require('./whoami')
return await whoami.handler({ silent: true })
return whoami.handler({ silent: true })
}

const entity = argv.entity
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/org.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async function orgRm (argv) {

async function orgLs (argv) {
const figgyPudding = require('figgy-pudding')
const { h, renderToString } = require('ink')
const { h, renderToString } = require('ink') // eslint-disable-line
const orgs = require('libnpm/org')
const npmConfig = require('../config.js')
const Table = require('ink-table').default
Expand All @@ -126,6 +126,6 @@ async function orgLs (argv) {
const data = Object.keys(roster).map(user => {
return {user, role: roster[user]}
})
console.log(renderToString(<Table data={data}/>))
console.log(renderToString(<Table data={data} />))
}
}
20 changes: 10 additions & 10 deletions lib/commands/profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Profile = module.exports = {
.command({
command: 'create-token',
describe: 'Create a new authentication token, possibly with restrictions.',
builder: y => y.help('help', 'h').options(Object.assign({}, ProfileSubcommandsOptions , {
builder: y => y.help('help', 'h').options(Object.assign({}, ProfileSubcommandsOptions, {
'read-only': {
alias: 'ro',
describe: 'Readonly',
Expand Down Expand Up @@ -78,10 +78,10 @@ const Profile = module.exports = {

const libnpm = require('libnpm')
const figgyPudding = require('figgy-pudding')
const { h, renderToString } = require('ink')
const { h, renderToString } = require('ink') // eslint-disable-line
const Table = require('ink-table').default
const log = require('npmlog')
const readPassword = require("../utils/read-password")
const readPassword = require('../utils/read-password')
const otplease = require('../utils/otplease.js')
const npmConfig = require('../config.js')

Expand Down Expand Up @@ -155,7 +155,7 @@ async function get (argv) {
profileInfo.tfa = parseTfaInfo(profileInfo.tfa)

// TODO: Maybe we should use another type of table?
console.log(renderToString(<Table data={[profileInfo]}/>))
console.log(renderToString(<Table data={[profileInfo]} />))
}
} catch (e) {
logError(e)
Expand All @@ -169,7 +169,7 @@ async function set (argv) {

// Check if the property exists
if (!validProperties.includes(argv.property)) {
console.error(`"${argv.property}" is not a property we can set. Valid properties are: ${validProperties.join(", ")}`)
console.error(`"${argv.property}" is not a property we can set. Valid properties are: ${validProperties.join(', ')}`)
return
}

Expand Down Expand Up @@ -204,7 +204,7 @@ async function setPassword (argv) {

// Check if OTP is required
await otplease(opts, opts => libnpm.profile.set({
password : {
password: {
old: currentPassword,
new: newPassword
}
Expand Down Expand Up @@ -280,7 +280,7 @@ async function enable2fa (argv) {
'\tauth-and-writes - Require two-factor authentication when logging in AND when publishing'
]
console.error(message.join('\n'))
return;
return
}

console.log(`Enabling two factor authentication for ${tfaMode}.`)
Expand Down Expand Up @@ -339,7 +339,7 @@ async function enable2fa (argv) {
}
}

async function createToken(argv) {
async function createToken (argv) {
const opts = getOptions(argv)

const password = await readPassword()
Expand All @@ -362,7 +362,7 @@ async function createToken(argv) {
console.log(values)
} else if (!opts.silent && opts.loglevel !== 'silent') {
const data = [mapTokenToTable(newToken, { trimToken: false })]
console.log(renderToString(<Table data={data}/>))
console.log(renderToString(<Table data={data} />))
}
}

Expand Down Expand Up @@ -400,7 +400,7 @@ async function listTokens (opts) {
})
} else if (!opts.silent && opts.loglevel !== 'silent') {
const data = tokens.map(token => mapTokenToTable(token))
console.log(renderToString(<Table data={data}/>))
console.log(renderToString(<Table data={data} />))
}
} catch (e) {
logError(e)
Expand Down
10 changes: 4 additions & 6 deletions lib/components/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const relativeDate = require('tiny-relative-date')
const columns = require('cli-columns')

const {
h,
h, // eslint-disable-line
renderToString,
Fragment,
Component,
Expand Down Expand Up @@ -56,7 +56,7 @@ const packageValueObjectItems = function ({ field, value, props, maxItems }) {

items = items.map((prop) =>
<span>
{prop}: <PackageValue field={`${field}.${prop}`} value={value[prop]}/>
{prop}: <PackageValue field={`${field}.${prop}`} value={value[prop]} />
</span>
)

Expand Down Expand Up @@ -97,7 +97,7 @@ class PackageValueList extends Component {
} else {
let items = value.map((value, index) =>
<span>
- <PackageValue field={`${field}[${index}]`} value={value}/>
- <PackageValue field={`${field}[${index}]`} value={value} />
</span>
)

Expand Down Expand Up @@ -268,7 +268,7 @@ class PackageFields extends Component {
let lines = fields.map((field) =>
<span>
{prefix}
<PackageField field={field} value={pkg && pkg[field] || pkg} maxItems={Infinity} />
<PackageField field={field} value={(pkg && pkg[field]) || pkg} maxItems={Infinity} />
</span>
)

Expand Down Expand Up @@ -379,8 +379,6 @@ function getData (packument, spec, fields) {
return object
}, {}))
}
} else {
data = data
}

return [data, versions]
Expand Down

0 comments on commit a260db1

Please sign in to comment.