1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-21 17:26:56 +01:00

fix: run lint

Signed-off-by: getlarge <ed@getlarge.eu>
This commit is contained in:
getlarge 2021-03-09 14:20:00 +01:00
parent 611624fd7a
commit abaa40b269
No known key found for this signature in database
GPG Key ID: E4E13243600F9566
12 changed files with 51 additions and 52 deletions

View File

@ -2,6 +2,8 @@
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
/* eslint-disable strict, no-console, object-shorthand, import/no-extraneous-dependencies */
const { ConcatSource } = require('webpack-sources')
module.exports = class AddVendorsPlugin {
@ -28,7 +30,7 @@ module.exports = class AddVendorsPlugin {
compilation.assets[this.base] = main
compilation.assets[`${this.base}.map`] = mainMap
}
callback()
}
)

View File

@ -11,7 +11,7 @@ import stringifyAsQueryParam from './stringify_as_query_param'
const fetch = fetchPonyfill(Promise)
export function ResponseError(message, status, requestURI) {
export function ResponseError(message, status, requestURI) {
this.name = 'ResponseError'
this.message = message
this.status = status
@ -19,7 +19,7 @@ export function ResponseError(message, status, requestURI) {
this.stack = (new Error()).stack
}
ResponseError.prototype = new Error;
ResponseError.prototype = new Error()
/**
* @private
@ -50,12 +50,15 @@ function handleResponse(res) {
// If status is not a 2xx (based on Response.ok), assume it's an error
// See https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch
if (!(res && res.ok)) {
throw new ResponseError('HTTP Error: Requested page not reachable', `${res.status} ${res.statusText}`, res.url)
throw new ResponseError(
'HTTP Error: Requested page not reachable',
`${res.status} ${res.statusText}`,
res.url
)
}
return res
}
/**
* @private
* imported from https://github.com/bigchaindb/js-utility-belt/

View File

@ -22,7 +22,7 @@ export default class Connection {
// This driver implements the BEP-14 https://github.com/bigchaindb/BEPs/tree/master/14
constructor(nodes, headers = {}, timeout = DEFAULT_TIMEOUT) {
// Copy object
this.headers = Object.assign({}, headers)
this.headers = { ...headers }
// Validate headers
Object.keys(headers).forEach(header => {
@ -49,7 +49,7 @@ export default class Connection {
if (typeof node === 'string') {
return { 'endpoint': node, 'headers': headers }
} else {
const allHeaders = Object.assign({}, headers, node.headers)
const allHeaders = { ...headers, ...node.headers }
return { 'endpoint': node.endpoint, 'headers': allHeaders }
}
}
@ -155,7 +155,6 @@ export default class Connection {
})
}
/**
* @param transaction
*/
@ -166,7 +165,6 @@ export default class Connection {
})
}
/**
* @param transaction
*/

View File

@ -4,7 +4,6 @@
import { sprintf } from 'sprintf-js'
// Regexes taken from or inspired by sprintf-js
const Regex = {
TEMPLATE_LITERAL: /\${([^)]+?)}/g,

View File

@ -19,7 +19,6 @@ const ERROR_FROM_SERVER = 'HTTP Error: Requested page not reachable'
* default settings, and response handling.
*/
export default class Request {
constructor(node) {
this.node = node
@ -33,14 +32,15 @@ export default class Request {
return Promise.reject(new Error('Request was not given a url.'))
}
// Load default fetch configuration and remove any falsy query parameters
const requestConfig = Object.assign({}, this.node.headers, DEFAULT_REQUEST_CONFIG, config, {
const requestConfig = {
...this.node.headers,
...DEFAULT_REQUEST_CONFIG,
...config,
query: config.query && sanitize(config.query)
})
}
const apiUrl = this.node.endpoint + urlPath
if (requestConfig.jsonBody) {
requestConfig.headers = Object.assign({}, requestConfig.headers, {
'Content-Type': 'application/json'
})
requestConfig.headers = { ...requestConfig.headers, 'Content-Type': 'application/json' }
}
// If connectionError occurs, a timestamp equal to now +

View File

@ -2,9 +2,8 @@
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import 'core-js/features/array/includes';
import 'core-js/features/object/entries';
import 'core-js/features/array/includes'
import 'core-js/features/object/entries'
/**
* @private
@ -32,7 +31,7 @@ function filterFromObject(obj, filter, { isInclusion = true } = {}) {
*/
function applyFilterOnObject(obj, filterFn) {
if (filterFn == null) {
return Object.assign({}, obj)
return { ...obj }
}
const filteredObj = {}

View File

@ -6,7 +6,6 @@ import 'core-js/features/object/entries'
import decamelize from 'decamelize'
import queryString from 'query-string'
/**
* @private
* imported from https://github.com/bigchaindb/js-utility-belt/

View File

@ -166,7 +166,7 @@ export default class Transaction {
subconditions.forEach((subcondition) => {
// TODO: add support for Condition
thresholdCondition.addSubfulfillment(subcondition)
//? Should be thresholdCondition.addSubcondition(subcondition)
// ? Should be thresholdCondition.addSubcondition(subcondition)
})
if (json) {

View File

@ -4,7 +4,6 @@
import Request from './request'
/**
*
* @private
@ -13,7 +12,6 @@ import Request from './request'
* customizable in the future).
*/
export default class Transport {
constructor(nodes, timeout) {
this.connectionPool = []

View File

@ -2,8 +2,8 @@
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import base58 from 'bs58'
import { createHash } from 'crypto'
import base58 from 'bs58'
import { Ed25519Sha256 } from 'crypto-conditions'
import { Transaction, Ed25519Keypair } from '../src'
// TODO: Find out if ava has something like conftest, if so put this there.
@ -34,13 +34,14 @@ export const bobCondition = Transaction.makeEd25519Condition(bob.publicKey)
export const bobOutput = Transaction.makeOutput(bobCondition)
export function delegatedSignTransaction(...keyPairs) {
return function sign(serializedTransaction, input, index) {
return function sign(serializedTransaction, input) {
const transactionUniqueFulfillment = input.fulfills ? serializedTransaction
.concat(input.fulfills.transaction_id)
.concat(input.fulfills.output_index) : serializedTransaction
.concat(input.fulfills.transaction_id)
.concat(input.fulfills.output_index) : serializedTransaction
const transactionHash = createHash('sha3-256').update(transactionUniqueFulfillment).digest()
const filteredKeyPairs = keyPairs.filter(({ publicKey }) =>
input.owners_before.includes(publicKey))
const filteredKeyPairs = keyPairs.filter(
({ publicKey }) => input.owners_before.includes(publicKey)
)
const ed25519Fulfillment = new Ed25519Sha256()
filteredKeyPairs.forEach(keyPair => {

View File

@ -2,33 +2,33 @@
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
/* eslint-disable strict, no-console, object-shorthand */
/* eslint-disable strict, no-console, object-shorthand, import/no-extraneous-dependencies */
'use strict'
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
devtool: 'inline-source-map',
optimization: {
minimizer: [
new TerserPlugin({
test: /vendor/,
sourceMap: false
}),
new TerserPlugin({
test: /^((?!(vendor)).)*.js$/,
sourceMap: false
})
],
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
devtool: 'inline-source-map',
optimization: {
minimizer: [
new TerserPlugin({
test: /vendor/,
sourceMap: false
}),
new TerserPlugin({
test: /^((?!(vendor)).)*.js$/,
sourceMap: false
})
],
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
}
}
}
}

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
/* eslint-disable strict, no-console, object-shorthand */
/* eslint-disable strict, no-console, object-shorthand, import/no-extraneous-dependencies */
'use strict'