chore(package): update standard to version 7.0.0

This commit is contained in:
Julien Fontanet 2016-05-04 11:59:56 +02:00
parent c198350bfa
commit 0770aef4bf
16 changed files with 34 additions and 48 deletions

View File

@ -10,10 +10,12 @@ var plumber = require('gulp-plumber')
var sourceMaps = require('gulp-sourcemaps')
var watch = require('gulp-watch')
var join = require('path').join
// ===================================================================
var SRC_DIR = __dirname + '/src'
var DIST_DIR = __dirname + '/dist'
var SRC_DIR = join(__dirname, 'src')
var DIST_DIR = join(__dirname, 'dist')
var PRODUCTION = process.argv.indexOf('--production') !== -1

View File

@ -149,7 +149,7 @@
"mocha": "^2.2.1",
"must": "^0.13.1",
"sinon": "^1.14.1",
"standard": "^5.2.1"
"standard": "^7.0.0"
},
"scripts": {
"build": "npm run build-indexes && gulp build --production",

View File

@ -3,7 +3,7 @@ import {JsonRpcError} from 'json-rpc-peer'
// ===================================================================
// Export standard JSON-RPC errors.
export {
export { // eslint-disable-line no-duplicate-imports
InvalidJson,
InvalidParameters,
InvalidRequest,

View File

@ -74,7 +74,7 @@ installPatch.resolve = {
// -------------------------------------------------------------------
async function handlePatchUpload (req, res, {pool}) {
const {headers: {['content-length']: contentLength}} = req
const contentLength = req.headers['content-length']
if (!contentLength) {
res.writeHead(411)
res.end('Content length is mandatory')

View File

@ -33,10 +33,6 @@ export default class Collection extends EventEmitter {
})
}
constructor () {
super()
}
async add (models, opts) {
const array = isArray(models)
if (!array) {

View File

@ -15,6 +15,7 @@ import serveStatic from 'serve-static'
import startsWith from 'lodash.startswith'
import WebSocket from 'ws'
import { createServer as createProxyServer } from 'http-proxy'
import { join as joinPath } from 'path'
import {compile as compileJade} from 'jade'
import {
@ -129,7 +130,7 @@ async function setUpPassport (express, xo) {
// Registers the sign in form.
const signInPage = compileJade(
await readFile(__dirname + '/../signin.jade')
await readFile(joinPath(__dirname, '..', 'signin.jade'))
)
express.get('/signin', (req, res, next) => {
res.send(signInPage({
@ -515,7 +516,7 @@ const setUpConsoleProxy = (webServer, xo) => {
const { token } = parseCookies(req.headers.cookie)
const user = await xo.authenticateUser({ token })
if (!await xo.hasPermissions(user.id, [ [ id, 'operate' ] ])) { // eslint-disable-line space-before-keywords
if (!await xo.hasPermissions(user.id, [ [ id, 'operate' ] ])) {
throw new InvalidCredential()
}

View File

@ -3,8 +3,10 @@
import {expect} from 'chai'
import leche from 'leche'
import {productParams} from './job-executor'
import {_computeCrossProduct} from './job-executor'
import {
_computeCrossProduct,
productParams
} from './job-executor'
describe('productParams', function () {
leche.withData({

View File

@ -297,7 +297,7 @@ export function pSettle (promises) {
// -------------------------------------------------------------------
export {
export { // eslint-disable-line no-duplicate-imports
all as pAll,
catchPlus as pCatch,
delay as pDelay,
@ -351,14 +351,14 @@ export const safeDateFormat = d3TimeFormat('%Y%m%dT%H%M%SZ')
// This functions are often used throughout xo-server.
//
// Exports them from here to avoid direct dependencies on lodash.
export { default as forEach } from 'lodash.foreach'
export { default as isArray } from 'lodash.isarray'
export { default as forEach } from 'lodash.foreach' // eslint-disable-line no-duplicate-imports
export { default as isArray } from 'lodash.isarray' // eslint-disable-line no-duplicate-imports
export { default as isBoolean } from 'lodash.isboolean'
export { default as isEmpty } from 'lodash.isempty'
export { default as isFunction } from 'lodash.isfunction'
export { default as isInteger } from 'lodash.isinteger'
export { default as isObject } from 'lodash.isobject'
export { default as isString } from 'lodash.isstring'
export { default as isString } from 'lodash.isstring' // eslint-disable-line no-duplicate-imports
export { default as mapToArray } from 'lodash.map'
// -------------------------------------------------------------------

View File

@ -528,12 +528,12 @@ export default async function vhdMerge (
// Child must be a delta.
if (childVhd.footer.diskType !== HARD_DISK_TYPE_DIFFERENCING) {
throw new Error(`Unable to merge, child is not a delta backup.`)
throw new Error('Unable to merge, child is not a delta backup.')
}
// Merging in differencing disk is prohibited in our case.
if (parentVhd.footer.diskType !== HARD_DISK_TYPE_DYNAMIC) {
throw new Error(`Unable to merge, parent is not a full backup.`)
throw new Error('Unable to merge, parent is not a full backup.')
}
// Allocation table map is not yet implemented.
@ -541,7 +541,7 @@ export default async function vhdMerge (
parentVhd.hasBlockAllocationTableMap() ||
childVhd.hasBlockAllocationTableMap()
) {
throw new Error(`Unsupported allocation table map.`)
throw new Error('Unsupported allocation table map.')
}
// Read allocation table of child/parent.

View File

@ -322,7 +322,7 @@ const TRANSFORMS = {
return disks
})(),
install_methods: (function () {
const {['install-methods']: methods} = otherConfig
const methods = otherConfig['install-methods']
return methods ? methods.split(',') : []
})(),

View File

@ -32,11 +32,7 @@ export class UnknownLegendFormat extends XapiStatsError {
}
}
export class FaultyGranularity extends XapiStatsError {
constructor (msg) {
super(msg)
}
}
export class FaultyGranularity extends XapiStatsError {}
// -------------------------------------------------------------------
// Utils

View File

@ -1,3 +1,5 @@
/* eslint-disable camelcase */
import createDebug from 'debug'
import every from 'lodash.every'
import fatfs from 'fatfs'
@ -8,6 +10,7 @@ import includes from 'lodash.includes'
import pickBy from 'lodash.pickby'
import sortBy from 'lodash.sortby'
import unzip from 'julien-f-unzip'
import { defer } from 'promise-toolbox'
import { utcFormat, utcParse } from 'd3-time-format'
import {
wrapError as wrapXapiError,
@ -274,8 +277,7 @@ export default class Xapi extends XapiBase {
// TODO: implements a timeout.
_waitObject (predicate) {
if (isFunction(predicate)) {
let resolve
const promise = new Promise(resolve_ => resolve = resolve_)
const { promise, resolve } = defer()
const unregister = this._registerGenericWatcher(obj => {
if (predicate(obj)) {
@ -290,10 +292,7 @@ export default class Xapi extends XapiBase {
let watcher = this._objectWatchers[predicate]
if (!watcher) {
let resolve
const promise = new Promise(resolve_ => {
resolve = resolve_
})
const { promise, resolve } = defer()
// Register the watcher.
watcher = this._objectWatchers[predicate] = {
@ -352,18 +351,8 @@ export default class Xapi extends XapiBase {
let watcher = this._taskWatchers[ref]
if (!watcher) {
let resolve, reject
const promise = new Promise((resolve_, reject_) => {
resolve = resolve_
reject = reject_
})
// Register the watcher.
watcher = this._taskWatchers[ref] = {
promise,
resolve,
reject
}
watcher = this._taskWatchers[ref] = defer()
}
return watcher.promise

View File

@ -151,7 +151,7 @@ export default class {
}
async deleteAuthenticationToken (id) {
if (!await this._tokens.remove(id)) { // eslint-disable-line space-before-keywords
if (!await this._tokens.remove(id)) {
throw new NoSuchAuthenticationToken(id)
}
}

View File

@ -545,7 +545,7 @@ export default class {
$onFailure(() => handler.unlink(infoPath)::pCatch(noop))
const { streams,
const {
...infos
} = delta

View File

@ -57,7 +57,7 @@ export default class {
})
xo.on('start', async () => {
if (!(await users.exists())) {
if (!await users.exists()) {
const email = 'admin@admin.net'
const password = 'admin'
@ -246,7 +246,7 @@ export default class {
}
async getGroup (id) {
const group = (await this._groups.first(id))
const group = await this._groups.first(id)
if (!group) {
throw new NoSuchGroup(id)
}

View File

@ -78,7 +78,7 @@ export default class {
async unregisterXenServer (id) {
this.disconnectXenServer(id)::pCatch(noop)
if (!await this._servers.remove(id)) { // eslint-disable-line space-before-keywords
if (!await this._servers.remove(id)) {
throw new NoSuchXenServer(id)
}
}