Skip to content

Commit

Permalink
Enable noDoubleEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Jan 10, 2025
1 parent 7d8c081 commit 343c239
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 26 deletions.
1 change: 0 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"noConfusingVoidType": "off",
"noShadowRestrictedNames": "off",

"noDoubleEquals": "off",
"noGlobalIsNan": "off"
}
}
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/CardWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export const CardWizard = ({

const card = input.cards[0];

if (input.cards.length === 1 && card != undefined) {
if (input.cards.length === 1 && card != null) {
return addSingleUseCard({
input: {
name: card.name,
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/CardWizardDelivery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const CardWizardDelivery = forwardRef<CardWizardDeliveryRef, Props>(
<Box alignItems="center">
<Icon
color={
currentDeliveryMode == cardDeliveryMode ? colors.swan[300] : colors.swan[200]
currentDeliveryMode === cardDeliveryMode ? colors.swan[300] : colors.swan[200]
}
size={148}
name={match(cardDeliveryMode)
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/CardWizardSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export const CardWizardSettings = forwardRef<CardWizardSettingsRef, Props>(
<Box alignItems="center">
<Icon
color={
currentSettings.spendingLimit.period == period
currentSettings.spendingLimit.period === period
? colors.swan[300]
: colors.swan[200]
}
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/ErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props = {

export const ErrorView = ({ error, style }: Props) => {
const [requestId] = useState<Option<string>>(() => {
if (error == undefined) {
if (error == null) {
return Option.None();
}
return Array.findMap(ClientError.toArray(error), error =>
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/MerchantProfileEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const MerchantProfileEditor = forwardRef<MerchantProfileEditorRef, Props>
accentColor,
}) => {
const base64Logo =
merchantLogoUrl == undefined
merchantLogoUrl == null
? Future.value(Option.None<string>())
: Future.make<Option<string>>(resolve => {
const reader = new FileReader();
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/TransferBulkUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const parseCsv = (text: string): Result<CreditTransferInput[], ParsingError[]> =
}
if (
reference != null &&
reference.trim() != "" &&
reference.trim() !== "" &&
validateTransferReference(reference.trim()) != null
) {
return Result.Error({ type: "InvalidReference", line: index + 1 } as const);
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/utils/projectId.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Option, Result } from "@swan-io/boxed";

export const projectConfiguration = Result.fromExecution(() => {
if (typeof __env.SWAN_PROJECT_ID == "string") {
if (typeof __env.SWAN_PROJECT_ID === "string") {
return __env.SWAN_PROJECT_ID;
} else {
throw new Error();
Expand Down
2 changes: 1 addition & 1 deletion clients/onboarding/src/components/ErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props = {

export const ErrorView = ({ error, style }: Props) => {
const [requestId] = useState<Option<string>>(() => {
if (error == undefined) {
if (error == null) {
return Option.None();
}
return Array.findMap(ClientError.toArray(error), error =>
Expand Down
2 changes: 1 addition & 1 deletion clients/onboarding/src/utils/projectId.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Option, Result } from "@swan-io/boxed";

export const projectConfiguration = Result.fromExecution(() => {
if (typeof __env.SWAN_PROJECT_ID == "string") {
if (typeof __env.SWAN_PROJECT_ID === "string") {
return __env.SWAN_PROJECT_ID;
} else {
throw new Error();
Expand Down
2 changes: 1 addition & 1 deletion clients/onboarding/src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { locale, t } from "./i18n";

export const validateRequiredBoolean: Validator<boolean | undefined> = value => {
if (typeof value != "boolean") {
if (typeof value !== "boolean") {
return t("error.requiredField");
}
};
Expand Down
2 changes: 1 addition & 1 deletion clients/payment/src/components/ErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props = {

export const ErrorView = ({ error, style }: Props) => {
const [requestId] = useState<Option<string>>(() => {
if (error == undefined) {
if (error == null) {
return Option.None();
}
return Array.findMap(ClientError.toArray(error), error =>
Expand Down
2 changes: 1 addition & 1 deletion clients/payment/src/utils/projectId.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Option, Result } from "@swan-io/boxed";

export const projectConfiguration = Result.fromExecution(() => {
if (typeof __env.SWAN_PROJECT_ID == "string") {
if (typeof __env.SWAN_PROJECT_ID === "string") {
return __env.SWAN_PROJECT_ID;
} else {
throw new Error();
Expand Down
2 changes: 1 addition & 1 deletion server/src/api/oauth2.swan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const exchangeToken = (originalAccessToken: string, config: ExchangeToken
),
headers: {
"Content-Type": "application/json",
...(additionalEnv.SWAN_AUTH_TOKEN != undefined
...(additionalEnv.SWAN_AUTH_TOKEN != null
? { "x-swan-frontend": additionalEnv.SWAN_AUTH_TOKEN }
: undefined),
},
Expand Down
2 changes: 1 addition & 1 deletion server/src/api/partner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let projectId: Future<
>;

export const getProjectId = () => {
if (projectId != undefined) {
if (projectId != null) {
return projectId;
}
projectId = getClientAccessToken()
Expand Down
16 changes: 8 additions & 8 deletions server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const start = async ({
const refreshToken = request.session.get("refreshToken");
const expiresAt = request.session.get("expiresAt") ?? 0;

if (typeof refreshToken == "string" && expiresAt < Date.now() + TEN_SECONDS) {
if (typeof refreshToken === "string" && expiresAt < Date.now() + TEN_SECONDS) {
refreshAccessToken({
refreshToken,
redirectUri: `${env.BANKING_URL}/auth/callback`,
Expand Down Expand Up @@ -349,7 +349,7 @@ export const start = async ({
return reply.from(env.PARTNER_API_URL, {
rewriteRequestHeaders: (_req, headers) => ({
...headers,
...(request.accessToken != undefined
...(request.accessToken != null
? { Authorization: `Bearer ${request.accessToken}` }
: undefined),
}),
Expand All @@ -363,7 +363,7 @@ export const start = async ({
return reply.from(env.PARTNER_ADMIN_API_URL, {
rewriteRequestHeaders: (_req, headers) => ({
...headers,
...(request.accessToken != undefined
...(request.accessToken != null
? { Authorization: `Bearer ${request.accessToken}` }
: undefined),
}),
Expand Down Expand Up @@ -561,7 +561,7 @@ export const start = async ({

return reply.redirect(
createAuthUrl({
scope: scope.split(" ").filter(item => item != null && item != ""),
scope: scope.split(" ").filter(item => item != null && item !== ""),
params: {
...(email != null ? { email } : null),
...(onboardingId != null ? { onboardingId } : null),
Expand Down Expand Up @@ -639,7 +639,7 @@ export const start = async ({
Ok: ({ redirectUrl, state, accountMembershipId, oAuthClientId }) => {
const queryString = new URLSearchParams();

if (redirectUrl != undefined) {
if (redirectUrl != null) {
const redirectHost = new URL(redirectUrl).hostname;

// When onboarding from the dashboard, we don't yet have a OAuth2 client,
Expand All @@ -659,7 +659,7 @@ export const start = async ({
}
}

if (accountMembershipId != undefined) {
if (accountMembershipId != null) {
queryString.append("accountMembershipId", accountMembershipId);
}

Expand Down Expand Up @@ -689,7 +689,7 @@ export const start = async ({
Ok: ({ redirectUrl, state, accountMembershipId }) => {
const queryString = new URLSearchParams();

if (redirectUrl != undefined) {
if (redirectUrl != null) {
const authUri = createAuthUrl({
scope: [],
redirectUri: redirectUrl,
Expand All @@ -700,7 +700,7 @@ export const start = async ({
queryString.append("redirectUrl", authUri);
}

if (accountMembershipId != undefined) {
if (accountMembershipId != null) {
queryString.append("accountMembershipId", accountMembershipId);
}

Expand Down
6 changes: 3 additions & 3 deletions server/src/index.swan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ start({
app.post<{ Params: { projectId: string } }>(
"/api/projects/:projectId/partner",
async (request, reply) => {
if (request.accessToken == undefined) {
if (request.accessToken == null) {
return reply.status(401).send("Unauthorized");
}
const projectUserToken = await exchangeToken(request.accessToken, {
Expand All @@ -224,7 +224,7 @@ start({
app.post<{ Params: { projectId: string } }>(
"/api/projects/:projectId/partner-admin",
async (request, reply) => {
if (request.accessToken == undefined) {
if (request.accessToken == null) {
return reply.status(401).send("Unauthorized");
}
const projectUserToken = await exchangeToken(request.accessToken, {
Expand Down Expand Up @@ -261,7 +261,7 @@ start({
if (inviterAccountMembershipId == null) {
return reply.status(400).send("Missing inviterAccountMembershipId");
}
if (request.accessToken == undefined) {
if (request.accessToken == null) {
return reply.status(401).send("Unauthorized");
}
try {
Expand Down

0 comments on commit 343c239

Please sign in to comment.