mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
Ban single paren arrow functions (#226)
* Fix glob processing in npm. Ban single param parens * Match typescript linter rules
This commit is contained in:
@@ -101,7 +101,7 @@ export class CompletionCommand {
|
||||
|
||||
if (hasCommands) {
|
||||
commandBlocParts.push(
|
||||
commands.map((c) => this.renderCommandBlock(`${name}_${c._name}`, c)).join('\n\n'),
|
||||
commands.map(c => this.renderCommandBlock(`${name}_${c._name}`, c)).join('\n\n'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ export class CreateCommand {
|
||||
}
|
||||
|
||||
const groups = req.groups == null ? null :
|
||||
req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords));
|
||||
req.groups.map(g => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords));
|
||||
const request = new CollectionRequest();
|
||||
request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString;
|
||||
request.externalId = req.externalId;
|
||||
|
||||
@@ -65,7 +65,7 @@ export class DeleteCommand {
|
||||
return Response.error('No attachments available for this item.');
|
||||
}
|
||||
|
||||
const attachments = cipher.attachments.filter((a) => a.id.toLowerCase() === id);
|
||||
const attachments = cipher.attachments.filter(a => a.id.toLowerCase() === id);
|
||||
if (attachments.length === 0) {
|
||||
return Response.error('Attachment `' + id + '` was not found.');
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ export class EditCommand {
|
||||
}
|
||||
|
||||
const groups = req.groups == null ? null :
|
||||
req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords));
|
||||
req.groups.map(g => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords));
|
||||
const request = new CollectionRequest();
|
||||
request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString;
|
||||
request.externalId = req.externalId;
|
||||
|
||||
@@ -137,7 +137,7 @@ export class GetCommand extends DownloadCommand {
|
||||
}
|
||||
}
|
||||
if (Array.isArray(decCipher)) {
|
||||
return Response.multipleResults(decCipher.map((c) => c.id));
|
||||
return Response.multipleResults(decCipher.map(c => c.id));
|
||||
}
|
||||
}
|
||||
const res = new CipherResponse(decCipher);
|
||||
@@ -146,7 +146,7 @@ export class GetCommand extends DownloadCommand {
|
||||
|
||||
private async getUsername(id: string) {
|
||||
const cipherResponse = await this.getCipher(id,
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.username));
|
||||
c => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.username));
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ export class GetCommand extends DownloadCommand {
|
||||
|
||||
private async getPassword(id: string) {
|
||||
const cipherResponse = await this.getCipher(id,
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.password));
|
||||
c => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.password));
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ export class GetCommand extends DownloadCommand {
|
||||
|
||||
private async getUri(id: string) {
|
||||
const cipherResponse = await this.getCipher(id,
|
||||
(c) => c.type === CipherType.Login && c.login.uris != null && c.login.uris.length > 0 &&
|
||||
c => c.type === CipherType.Login && c.login.uris != null && c.login.uris.length > 0 &&
|
||||
c.login.uris[0].uri !== '');
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
@@ -207,7 +207,7 @@ export class GetCommand extends DownloadCommand {
|
||||
|
||||
private async getTotp(id: string) {
|
||||
const cipherResponse = await this.getCipher(id,
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.totp));
|
||||
c => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.totp));
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
}
|
||||
@@ -266,19 +266,19 @@ export class GetCommand extends DownloadCommand {
|
||||
return Response.error('No attachments available for this item.');
|
||||
}
|
||||
|
||||
let attachments = cipher.attachments.filter((a) => a.id.toLowerCase() === id ||
|
||||
let attachments = cipher.attachments.filter(a => a.id.toLowerCase() === id ||
|
||||
(a.fileName != null && a.fileName.toLowerCase().indexOf(id) > -1));
|
||||
if (attachments.length === 0) {
|
||||
return Response.error('Attachment `' + id + '` was not found.');
|
||||
}
|
||||
|
||||
const exactMatches = attachments.filter((a) => a.fileName.toLowerCase() === id)
|
||||
const exactMatches = attachments.filter(a => a.fileName.toLowerCase() === id);
|
||||
if (exactMatches.length === 1) {
|
||||
attachments = exactMatches;
|
||||
}
|
||||
|
||||
if (attachments.length > 1) {
|
||||
return Response.multipleResults(attachments.map((a) => a.id));
|
||||
return Response.multipleResults(attachments.map(a => a.id));
|
||||
}
|
||||
|
||||
if (!(await this.userService.canAccessPremium())) {
|
||||
@@ -304,7 +304,7 @@ export class GetCommand extends DownloadCommand {
|
||||
let folders = await this.folderService.getAllDecrypted();
|
||||
folders = CliUtils.searchFolders(folders, id);
|
||||
if (folders.length > 1) {
|
||||
return Response.multipleResults(folders.map((f) => f.id));
|
||||
return Response.multipleResults(folders.map(f => f.id));
|
||||
}
|
||||
if (folders.length > 0) {
|
||||
decFolder = folders[0];
|
||||
@@ -329,7 +329,7 @@ export class GetCommand extends DownloadCommand {
|
||||
let collections = await this.collectionService.getAllDecrypted();
|
||||
collections = CliUtils.searchCollections(collections, id);
|
||||
if (collections.length > 1) {
|
||||
return Response.multipleResults(collections.map((c) => c.id));
|
||||
return Response.multipleResults(collections.map(c => c.id));
|
||||
}
|
||||
if (collections.length > 0) {
|
||||
decCollection = collections[0];
|
||||
@@ -364,7 +364,7 @@ export class GetCommand extends DownloadCommand {
|
||||
decCollection.name = await this.cryptoService.decryptToUtf8(
|
||||
new CipherString(response.name), orgKey);
|
||||
const groups = response.groups == null ? null :
|
||||
response.groups.map((g) => new SelectionReadOnly(g.id, g.readOnly, g.hidePasswords));
|
||||
response.groups.map(g => new SelectionReadOnly(g.id, g.readOnly, g.hidePasswords));
|
||||
const res = new OrganizationCollectionResponse(decCollection, groups);
|
||||
return Response.success(res);
|
||||
} catch (e) {
|
||||
@@ -380,7 +380,7 @@ export class GetCommand extends DownloadCommand {
|
||||
let orgs = await this.userService.getAllOrganizations();
|
||||
orgs = CliUtils.searchOrganizations(orgs, id);
|
||||
if (orgs.length > 1) {
|
||||
return Response.multipleResults(orgs.map((c) => c.id));
|
||||
return Response.multipleResults(orgs.map(c => c.id));
|
||||
}
|
||||
if (orgs.length > 0) {
|
||||
org = orgs[0];
|
||||
|
||||
@@ -50,7 +50,7 @@ export class ImportCommand {
|
||||
private async list() {
|
||||
const options = this.importService.getImportOptions().sort((a, b) => {
|
||||
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
||||
}).map((option) => option.id).join('\n');
|
||||
}).map(option => option.id).join('\n');
|
||||
const res = new MessageResponse('Supported input formats:', options);
|
||||
res.raw = options;
|
||||
return Response.success(res);
|
||||
|
||||
@@ -66,7 +66,7 @@ export class ListCommand {
|
||||
}
|
||||
|
||||
if (options.folderid != null || options.collectionid != null || options.organizationid != null) {
|
||||
ciphers = ciphers.filter((c) => {
|
||||
ciphers = ciphers.filter(c => {
|
||||
if (options.trash !== c.isDeleted) {
|
||||
return false;
|
||||
}
|
||||
@@ -105,14 +105,14 @@ export class ListCommand {
|
||||
return false;
|
||||
});
|
||||
} else if (options.search == null || options.search.trim() === '') {
|
||||
ciphers = ciphers.filter((c) => options.trash === c.isDeleted);
|
||||
ciphers = ciphers.filter(c => options.trash === c.isDeleted);
|
||||
}
|
||||
|
||||
if (options.search != null && options.search.trim() !== '') {
|
||||
ciphers = this.searchService.searchCiphersBasic(ciphers, options.search, options.trash);
|
||||
}
|
||||
|
||||
const res = new ListResponse(ciphers.map((o) => new CipherResponse(o)));
|
||||
const res = new ListResponse(ciphers.map(o => new CipherResponse(o)));
|
||||
return Response.success(res);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ export class ListCommand {
|
||||
folders = CliUtils.searchFolders(folders, options.search);
|
||||
}
|
||||
|
||||
const res = new ListResponse(folders.map((o) => new FolderResponse(o)));
|
||||
const res = new ListResponse(folders.map(o => new FolderResponse(o)));
|
||||
return Response.success(res);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export class ListCommand {
|
||||
let collections = await this.collectionService.getAllDecrypted();
|
||||
|
||||
if (options.organizationid != null) {
|
||||
collections = collections.filter((c) => {
|
||||
collections = collections.filter(c => {
|
||||
if (options.organizationid === c.organizationId) {
|
||||
return true;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ export class ListCommand {
|
||||
collections = CliUtils.searchCollections(collections, options.search);
|
||||
}
|
||||
|
||||
const res = new ListResponse(collections.map((o) => new CollectionResponse(o)));
|
||||
const res = new ListResponse(collections.map(o => new CollectionResponse(o)));
|
||||
return Response.success(res);
|
||||
}
|
||||
|
||||
@@ -166,13 +166,13 @@ export class ListCommand {
|
||||
} else {
|
||||
response = await this.apiService.getUserCollections();
|
||||
}
|
||||
const collections = response.data.filter((c) => c.organizationId === options.organizationid).map((r) =>
|
||||
const collections = response.data.filter(c => c.organizationId === options.organizationid).map(r =>
|
||||
new Collection(new CollectionData(r as ApiCollectionDetailsResponse)));
|
||||
let decCollections = await this.collectionService.decryptMany(collections);
|
||||
if (options.search != null && options.search.trim() !== '') {
|
||||
decCollections = CliUtils.searchCollections(decCollections, options.search);
|
||||
}
|
||||
const res = new ListResponse(decCollections.map((o) => new CollectionResponse(o)));
|
||||
const res = new ListResponse(decCollections.map(o => new CollectionResponse(o)));
|
||||
return Response.success(res);
|
||||
} catch (e) {
|
||||
return Response.error(e);
|
||||
@@ -193,7 +193,7 @@ export class ListCommand {
|
||||
|
||||
try {
|
||||
const response = await this.apiService.getOrganizationUsers(options.organizationid);
|
||||
const res = new ListResponse(response.data.map((r) => {
|
||||
const res = new ListResponse(response.data.map(r => {
|
||||
const u = new OrganizationUserResponse();
|
||||
u.email = r.email;
|
||||
u.name = r.name;
|
||||
@@ -216,7 +216,7 @@ export class ListCommand {
|
||||
organizations = CliUtils.searchOrganizations(organizations, options.search);
|
||||
}
|
||||
|
||||
const res = new ListResponse(organizations.map((o) => new OrganizationResponse(o)));
|
||||
const res = new ListResponse(organizations.map(o => new OrganizationResponse(o)));
|
||||
return Response.success(res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export class SendCreateCommand {
|
||||
return Response.badRequest('Must specify a file to Send either with the --file option or in the encoded json');
|
||||
}
|
||||
|
||||
req.file.fileName = path.basename(filePath)
|
||||
req.file.fileName = path.basename(filePath);
|
||||
break;
|
||||
case SendType.Text:
|
||||
if (text == null) {
|
||||
|
||||
Reference in New Issue
Block a user