Style fixes and new style rules for eslint (#919)

This commit is contained in:
Ilya Chesnokov 2019-06-28 15:33:19 +02:00 committed by Daniel Huigens
parent 1bd5689d75
commit 6d626ea70c
12 changed files with 63 additions and 57 deletions

View File

@ -244,7 +244,7 @@ module.exports = {
"no-with": "error",
"nonblock-statement-body-position": "error",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-curly-spacing": "error",
"object-property-newline": [
"error",
{
@ -314,6 +314,7 @@ module.exports = {
"error",
"never"
],
"indent": [ "error", 2, { "SwitchCase": 1 } ],
// Custom silencers:
"camelcase": 0,
@ -335,7 +336,6 @@ module.exports = {
"no-unused-vars": 1,
// TODO Consider fixing these:
"indent": [ 0, 2, { "SwitchCase": 1 } ],
"valid-jsdoc": 0,
"new-cap": [ 0, { "properties": false, "capIsNewExceptionPattern": "^type_.*" }],
"no-lonely-if": 0,

View File

@ -84,8 +84,10 @@ export default {
}
break;
}
return { r: r.toArrayLike(Uint8Array),
s: s.toArrayLike(Uint8Array) };
return {
r: r.toArrayLike(Uint8Array),
s: s.toArrayLike(Uint8Array)
};
},
/**

View File

@ -38,8 +38,10 @@ async function sign(oid, hash_algo, m, d, hashed) {
const curve = new Curve(oid);
const key = curve.keyFromPrivate(d);
const signature = await key.sign(m, hash_algo, hashed);
return { r: signature.r.toArrayLike(Uint8Array),
s: signature.s.toArrayLike(Uint8Array) };
return {
r: signature.r.toArrayLike(Uint8Array),
s: signature.s.toArrayLike(Uint8Array)
};
}
/**

View File

@ -65,8 +65,10 @@ export default {
case enums.publicKey.eddsa: {
const oid = pub_MPIs[0];
// EdDSA signature params are expected in little-endian format
const signature = { R: msg_MPIs[0].toUint8Array('le', 32),
S: msg_MPIs[1].toUint8Array('le', 32) };
const signature = {
R: msg_MPIs[0].toUint8Array('le', 32),
S: msg_MPIs[1].toUint8Array('le', 32)
};
const Q = pub_MPIs[1].toUint8Array('be', 33);
return publicKey.elliptic.eddsa.verify(oid, hash_algo, signature, data, Q, hashed);
}

View File

@ -1564,7 +1564,7 @@ async function wrapKeyObject(secretKeyPacket, secretSubkeyPackets, options) {
}
await subkeySignaturePacket.sign(secretKeyPacket, dataToSign);
return { secretSubkeyPacket, subkeySignaturePacket};
return { secretSubkeyPacket, subkeySignaturePacket };
})).then(packets => {
packets.forEach(({ secretSubkeyPacket, subkeySignaturePacket }) => {
packetlist.push(secretSubkeyPacket);

View File

@ -543,7 +543,7 @@ export async function createSignaturePackets(literalDataPacket, privateKeys, sig
throw new Error(`Could not find valid signing key packet in key ${
privateKey.getKeyId().toHex()}`);
}
return createSignaturePacket(literalDataPacket, privateKey, signingKey.keyPacket, {signatureType}, date, userId);
return createSignaturePacket(literalDataPacket, privateKey, signingKey.keyPacket, { signatureType }, date, userId);
})).then(signatureList => {
signatureList.forEach(signaturePacket => packetlist.push(signaturePacket));
});

View File

@ -157,7 +157,7 @@ export function generateKey({ userIds=[], passphrase="", numBits=2048, keyExpira
* @async
* @static
*/
export function reformatKey({privateKey, userIds=[], passphrase="", keyExpirationTime=0, date, revocationCertificate=true}) {
export function reformatKey({ privateKey, userIds=[], passphrase="", keyExpirationTime=0, date, revocationCertificate=true }) {
userIds = toArray(userIds);
const options = { privateKey, userIds, passphrase, keyExpirationTime, date, revocationCertificate };
if (asyncProxy) {

View File

@ -140,7 +140,7 @@ export default {
value.postMessage({ action: 'cancel' });
});
}
}, {highWaterMark: 0});
}, { highWaterMark: 0 });
return;
}
util.restoreStreams(value);