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