Skip to content

Commit

Permalink
Merge pull request #5934 from opencollective/dependabot/npm_and_yarn/…
Browse files Browse the repository at this point in the history
…eslint-config-opencollective-3.0.0

chore(deps-dev): bump eslint-config-opencollective from 2.2.0 to 3.0.0
  • Loading branch information
znarf committed Jul 28, 2021
2 parents c066883 + 2502b35 commit 8be8143
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion cron/monthly/host-settlement.ts
Expand Up @@ -78,7 +78,7 @@ export async function run(baseDate: Date | moment.Moment = defaultDate): Promise
const pendingPlatformTips = await getPendingPlatformTips(host, { startDate, endDate });
const pendingHostFeeShare = await getPendingHostFeeShare(host, { startDate, endDate });

if (HOST_ID && host.id != HOST_ID) {
if (HOST_ID && host.id !== parseInt(HOST_ID)) {
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -140,7 +140,7 @@
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.31.0",
"eslint-config-opencollective": "^2.2.0",
"eslint-config-opencollective": "^3.0.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-graphql": "^4.0.0",
"eslint-plugin-import": "^2.23.4",
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-collective-spam-bayes.js
Expand Up @@ -95,7 +95,7 @@ async function run() {
}
}
}
if (collective.type == 'USER') {
if (collective.type === 'USER') {
// Skip Accounts that are administrating account with transactions
const accounts = await collective.getMemberships({ role: 'ADMIN' });
for (const account of accounts) {
Expand All @@ -107,7 +107,7 @@ async function run() {
}
if (!skip) {
report(collective, 'NEW');
if (collective.type == 'USER') {
if (collective.type === 'USER') {
const accounts = await collective.getMemberships({ role: 'ADMIN' });
for (const account of accounts) {
report(account, 'ADMIN FROM');
Expand Down
4 changes: 2 additions & 2 deletions scripts/collective-image-check.js
Expand Up @@ -25,7 +25,7 @@ async function main() {
console.log(e);
continue;
}
if (response.status == 404) {
if (response.status === 404) {
console.log(`Image for ${collective.slug} not found: ${collective.image}`);
try {
await collective.update({ image: null });
Expand All @@ -34,7 +34,7 @@ async function main() {
}
continue;
}
if (response.status == 403) {
if (response.status === 403) {
console.log(`Image for ${collective.slug} access denied: ${collective.image}`);
try {
await collective.update({ image: null });
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixes/refund-stripe-transaction.ts
Expand Up @@ -36,7 +36,7 @@ const refund = async transactionId => {
{ stripeAccount: hostStripeAccount.username },
);

if (refund.status == 'succeeded') {
if (refund.status === 'succeeded') {
await transaction.update({ data: { ...transaction.data, refund } });
console.log('Refunded succeeded!');
} else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/legacy-host-settlement.js
Expand Up @@ -287,7 +287,7 @@ export async function run() {
const byHost = groupBy(pastMonthTransactions, 'HostCollectiveId');

for (const [hostId, hostTransactions] of entries(byHost)) {
if (HOST_ID && hostId != HOST_ID) {
if (HOST_ID && hostId !== parseInt(HOST_ID)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/paypal/payment-reconciliator.ts
Expand Up @@ -59,7 +59,7 @@ async function* getPaypalPaymentOrdersIterator(host, orderWhere) {
yield orders.shift();
}

if (!nbOrders || nbOrders % limit != 0) {
if (!nbOrders || nbOrders % limit !== 0) {
break;
} else {
offset += nbOrders;
Expand Down
2 changes: 1 addition & 1 deletion scripts/privacy-add-credit-card.js
Expand Up @@ -19,7 +19,7 @@ const run = async (CollectiveId, cardNumber, expireDate, cvv) => {
};

if (!module.parent) {
if (process.argv.length < 4 || process.argv[2] == 'help') {
if (process.argv.length < 4 || process.argv[2] === 'help') {
console.log(
'\nUsage:\n npm run script ./scripts/encrypt.js collectiveId "xxxx xxxx xxxx xxxx" "mm/yyyy" "cvv"\n',
);
Expand Down
2 changes: 1 addition & 1 deletion scripts/privacy-resync-card.js
Expand Up @@ -47,7 +47,7 @@ const run = async cardId => {
};

if (!module.parent) {
if (process.argv.length < 3 || process.argv[2] == 'help') {
if (process.argv.length < 3 || process.argv[2] === 'help') {
console.log('\nUsage:\n npm run script ./scripts/privacy-resync-card.js cardId\n');
process.exit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-hosts-2020-12-15.js
Expand Up @@ -30,7 +30,7 @@ async function run({ dryRun } = {}) {
}
}

if (host.platformFeePercent != 0) {
if (host.platformFeePercent !== 0) {
console.log(`- Activating Platform Tips`);
if (!dryRun) {
await host.update({ platformFeePercent: 0 });
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-hosts-2021-04-30.js
Expand Up @@ -29,7 +29,7 @@ async function run({ dryRun } = {}) {
}
}

if (host.hostFeePercent != 0) {
if (host.hostFeePercent !== 0) {
console.log(`- Updating Plan to grow-plan-2021`);
if (!dryRun) {
await host.update({ plan: 'grow-plan-2021' });
Expand All @@ -41,7 +41,7 @@ async function run({ dryRun } = {}) {
}
}

if (host.platformFeePercent != 0) {
if (host.platformFeePercent !== 0) {
console.log(`- Activating Platform Tips (updating platformFeePercent to 0)`);
if (!dryRun) {
// This will NOT cascade to all Collectives
Expand Down
4 changes: 2 additions & 2 deletions server/graphql/v2/input/AccountReferenceInput.js
Expand Up @@ -75,10 +75,10 @@ export const fetchAccountWithReference = async (
};

let collective;
if (input.id && typeof input.id == 'string') {
if (input.id && typeof input.id === 'string') {
const id = idDecode(input.id, 'account');
collective = await loadCollectiveById(id);
} else if (input.legacyId || typeof input.id == 'number') {
} else if (input.legacyId || typeof input.id === 'number') {
collective = await loadCollectiveById(input.legacyId || input.id);
} else if (input.slug) {
collective = await models.Collective.findOne(
Expand Down
2 changes: 1 addition & 1 deletion server/graphql/v2/object/Expense.js
Expand Up @@ -247,7 +247,7 @@ const Expense = new GraphQLObjectType({
type: GraphQLJSON,
description: 'Drafted field values that were still not persisted',
async resolve(expense) {
if (expense.status == expenseStatus.DRAFT) {
if (expense.status === expenseStatus.DRAFT) {
return pick(expense.data, EXPENSE_DRAFT_PUBLIC_FIELDS);
}
},
Expand Down
2 changes: 1 addition & 1 deletion server/lib/currency.ts
Expand Up @@ -13,7 +13,7 @@ import logger from './logger';
const debug = debugLib('currency');

function getDate(date: string | Date = 'latest') {
if (typeof date == 'string') {
if (typeof date === 'string') {
return date;
} else if (date.getFullYear) {
date.setTime(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
Expand Down
4 changes: 3 additions & 1 deletion server/lib/handlebars.js
Expand Up @@ -15,10 +15,12 @@ import {
handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
switch (operator) {
case '==':
// eslint-disable-next-line eqeqeq
return v1 == v2 ? options.fn(this) : options.inverse(this);
case '===':
return v1 === v2 ? options.fn(this) : options.inverse(this);
case '!=':
// eslint-disable-next-line eqeqeq
return v1 != v2 ? options.fn(this) : options.inverse(this);
case '!==':
return v1 !== v2 ? options.fn(this) : options.inverse(this);
Expand Down Expand Up @@ -128,7 +130,7 @@ handlebars.registerHelper('currency', (value, props) => {
res = `+${res}`;
}
// If we are limited in space, no need to show the trailing .00
if (size && precision == 2) {
if (size && precision === 2) {
res = res.replace(/\.00$/, '');
}
if (size) {
Expand Down
2 changes: 1 addition & 1 deletion server/lib/host-metrics.js
Expand Up @@ -7,7 +7,7 @@ import { getFxRate } from './currency';
import { parseToBoolean } from './utils';

function oppositeTotal(total) {
return total != 0 ? -total : total;
return total !== 0 ? -total : total;
}

async function computeTotal(results, currency) {
Expand Down
2 changes: 1 addition & 1 deletion server/lib/prepaid-budget.js
Expand Up @@ -5,7 +5,7 @@ import { TransactionKind } from '../constants/transaction-kind';
import models from '../models';

export function isPrepaidBudgetOrder(order) {
return order.tier && order.tier.slug == 'prepaid-budget' && order.collective.slug === 'opensource';
return order.tier && order.tier.slug === 'prepaid-budget' && order.collective.slug === 'opensource';
}

export async function createPrepaidPaymentMethod(originalCreditTransaction) {
Expand Down
2 changes: 1 addition & 1 deletion server/lib/privacy.ts
Expand Up @@ -64,7 +64,7 @@ export const findCard = async (token: string, cardProperties: Partial<Card>): Pr
while (keepGoing) {
const cards = await listCards(token, undefined, { page, page_size: 500 });
debug(`got page ${page} with ${cards.length} cards...`);
if (cards.length == 0) {
if (cards.length === 0) {
return undefined;
}
const card = find(cards, cardProperties);
Expand Down
2 changes: 1 addition & 1 deletion server/lib/utils.js
Expand Up @@ -52,7 +52,7 @@ export function getDomain(url = '') {
if (arrLen > 2) {
domain = `${splitArr[arrLen - 2]}.${splitArr[arrLen - 1]}`;
// check to see if it's using a Country Code Top Level Domain (ccTLD) (i.e. ".me.uk")
if (splitArr[arrLen - 1].length == 2 && splitArr[arrLen - 1].length == 2) {
if (splitArr[arrLen - 1].length === 2 && splitArr[arrLen - 1].length === 2) {
// this is using a ccTLD
domain = `${splitArr[arrLen - 3]}.${domain}`;
}
Expand Down
2 changes: 1 addition & 1 deletion server/middleware/authentication.js
Expand Up @@ -188,7 +188,7 @@ export const authenticateService = (req, res, next) => {
const opts = { callbackURL: getOAuthCallbackUrl(req) };

if (service === 'github') {
if (context == 'createCollective') {
if (context === 'createCollective') {
opts.scope = [
// We need this to call github.getOrgMemberships and check if the user is an admin of a given Organization
'read:org',
Expand Down
2 changes: 1 addition & 1 deletion server/models/Collective.js
Expand Up @@ -2054,7 +2054,7 @@ function defineModel() {
*/
Collective.prototype.changeHost = async function (newHostCollectiveId, remoteUser, options) {
// Skip
if (this.HostCollectiveId == newHostCollectiveId) {
if (this.HostCollectiveId === newHostCollectiveId) {
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions server/paymentProviders/opencollective/giftcard.js
Expand Up @@ -56,7 +56,7 @@ async function getBalance(paymentMethod) {
});
let spent = 0;
for (const transaction of allTransactions) {
if (transaction.currency != paymentMethod.currency) {
if (transaction.currency !== paymentMethod.currency) {
const fxRate = await currency.getFxRate(transaction.currency, paymentMethod.currency);
spent += transaction.netAmountInCollectiveCurrency * fxRate;
} else {
Expand Down Expand Up @@ -89,7 +89,7 @@ async function processOrder(order) {
}
// converting(or keeping if it's the same currency) order amount to the payment method currency
let orderAmountInPaymentMethodCurrency = order.totalAmount;
if (order.currency != paymentMethod.currency) {
if (order.currency !== paymentMethod.currency) {
const fxRate = await currency.getFxRate(order.currency, paymentMethod.currency);
orderAmountInPaymentMethodCurrency = order.totalAmount * fxRate;
}
Expand Down
2 changes: 1 addition & 1 deletion server/paymentProviders/opencollective/prepaid.js
Expand Up @@ -47,7 +47,7 @@ async function getBalance(paymentMethod) {
});
let spent = 0;
for (const transaction of allTransactions) {
if (transaction.currency != paymentMethod.currency) {
if (transaction.currency !== paymentMethod.currency) {
const fxRate = await getFxRate(transaction.currency, paymentMethod.currency);
spent += transaction.netAmountInCollectiveCurrency * fxRate;
} else {
Expand Down
4 changes: 2 additions & 2 deletions server/paymentProviders/privacy/index.ts
Expand Up @@ -278,9 +278,9 @@ const autoPauseResumeCard = async (virtualCard: VirtualCardModel) => {
const pendingExpenses = await virtualCard.getExpensesMissingDetails();
const hasPendingExpenses = !isEmpty(pendingExpenses);

if (hasPendingExpenses && virtualCard.data.state == 'OPEN') {
if (hasPendingExpenses && virtualCard.data.state === 'OPEN') {
await pauseCard(virtualCard);
} else if (!hasPendingExpenses && virtualCard.data.state == 'PAUSED') {
} else if (!hasPendingExpenses && virtualCard.data.state === 'PAUSED') {
await resumeCard(virtualCard);
}
};
Expand Down
6 changes: 3 additions & 3 deletions test/cron/monthly/host-settlement.test.js
Expand Up @@ -167,12 +167,12 @@ describe('cron/monthly/host-settlement', () => {
});

it('should invoice platform tips not collected through Stripe', async () => {
const platformTipsItem = expense.items.find(p => p.description == 'Platform Tips');
const platformTipsItem = expense.items.find(p => p.description === 'Platform Tips');
expect(platformTipsItem).to.have.property('amount', Math.round(1000 / 1.23));
});

it('should invoice pending shared host revenue', async () => {
const sharedRevenueItem = expense.items.find(p => p.description == 'Shared Revenue');
const sharedRevenueItem = expense.items.find(p => p.description === 'Shared Revenue');
expect(sharedRevenueItem).to.have.property('amount', Math.round(1600 * 0.15));
});

Expand All @@ -182,7 +182,7 @@ describe('cron/monthly/host-settlement', () => {
});

it('should consider fixed fee per host collective', async () => {
const reimburseItem = expense.items.find(p => p.description == 'Fixed Fee per Hosted Collective');
const reimburseItem = expense.items.find(p => p.description === 'Fixed Fee per Hosted Collective');
expect(reimburseItem).to.have.property('amount', 100);
});

Expand Down
2 changes: 1 addition & 1 deletion test/server/graphql/v1/createOrder.test.js
Expand Up @@ -289,7 +289,7 @@ describe('server/graphql/v1/createOrder', () => {
where: { OrderId: res.data.createOrder.id },
});
expect(transactionsCount).to.equal(0);
await utils.waitForCondition(() => emailSendMessageSpy.callCount == 2);
await utils.waitForCondition(() => emailSendMessageSpy.callCount === 2);
expect(emailSendMessageSpy.callCount).to.equal(2);

const pendingEmailArgs = emailSendMessageSpy.args.find(callArgs =>
Expand Down
2 changes: 1 addition & 1 deletion test/server/graphql/v2/mutation/GuestMutations.test.ts
Expand Up @@ -83,7 +83,7 @@ describe('server/graphql/v2/mutation/GuestMutations', () => {
expect(result.data.sendGuestConfirmationEmail).to.be.true;
console.log(result);

await waitForCondition(() => emailSendMessageSpy.callCount == 1);
await waitForCondition(() => emailSendMessageSpy.callCount === 1);
expect(emailSendMessageSpy.callCount).to.equal(1);

const [recipient, subject, body] = emailSendMessageSpy.args[0];
Expand Down
2 changes: 1 addition & 1 deletion test/server/paymentProviders/stripe/alipay.test.ts
Expand Up @@ -101,7 +101,7 @@ describe('server/paymentProviders/stripe/alipay', () => {

expect(transactions).to.be.an('array').of.length(4);

const credit = transactions.find(t => t.type == 'CREDIT' && t.kind === 'CONTRIBUTION');
const credit = transactions.find(t => t.type === 'CREDIT' && t.kind === 'CONTRIBUTION');
expect(credit).to.have.property('amount', 10000);
expect(credit).to.have.property('currency', 'USD');
expect(credit).to.have.property('OrderId', order.id);
Expand Down

0 comments on commit 8be8143

Please sign in to comment.