1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-06 10:33:57 +00:00

Fix glob processing in npm. Ban single param parens (#257)

This commit is contained in:
Matt Gibson
2021-02-04 09:49:23 -06:00
committed by GitHub
parent a16d8f7de7
commit 58f40b0085
98 changed files with 275 additions and 271 deletions

View File

@@ -160,7 +160,7 @@ Notes:",nomonth,,0`,
];
describe('Lastpass CSV Importer', () => {
CipherData.forEach((data) => {
CipherData.forEach(data => {
it(data.title, async () => {
const importer = new Importer();
const result = await importer.parse(data.csv);

View File

@@ -84,12 +84,12 @@ describe('sequentialize decorator', () => {
const allRes: number[] = [];
await Promise.all([
foo.bar(1).then((res) => allRes.push(res)),
foo.bar(1).then((res) => allRes.push(res)),
foo.bar(2).then((res) => allRes.push(res)),
foo.bar(2).then((res) => allRes.push(res)),
foo.bar(3).then((res) => allRes.push(res)),
foo.bar(3).then((res) => allRes.push(res)),
foo.bar(1).then(res => allRes.push(res)),
foo.bar(1).then(res => allRes.push(res)),
foo.bar(2).then(res => allRes.push(res)),
foo.bar(2).then(res => allRes.push(res)),
foo.bar(3).then(res => allRes.push(res)),
foo.bar(3).then(res => allRes.push(res)),
]);
expect(foo.calls).toBe(3);
expect(allRes.length).toBe(6);
@@ -102,12 +102,12 @@ describe('sequentialize decorator', () => {
const allRes: number[] = [];
await Promise.all([
foo.baz(1).then((res) => allRes.push(res)),
foo.baz(1).then((res) => allRes.push(res)),
foo.baz(2).then((res) => allRes.push(res)),
foo.baz(2).then((res) => allRes.push(res)),
foo.baz(3).then((res) => allRes.push(res)),
foo.baz(3).then((res) => allRes.push(res)),
foo.baz(1).then(res => allRes.push(res)),
foo.baz(1).then(res => allRes.push(res)),
foo.baz(2).then(res => allRes.push(res)),
foo.baz(2).then(res => allRes.push(res)),
foo.baz(3).then(res => allRes.push(res)),
foo.baz(3).then(res => allRes.push(res)),
]);
expect(foo.calls).toBe(3);
expect(allRes.length).toBe(6);
@@ -119,20 +119,20 @@ describe('sequentialize decorator', () => {
class Foo {
calls = 0;
@sequentialize((args) => 'bar' + args[0])
@sequentialize(args => 'bar' + args[0])
bar(a: number): Promise<number> {
this.calls++;
return new Promise((res) => {
return new Promise(res => {
setTimeout(() => {
res(a * 2);
}, Math.random() * 100);
});
}
@sequentialize((args) => 'baz' + args[0])
@sequentialize(args => 'baz' + args[0])
baz(a: number): Promise<number> {
this.calls++;
return new Promise((res) => {
return new Promise(res => {
setTimeout(() => {
res(a * 3);
}, Math.random() * 100);

View File

@@ -72,7 +72,7 @@ class Foo {
bar(a: number) {
this.calls++;
this.inflight++;
return new Promise((res) => {
return new Promise(res => {
setTimeout(() => {
expect(this.inflight).toBe(1);
this.inflight--;
@@ -85,7 +85,7 @@ class Foo {
baz(a: number) {
this.calls++;
this.inflight++;
return new Promise((res) => {
return new Promise(res => {
setTimeout(() => {
expect(this.inflight).toBeLessThanOrEqual(5);
this.inflight--;
@@ -94,12 +94,12 @@ class Foo {
});
}
@sequentialize((args) => 'qux' + args[0])
@sequentialize(args => 'qux' + args[0])
@throttle(1, () => 'qux')
qux(a: number) {
this.calls++;
this.inflight++;
return new Promise((res) => {
return new Promise(res => {
setTimeout(() => {
expect(this.inflight).toBe(1);
this.inflight--;

View File

@@ -40,7 +40,7 @@ describe('ConsoleLogService', () => {
});
it('filters messages below the set threshold', () => {
logService = new ConsoleLogService(true, (level) => true);
logService = new ConsoleLogService(true, level => true);
logService.debug('debug');
logService.info('info');
logService.warning('warning');
@@ -86,7 +86,7 @@ describe('ConsoleLogService', () => {
});
it('filters time output', async () => {
logService = new ConsoleLogService(true, (level) => true);
logService = new ConsoleLogService(true, level => true);
logService.time();
logService.timeEnd();

View File

@@ -1,5 +1,5 @@
function newGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
// tslint:disable:no-bitwise
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);

View File

@@ -468,8 +468,8 @@ function testRsaGenerateKeyPair(length: 1024 | 2048 | 4096) {
function getWebCryptoFunctionService() {
const platformUtilsMock = TypeMoq.Mock.ofType<PlatformUtilsService>(PlatformUtilsServiceMock);
platformUtilsMock.setup((x) => x.isEdge()).returns(() => navigator.userAgent.indexOf(' Edg/') !== -1);
platformUtilsMock.setup((x) => x.isIE()).returns(() => navigator.userAgent.indexOf(' Edg/') === -1 &&
platformUtilsMock.setup(x => x.isEdge()).returns(() => navigator.userAgent.indexOf(' Edg/') !== -1);
platformUtilsMock.setup(x => x.isIE()).returns(() => navigator.userAgent.indexOf(' Edg/') === -1 &&
navigator.userAgent.indexOf(' Trident/') !== -1);
return new WebCryptoFunctionService(window, platformUtilsMock.object);
}