1
0
mirror of https://github.com/bitwarden/web synced 2026-01-07 02:53:15 +00:00

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

This commit is contained in:
Matt Gibson
2021-02-03 11:41:33 -06:00
committed by GitHub
parent 5010736ca3
commit 2e7b88f149
68 changed files with 161 additions and 157 deletions

View File

@@ -41,7 +41,7 @@ export class AdjustPaymentComponent {
async submit() {
try {
const request = new PaymentRequest();
this.formPromise = this.paymentComponent.createPaymentToken().then((result) => {
this.formPromise = this.paymentComponent.createPaymentToken().then(result => {
request.paymentToken = result[0];
request.paymentMethodType = result[1];
request.postalCode = this.taxInfoComponent.taxInfo.postalCode;

View File

@@ -20,7 +20,7 @@ export class CreateOrganizationComponent implements OnInit {
constructor(private route: ActivatedRoute) { }
ngOnInit() {
const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => {
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
if (qParams.plan === 'families') {
this.orgPlansComponent.plan = PlanType.FamiliesAnnually;
this.orgPlansComponent.product = ProductType.Families;

View File

@@ -28,10 +28,10 @@ export class DomainRulesComponent implements OnInit {
const response = await this.apiService.getSettingsDomains();
this.loading = false;
if (response.equivalentDomains != null) {
this.custom = response.equivalentDomains.map((d) => d.join(', '));
this.custom = response.equivalentDomains.map(d => d.join(', '));
}
if (response.globalEquivalentDomains != null) {
this.global = response.globalEquivalentDomains.map((d) => {
this.global = response.globalEquivalentDomains.map(d => {
return {
domains: d.domains.join(', '),
excluded: d.excluded,
@@ -60,13 +60,13 @@ export class DomainRulesComponent implements OnInit {
async submit() {
const request = new UpdateDomainsRequest();
request.excludedGlobalEquivalentDomains = this.global.filter((d) => d.excluded)
.map((d) => d.key);
request.excludedGlobalEquivalentDomains = this.global.filter(d => d.excluded)
.map(d => d.key);
if (request.excludedGlobalEquivalentDomains.length === 0) {
request.excludedGlobalEquivalentDomains = null;
}
request.equivalentDomains = this.custom.filter((d) => d != null && d.trim() !== '')
.map((d) => d.split(',').map((d2) => d2.trim()));
request.equivalentDomains = this.custom.filter(d => d != null && d.trim() !== '')
.map(d => d.split(',').map(d2 => d2.trim()));
if (request.equivalentDomains.length === 0) {
request.equivalentDomains = null;
}

View File

@@ -39,7 +39,7 @@ export class EmergencyAccessViewComponent implements OnInit {
private route: ActivatedRoute, private apiService: ApiService) { }
ngOnInit() {
this.route.params.subscribe((qParams) => {
this.route.params.subscribe(qParams => {
if (qParams.id == null) {
return this.router.navigate(['settings/emergency-access']);
}
@@ -98,10 +98,10 @@ export class EmergencyAccessViewComponent implements OnInit {
const oldEncKey = new SymmetricCryptoKey(oldKeyBuffer);
const promises: any[] = [];
ciphers.forEach((cipherResponse) => {
ciphers.forEach(cipherResponse => {
const cipherData = new CipherData(cipherResponse);
const cipher = new Cipher(cipherData);
promises.push(cipher.decrypt(oldEncKey).then((c) => decCiphers.push(c)));
promises.push(cipher.decrypt(oldEncKey).then(c => decCiphers.push(c)));
});
await Promise.all(promises);

View File

@@ -51,7 +51,7 @@ export class OptionsComponent implements OnInit {
}
const localeOptions: any[] = [];
i18nService.supportedTranslationLocales.forEach((locale) => {
i18nService.supportedTranslationLocales.forEach(locale => {
let name = locale;
if (i18nService.localeNames.has(locale)) {
name += (' - ' + i18nService.localeNames.get(locale));

View File

@@ -86,7 +86,7 @@ export class OrganizationPlansComponent implements OnInit {
}
get selectedPlan() {
return this.plans.find((plan) => plan.type === this.plan);
return this.plans.find(plan => plan.type === this.plan);
}
get selectedPlanInterval() {
@@ -96,18 +96,18 @@ export class OrganizationPlansComponent implements OnInit {
}
get selectableProducts() {
let validPlans = this.plans.filter((plan) => plan.type !== PlanType.Custom);
let validPlans = this.plans.filter(plan => plan.type !== PlanType.Custom);
if (this.ownedBusiness) {
validPlans = validPlans.filter((plan) => plan.canBeUsedByBusiness);
validPlans = validPlans.filter(plan => plan.canBeUsedByBusiness);
}
if (!this.showFree) {
validPlans = validPlans.filter((plan) => plan.product !== ProductType.Free);
validPlans = validPlans.filter(plan => plan.product !== ProductType.Free);
}
validPlans = validPlans
.filter((plan) => !plan.legacyYear
.filter(plan => !plan.legacyYear
&& !plan.disabled
&& (plan.isAnnual || plan.product === this.productTypes.Free));
@@ -115,7 +115,7 @@ export class OrganizationPlansComponent implements OnInit {
}
get selectablePlans() {
return this.plans.filter((plan) => !plan.legacyYear && !plan.disabled && plan.product === this.product);
return this.plans.filter(plan => !plan.legacyYear && !plan.disabled && plan.product === this.product);
}
additionalStoragePriceMonthly(selectedPlan: PlanResponse) {

View File

@@ -92,7 +92,7 @@ export class PaymentComponent implements OnInit {
ngOnDestroy() {
window.document.head.removeChild(this.stripeScript);
window.setTimeout(() => {
Array.from(window.document.querySelectorAll('iframe')).forEach((el) => {
Array.from(window.document.querySelectorAll('iframe')).forEach(el => {
if (el.src != null && el.src.indexOf('stripe') > -1) {
try {
window.document.body.removeChild(el);
@@ -103,7 +103,7 @@ export class PaymentComponent implements OnInit {
if (!this.hidePaypal) {
window.document.head.removeChild(this.btScript);
window.setTimeout(() => {
Array.from(window.document.head.querySelectorAll('script')).forEach((el) => {
Array.from(window.document.head.querySelectorAll('script')).forEach(el => {
if (el.src != null && el.src.indexOf('paypal') > -1) {
try {
window.document.head.removeChild(el);
@@ -165,7 +165,7 @@ export class PaymentComponent implements OnInit {
});
} else if (this.method === PaymentMethodType.Card || this.method === PaymentMethodType.BankAccount) {
if (this.method === PaymentMethodType.Card) {
this.apiService.postSetupPayment().then((clientSecret) =>
this.apiService.postSetupPayment().then(clientSecret =>
this.stripe.handleCardSetup(clientSecret, this.stripeCardNumberElement))
.then((result: any) => {
if (result.error) {

View File

@@ -78,7 +78,7 @@ export class PremiumComponent implements OnInit {
return this.finalizePremium();
});
} else {
this.formPromise = this.paymentComponent.createPaymentToken().then((result) => {
this.formPromise = this.paymentComponent.createPaymentToken().then(result => {
const fd = new FormData();
fd.append('paymentMethodType', result[1].toString());
if (result[0] != null) {
@@ -88,7 +88,7 @@ export class PremiumComponent implements OnInit {
fd.append('country', this.taxInfoComponent.taxInfo.country);
fd.append('postalCode', this.taxInfoComponent.taxInfo.postalCode);
return this.apiService.postPremium(fd);
}).then((paymentResponse) => {
}).then(paymentResponse => {
if (!paymentResponse.success && paymentResponse.paymentIntentClientSecret != null) {
return this.paymentComponent.handleStripeCardPayment(paymentResponse.paymentIntentClientSecret,
() => this.finalizePremium());

View File

@@ -45,7 +45,7 @@ export class TaxInfoComponent {
constructor(private apiService: ApiService, private route: ActivatedRoute) { }
async ngOnInit() {
this.route.parent.parent.params.subscribe(async (params) => {
this.route.parent.parent.params.subscribe(async params => {
this.organizationId = params.organizationId;
if (this.organizationId) {
try {
@@ -118,7 +118,7 @@ export class TaxInfoComponent {
submitTaxInfo(): Promise<any> {
if (!this.hasChanged()) {
return new Promise((resolve) => { resolve(); });
return new Promise(resolve => { resolve(); });
}
const request = this.getTaxInfoRequest();
return this.organizationId ? this.apiService.putOrganizationTaxInfo(this.organizationId,

View File

@@ -80,8 +80,8 @@ export class TwoFactorSetupComponent implements OnInit {
async load() {
this.loading = true;
const providerList = await this.getTwoFactorProviders();
providerList.data.forEach((p) => {
this.providers.forEach((p2) => {
providerList.data.forEach(p => {
this.providers.forEach(p2 => {
if (p.type === p2.type) {
p2.enabled = p.enabled;
}
@@ -166,7 +166,7 @@ export class TwoFactorSetupComponent implements OnInit {
if (!enabled && this.modal != null) {
this.modal.close();
}
this.providers.forEach((p) => {
this.providers.forEach(p => {
if (p.type === type) {
p.enabled = enabled;
}
@@ -175,9 +175,9 @@ export class TwoFactorSetupComponent implements OnInit {
}
private async evaluatePolicies() {
if (this.organizationId == null && this.providers.filter((p) => p.enabled).length === 1) {
if (this.organizationId == null && this.providers.filter(p => p.enabled).length === 1) {
const policies = await this.policyService.getAll(PolicyType.TwoFactorAuthentication);
this.showPolicyWarning = policies != null && policies.some((p) => p.enabled);
this.showPolicyWarning = policies != null && policies.some(p => p.enabled);
} else {
this.showPolicyWarning = false;
}

View File

@@ -156,7 +156,7 @@ export class TwoFactorU2fComponent extends TwoFactorBaseComponent implements OnI
this.keysConfiguredCount = 0;
for (let i = 1; i <= 5; i++) {
if (response.keys != null) {
const key = response.keys.filter((k) => k.id === i);
const key = response.keys.filter(k => k.id === i);
if (key.length > 0) {
this.keysConfiguredCount++;
this.keys.push({

View File

@@ -47,7 +47,7 @@ export class UpdateKeyComponent {
}
try {
this.formPromise = this.makeRequest().then((request) => {
this.formPromise = this.makeRequest().then(request => {
return this.apiService.postAccountKey(request);
});
await this.formPromise;