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

Remove extra eslint exceptions #729

Merged
merged 4 commits into from
Nov 4, 2019
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
1 change: 0 additions & 1 deletion es/ae/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ async function send (tx, options = {}) {
return this.sendTransaction(signed, opt)
}

// eslint-disable-next-line no-unused-vars
async function signUsingGA (tx, options = {}) {
const { authData, authFun } = options
return this.createMetaTx(tx, authData, authFun, options)
Expand Down
4 changes: 1 addition & 3 deletions es/channel/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ export function awaitingOffChainUpdate (channel, message, state) {
}

export async function awaitingTxSignRequest (channel, message, state) {
// eslint-disable-next-line no-useless-escape
const [, tag] = message.method.match(/^channels\.sign\.([^\.]+)$/) || []
const [, tag] = message.method.match(/^channels\.sign\.([^.]+)$/) || []
if (tag) {
if (message.params.data.tx) {
const signedTx = await options.get(channel).sign(tag, message.params.data.tx, {
Expand Down Expand Up @@ -441,7 +440,6 @@ export async function awaitingNewContractTx (channel, message, state) {
export function awaitingNewContractCompletion (channel, message, state) {
if (message.method === 'channels.update') {
const { round } = unpackTx(message.params.data.state).tx.encodedTx.tx
// eslint-disable-next-line standard/computed-property-even-spacing
const owner = options.get(channel)[{
initiator: 'initiatorId',
responder: 'responderId'
Expand Down
3 changes: 1 addition & 2 deletions es/channel/internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ function WebSocket (url, callbacks) {

return new Promise((resolve, reject) => {
const ws = new W3CWebSocket(url)
// eslint-disable-next-line no-return-assign
Object.entries(callbacks).forEach(([key, callback]) => ws[key] = callback)
Object.entries(callbacks).forEach(([key, callback]) => { ws[key] = callback })
fireOnce(ws, 'onopen', () => resolve(ws))
fireOnce(ws, 'onerror', (err) => reject(err))
})
Expand Down
5 changes: 2 additions & 3 deletions es/contract/aci/transformation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import Joi from 'joi-browser'

export const SOPHIA_TYPES = [
Expand All @@ -21,7 +20,7 @@ export const SOPHIA_TYPES = [

export function injectVars (t, aciType) {
const [[baseType, generic]] = Object.entries(aciType.typedef)
const [[_, varianValue]] = Object.entries(t)
const [[, varianValue]] = Object.entries(t)
switch (baseType) {
case SOPHIA_TYPES.variant:
return {
Expand All @@ -47,7 +46,7 @@ export function injectVars (t, aciType) {
* @return {Object}
*/
export function linkTypeDefs (t, bindings) {
const [_, typeDef] = typeof t === 'object' ? Object.keys(t)[0].split('.') : t.split('.')
const [, typeDef] = typeof t === 'object' ? Object.keys(t)[0].split('.') : t.split('.')
const aciType = [
...bindings.typedef,
{ name: 'state', typedef: bindings.state, vars: [] }
Expand Down
24 changes: 5 additions & 19 deletions es/tx/builder/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable curly */
import { BigNumber } from 'bignumber.js'
import { assertedType, rlp } from '../../utils/crypto'

Expand Down Expand Up @@ -35,8 +34,7 @@ function deserializeField (value, type, prefix) {
if (!value) return ''
switch (type) {
case FIELD_TYPES.ctVersion: {
// eslint-disable-next-line no-unused-vars
const [vm, _, abi] = value
const [vm, , abi] = value
return { vmVersion: readInt(Buffer.from([vm])), abiVersion: readInt(Buffer.from([abi])) }
}
case FIELD_TYPES.int:
Expand Down Expand Up @@ -165,20 +163,9 @@ function transformParams (params) {
.reduce(
(acc, [key, value]) => {
acc[key] = value
if (key === 'oracleTtl') acc = {
...acc,
oracleTtlType: value.type === ORACLE_TTL_TYPES.delta ? 0 : 1,
oracleTtlValue: value.value
}
if (key === 'queryTtl') acc = {
...acc,
queryTtlType: value.type === ORACLE_TTL_TYPES.delta ? 0 : 1,
queryTtlValue: value.value
}
if (key === 'responseTtl') acc = {
...acc,
responseTtlType: value.type === ORACLE_TTL_TYPES.delta ? 0 : 1,
responseTtlValue: value.value
if (['oracleTtl', 'queryTtl', 'responseTtl'].includes(key)) {
acc[`${key}Type`] = value.type === ORACLE_TTL_TYPES.delta ? 0 : 1
acc[`${key}Value`] = value.value
}
return acc
},
Expand All @@ -189,8 +176,7 @@ function transformParams (params) {
// INTERFACE

function getOracleRelativeTtl (params) {
// eslint-disable-next-line no-unused-vars
const [_, { value = 500 }] = Object.entries(params).find(([key]) => ['oracleTtl', 'queryTtl', 'responseTtl'].includes(key)) || ['', {}]
const [, { value = 500 }] = Object.entries(params).find(([key]) => ['oracleTtl', 'queryTtl', 'responseTtl'].includes(key)) || ['', {}]
return value // TODO investigate this
}

Expand Down
1 change: 0 additions & 1 deletion es/tx/builder/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* @export TxSchema
* @example import TxSchema from '@aeternity/aepp-sdk/es/tx/builder/schema'
*/
/* eslint-disable no-unused-vars */
// # RLP version number
// # https://github.com/aeternity/protocol/blob/master/serializations.md#binary-serialization

Expand Down
1 change: 0 additions & 1 deletion es/tx/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ async function channelSnapshotSoloTx ({ channelId, fromId, payload }) {
return tx
}

// eslint-disable-next-line no-unused-vars
async function gaAttachTx ({ ownerId, code, vmVersion, abiVersion, authFun, gas, gasPrice = MIN_GAS_PRICE, callData, backend }) {
// Get VM_ABI version
const ctVersion = this.getVmVersion(TX_TYPE.contractCreate, R.head(arguments))
Expand Down
3 changes: 1 addition & 2 deletions es/utils/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ const Ecb = aesjs.ModeOfOperation.ecb
* @return {boolean} True if the string is valid base-64, false otherwise.
*/
export function isBase64 (str) {
// eslint-disable-next-line no-useless-escape
if (str.length % 4 > 0 || str.match(/[^0-9a-z+\/=]/i)) return false
if (str.length % 4 > 0 || str.match(/[^0-9a-z+/=]/i)) return false
const index = str.indexOf('=')
return !!(index === -1 || str.slice(index).match(/={1,2}/))
}
Expand Down
6 changes: 2 additions & 4 deletions es/utils/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function expandPath (path, replacements) {
function lookupType (path, spec, types) {
const type = (() => {
const match = R.path(path, spec).match(/^#\/definitions\/(.+)/)
// eslint-disable-next-line no-void
if (match !== void 0) {
if (match !== undefined) {
return match[1]
} else {
throw Error(`Reference path does not meet specification: ${path}`)
Expand Down Expand Up @@ -342,8 +341,7 @@ function destructureClientError (error) {
*/
function resolveRef (ref, swag) {
const match = ref.match(/^#\/(.+)$/)
// eslint-disable-next-line no-void
if (match !== void 0) {
if (match !== undefined) {
const value = R.path(match[1].split('/'), swag)
if (value != null) {
return value
Expand Down
3 changes: 1 addition & 2 deletions examples/browser/vuejs/connect-two-ae/aepp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const jsLoader = 'babel-loader!standard-loader?error=true'
// https://github.com/FullHuman/purgecss#extractor
class TailwindExtractor {
static extract (content) {
// eslint-disable-next-line no-useless-escape
return content.match(/[A-z0-9-:\/]+/g) || []
return content.match(/[A-z0-9-:/]+/g) || []
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const jsLoader = 'babel-loader!standard-loader?error=true'
// https://github.com/FullHuman/purgecss#extractor
class TailwindExtractor {
static extract (content) {
// eslint-disable-next-line no-useless-escape
return content.match(/[A-z0-9-:\/]+/g) || []
return content.match(/[A-z0-9-:/]+/g) || []
}
}

Expand Down
3 changes: 1 addition & 2 deletions examples/node/aecrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ function generateKeyPair (name, { output }) {
// This function shows how to use a compliant private key to sign an æternity
// transaction and turn it into an RLP-encoded tuple ready for mining
function signTx (tx, privKey) {
// eslint-disable-next-line no-useless-escape
if (!tx.match(/^tx\_.+/)) {
if (!tx.match(/^tx_.+/)) {
throw Error('Not a valid transaction')
}

Expand Down
1 change: 0 additions & 1 deletion test/integration/txVerification.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { before, describe } from 'mocha'
import { configure, ready } from '.'
import { generateKeyPair } from '../../es/utils/crypto'
Expand Down