Add curly: 'error'
to eslintrc and fix linting
This commit is contained in:
parent
c2be9e6f3a
commit
7c0f5a356e
5 changed files with 21 additions and 10 deletions
|
@ -125,6 +125,7 @@ const rules = {
|
|||
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
||||
},
|
||||
],
|
||||
curly: 'error',
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -54,8 +54,9 @@ window.assertEqualArrayBuffers = (ab1, ab2) => {
|
|||
window.hexToArrayBuffer = str => {
|
||||
const ret = new ArrayBuffer(str.length / 2);
|
||||
const array = new Uint8Array(ret);
|
||||
for (let i = 0; i < str.length / 2; i += 1)
|
||||
for (let i = 0; i < str.length / 2; i += 1) {
|
||||
array[i] = parseInt(str.substr(i * 2, 2), 16);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,8 +45,9 @@ const fakeAPI = {
|
|||
msg.timestamp === undefined ||
|
||||
msg.relay !== undefined ||
|
||||
msg.destination !== undefined
|
||||
)
|
||||
) {
|
||||
throw new Error('Invalid message');
|
||||
}
|
||||
|
||||
messagesSentMap[
|
||||
`${destination}.${messageArray[i].destinationDeviceId}`
|
||||
|
|
|
@ -25,21 +25,24 @@ SignalProtocolStore.prototype = {
|
|||
value === undefined ||
|
||||
key === null ||
|
||||
value === null
|
||||
)
|
||||
) {
|
||||
throw new Error('Tried to store undefined/null');
|
||||
}
|
||||
this.store[key] = value;
|
||||
},
|
||||
get(key, defaultValue) {
|
||||
if (key === null || key === undefined)
|
||||
if (key === null || key === undefined) {
|
||||
throw new Error('Tried to get value for undefined/null key');
|
||||
}
|
||||
if (key in this.store) {
|
||||
return this.store[key];
|
||||
}
|
||||
return defaultValue;
|
||||
},
|
||||
remove(key) {
|
||||
if (key === null || key === undefined)
|
||||
if (key === null || key === undefined) {
|
||||
throw new Error('Tried to remove value for undefined/null key');
|
||||
}
|
||||
delete this.store[key];
|
||||
},
|
||||
|
||||
|
@ -57,15 +60,17 @@ SignalProtocolStore.prototype = {
|
|||
return Promise.resolve(identityKey === trusted);
|
||||
},
|
||||
loadIdentityKey(identifier) {
|
||||
if (identifier === null || identifier === undefined)
|
||||
if (identifier === null || identifier === undefined) {
|
||||
throw new Error('Tried to get identity key for undefined/null key');
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
resolve(this.get(`identityKey${identifier}`));
|
||||
});
|
||||
},
|
||||
saveIdentity(identifier, identityKey) {
|
||||
if (identifier === null || identifier === undefined)
|
||||
if (identifier === null || identifier === undefined) {
|
||||
throw new Error('Tried to put identity key for undefined/null key');
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
const existing = this.get(`identityKey${identifier}`);
|
||||
this.put(`identityKey${identifier}`, identityKey);
|
||||
|
|
|
@ -46,13 +46,15 @@ InMemorySignalProtocolStore.prototype = {
|
|||
value === undefined ||
|
||||
key === null ||
|
||||
value === null
|
||||
)
|
||||
) {
|
||||
throw new Error('Tried to store undefined/null');
|
||||
}
|
||||
this.store[key] = value;
|
||||
},
|
||||
get(key, defaultValue) {
|
||||
if (key === null || key === undefined)
|
||||
if (key === null || key === undefined) {
|
||||
throw new Error('Tried to get value for undefined/null key');
|
||||
}
|
||||
if (key in this.store) {
|
||||
return this.store[key];
|
||||
}
|
||||
|
@ -60,8 +62,9 @@ InMemorySignalProtocolStore.prototype = {
|
|||
return defaultValue;
|
||||
},
|
||||
remove(key) {
|
||||
if (key === null || key === undefined)
|
||||
if (key === null || key === undefined) {
|
||||
throw new Error('Tried to remove value for undefined/null key');
|
||||
}
|
||||
delete this.store[key];
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue