Skip to content

Commit

Permalink
chore: use es5 mode for trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrsoares committed Mar 21, 2024
1 parent d76d087 commit bd950c2
Show file tree
Hide file tree
Showing 307 changed files with 2,532 additions and 2,539 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"plugins": [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
]
],
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion apps/maestro/e2e/pages/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test.describe("Index page", () => {
const connectButtonCount = await connectButton.count();

const connectedWalletDropdownTrigger = page.locator(
"button[aria-label='connected wallet dropdown trigger']",
"button[aria-label='connected wallet dropdown trigger']"
);

const isAutoConnected = connectButtonCount === 0;
Expand Down
2 changes: 1 addition & 1 deletion apps/maestro/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ export default withSentryConfig(

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
},
}
);
6 changes: 3 additions & 3 deletions apps/maestro/scripts/postcodegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const DISABLED_RULES = [
];

const ESLINT_DISABLE_PREFIX = DISABLED_RULES.map(
(rule) => `/* eslint-disable ${rule} */`,
(rule) => `/* eslint-disable ${rule} */`
).join("\n");

/**
Expand Down Expand Up @@ -56,7 +56,7 @@ async function replaceContentInFile(filePath: string) {
.replace(
`from "wagmi";`,
`from "wagmi";
import ABI from "./${fileName.replace("hooks.ts", "abi")}";`,
import ABI from "./${fileName.replace("hooks.ts", "abi")}";`
);

const formattedContent = await prettier.format(replacedContent, {
Expand All @@ -70,7 +70,7 @@ await Promise.all(
patchFiles.map(async (file) => {
await prepend(ESLINT_DISABLE_PREFIX, file);
await replaceContentInFile(path.join(destFolder, file));
}),
})
);

console.log(`\nPatched ${patchFiles.length} files 🎉`);
8 changes: 4 additions & 4 deletions apps/maestro/scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function main() {
await $`gh --version`;
} catch (e) {
console.error(
`❌ gh is not installed. Please install it from https://cli.github.com/`,
`❌ gh is not installed. Please install it from https://cli.github.com/`
);
return;
}
Expand All @@ -33,7 +33,7 @@ async function main() {
await $`gh auth status`;
} catch (e) {
console.error(
`❌ You are not logged in to GitHub. Please run 'gh auth login'`,
`❌ You are not logged in to GitHub. Please run 'gh auth login'`
);
return;
}
Expand All @@ -44,12 +44,12 @@ async function main() {

// find the line with the version
const changelogLineStartIndex = changelogLines.findIndex((line) =>
line.startsWith(`## ${version}`),
line.startsWith(`## ${version}`)
);

const changelogLineEndIndex = changelogLines.findIndex(
(line, index) =>
index > changelogLineStartIndex && /^## \d+\.\d+\.\d+/.test(line),
index > changelogLineStartIndex && /^## \d+\.\d+\.\d+/.test(line)
);

const changelogContent = changelogLines
Expand Down
14 changes: 7 additions & 7 deletions apps/maestro/scripts/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dotenv.config(hasEnvLocal ? { path: envLocalPath } : undefined);
console.log(
`📝 Loaded environment variables from ${
hasEnvLocal ? ".env.local" : ".env"
}\n`,
}\n`
);

const contractsDir = path.join(
Expand All @@ -28,7 +28,7 @@ const contractsDir = path.join(
"evm",
"src",
"contracts",
"its",
"its"
);

const WHITELISTED_CONTRACTS = [
Expand All @@ -49,9 +49,9 @@ await Promise.all(
contractFolders.map((folder) =>
fs.copyFile(
path.join(contractsDir, folder, `${folder}.abi.ts`),
path.join(destFolder, `${folder}.abi.ts`),
),
),
path.join(destFolder, `${folder}.abi.ts`)
)
)
);

const pascalToConstName = (contract = "") =>
Expand All @@ -78,7 +78,7 @@ const contractConfigs = `export const contracts = [
? ".env.local"
: "Vercel environment variables";
console.warn(
`WARNING: ${envKey} is missing under ${envFile}. The interactions will require an explicit address.\n`,
`WARNING: ${envKey} is missing under ${envFile}. The interactions will require an explicit address.\n`
);
}
Expand All @@ -98,7 +98,7 @@ const contractConfigs = `export const contracts = [
const content = contractFolders
.map(
(folder) =>
`import ${pascalToConstName(folder)}_ABI from "./${folder}.abi";`,
`import ${pascalToConstName(folder)}_ABI from "./${folder}.abi";`
)
.join("\n")
.concat("\n\n", contractConfigs);
Expand Down
42 changes: 21 additions & 21 deletions apps/maestro/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,53 @@ import { Maybe } from "@axelarjs/utils";
import { map, split, trim, uniq } from "rambda";

export const NEXT_PUBLIC_SITE_URL = Maybe.of(
process.env.NEXT_PUBLIC_SITE_URL,
process.env.NEXT_PUBLIC_SITE_URL
).mapOr("http://localhost:3000", String);

export const NEXT_PUBLIC_E2E_ENABLED =
process.env.NEXT_PUBLIC_E2E_ENABLED === "true";

export const NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID = Maybe.of(
process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID,
process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID
).mapOr("", String);

export const NEXT_PUBLIC_NETWORK_ENV = String(
process.env.NEXT_PUBLIC_NETWORK_ENV ?? "testnet",
process.env.NEXT_PUBLIC_NETWORK_ENV ?? "testnet"
) as "mainnet" | "testnet";

export const NEXT_PUBLIC_AXELAR_CONFIGS_URL = Maybe.of(
process.env.NEXT_PUBLIC_AXELAR_CONFIGS_URL,
process.env.NEXT_PUBLIC_AXELAR_CONFIGS_URL
).mapOr(
"https://github.com/axelarnetwork/axelar-configs/blob/main/cli/wizard/commands/list-squid-token/README.md",
String,
String
);

export const NEXT_PUBLIC_INTERCHAIN_TOKEN_SERVICE_ADDRESS = Maybe.of(
process.env.NEXT_PUBLIC_INTERCHAIN_TOKEN_SERVICE_ADDRESS,
process.env.NEXT_PUBLIC_INTERCHAIN_TOKEN_SERVICE_ADDRESS
).mapOr("0x", String) as `0x${string}`;

export const NEXT_PUBLIC_INTERCHAIN_TOKEN_FACTORY_ADDRESS = Maybe.of(
process.env.NEXT_PUBLIC_INTERCHAIN_TOKEN_FACTORY_ADDRESS,
process.env.NEXT_PUBLIC_INTERCHAIN_TOKEN_FACTORY_ADDRESS
).mapOr("0x", String) as `0x${string}`;

export const NEXT_PUBLIC_EXPLORER_URL = Maybe.of(
process.env.NEXT_PUBLIC_EXPLORER_URL,
process.env.NEXT_PUBLIC_EXPLORER_URL
).mapOr("", String);

export const NEXT_PUBLIC_FILE_BUG_REPORT_URL = Maybe.of(
process.env.NEXT_PUBLIC_FILE_BUG_REPORT_URL,
process.env.NEXT_PUBLIC_FILE_BUG_REPORT_URL
).mapOr("", String);

export const NEXT_PUBLIC_VERCEL_URL = Maybe.of(
process.env.NEXT_PUBLIC_VERCEL_URL,
process.env.NEXT_PUBLIC_VERCEL_URL
).mapOr("http://localhost:3000", String);

export const NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA = Maybe.of(
process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA
).mapOr("", String);

export const NEXT_PUBLIC_GA_MEASUREMENT_ID = Maybe.of(
process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID,
process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID
).mapOr("", String);

export const NEXT_PUBLIC_DISABLE_AUTH =
Expand All @@ -58,45 +58,45 @@ export const NEXT_PUBLIC_DISABLE_AUTH =
"true";

export const NEXT_PUBLIC_INTERCHAIN_TRANSFER_GAS_LIMIT = Maybe.of(
process.env.NEXT_PUBLIC_INTERCHAIN_TRANSFER_GAS_LIMIT,
process.env.NEXT_PUBLIC_INTERCHAIN_TRANSFER_GAS_LIMIT
).mapOr(150000, Number);

export const NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_GAS_LIMIT = Maybe.of(
process.env.NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_GAS_LIMIT,
process.env.NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_GAS_LIMIT
).mapOr(1000000, Number);

export const NEXT_PUBLIC_DISABLED_CHAINS = Maybe.of(
process.env.NEXT_PUBLIC_DISABLED_CHAINS,
process.env.NEXT_PUBLIC_DISABLED_CHAINS
)
.map(split(","))
.map(uniq)
.mapOr([], map(trim));

export const NEXT_PUBLIC_DISABLED_WALLET_IDS = Maybe.of(
process.env.NEXT_PUBLIC_DISABLED_WALLET_IDS,
process.env.NEXT_PUBLIC_DISABLED_WALLET_IDS
)
.map(split(","))
.mapOr([], map(trim));

export const NEXT_PUBLIC_GIT_BRANCH = Maybe.of(
process.env.NEXT_PUBLIC_GIT_BRANCH,
process.env.NEXT_PUBLIC_GIT_BRANCH
).mapOr("main", String);

export const NEXT_PUBLIC_COMPETITION_START_TIMESTAMP = Maybe.of(
process.env.NEXT_PUBLIC_COMPETITION_START_TIMESTAMP,
process.env.NEXT_PUBLIC_COMPETITION_START_TIMESTAMP
).mapOr("", String);

export const NEXT_PUBLIC_COMPETITION_END_TIMESTAMP = Maybe.of(
process.env.NEXT_PUBLIC_COMPETITION_END_TIMESTAMP,
process.env.NEXT_PUBLIC_COMPETITION_END_TIMESTAMP
).mapOr("", String);

export const NEXT_PUBLIC_ENABLED_FEATURES = Maybe.of(
process.env.NEXT_PUBLIC_ENABLED_FEATURES,
process.env.NEXT_PUBLIC_ENABLED_FEATURES
).mapOr([], (val) => String(val).split(","));

export const shouldDisableSend = (
axelarChainId: string,
tokenAddress: `0x${string}`,
tokenAddress: `0x${string}`
) => {
const shouldDisable: Record<string, Record<`0x${string}`, boolean>> = {
optimism: { "0x4200000000000000000000000000000000000042": true },
Expand Down
2 changes: 1 addition & 1 deletion apps/maestro/src/config/evm-chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,5 @@ export const ALL_CHAINS: ExtendedWagmiChainConfig[] = [
] as const;

export const WAGMI_CHAIN_CONFIGS = ALL_CHAINS.filter(
(chain) => chain.environment === NEXT_PUBLIC_NETWORK_ENV,
(chain) => chain.environment === NEXT_PUBLIC_NETWORK_ENV
) as [ExtendedWagmiChainConfig, ...ExtendedWagmiChainConfig[]];
2 changes: 1 addition & 1 deletion apps/maestro/src/config/next-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const NEXT_AUTH_OPTIONS: NextAuthOptions = {
(headers) => ({
ip: headers["x-real-ip"] ?? headers["x-forwarded-for"],
userAgent: headers["user-agent"],
}),
})
);

// record unauthorized access attempt event to audit logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const AcceptInterchainTokenOwnership: FC<Props> = (props) => {
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[receipt],
[receipt]
);

const handleSubmit = useCallback(async () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/maestro/src/features/AdminPanel/AccountStatuses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const AccountStatusDropdown: FC<{
onChange: (status: AccountStatus) => void;
}> = ({ selectedStatus, onChange }) => {
const unselectedStatuses = STATUS_OPTIONS.filter(
(x) => x !== selectedStatus,
(x) => x !== selectedStatus
) as AccountStatus[];

return (
Expand Down Expand Up @@ -170,7 +170,7 @@ type AccountStatusRowProps = {

const AccountStatusRow: FC<AccountStatusRowProps> = (props) => {
const [accountStatus, setAccountStatus] = useState<AccountStatus>(
props.status,
props.status
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const CanonicalTokenRecovery = () => {
},
{
enabled: isValid,
},
}
);

const { mutateAsync, isPending: isMutating } =
Expand Down Expand Up @@ -147,7 +147,7 @@ export const CanonicalTokenRecovery = () => {
.filter(
([key, value]) =>
(EXCLUDED_COLUMNS.includes(key) && typeof value === "string") ||
typeof value === "number",
typeof value === "number"
)
.map(([key, value]) => (
<li key={key}>
Expand Down
2 changes: 1 addition & 1 deletion apps/maestro/src/features/AdminPanel/GlobalMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type TabKind = (typeof TABS)[number];
export const GlobalMessageManager = () => {
const { data: globalMessage } = trpc.messages.getGlobalMessage.useQuery(
undefined,
{ suspense: true },
{ suspense: true }
);
const { mutateAsync: saveGlobalMessage, isPending: isSavingGlobalMessage } =
trpc.messages.setGlobalMessage.useMutation({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type CanonicalTokenDeploymentState = typeof INITIAL_STATE;
export type TokenDetails = CanonicalTokenDeploymentState["tokenDetails"];

function useCanonicalTokenDeploymentState(
partialInitialState: Partial<CanonicalTokenDeploymentState> = INITIAL_STATE,
partialInitialState: Partial<CanonicalTokenDeploymentState> = INITIAL_STATE
) {
const initialState = {
...INITIAL_STATE,
Expand All @@ -51,7 +51,7 @@ function useCanonicalTokenDeploymentState(

const [state, setState] = useSessionStorageState(
"@maestro/canonical-deployment",
initialState,
initialState
);

/**
Expand Down Expand Up @@ -81,7 +81,7 @@ function useCanonicalTokenDeploymentState(
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[partialInitialState.tokenDetails],
[partialInitialState.tokenDetails]
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ const CanonicalTokenDeployment: FC = () => {
() =>
(
Object.values(chainInfo?.assets ?? []).map((assetId: any) =>
String(assetId ?? "").toLowerCase(),
String(assetId ?? "").toLowerCase()
) || []
).includes(state.tokenDetails.tokenAddress.toLowerCase()),
[chainInfo, state.tokenDetails.tokenAddress],
[chainInfo, state.tokenDetails.tokenAddress]
);

const CurrentStep = useMemo(() => STEPS[state.step], [state.step]);

const showBackButton = useMemo(
() => state.step !== 0 && state.step !== 2,
[state.step],
[state.step]
);

if (isGatewayToken)
Expand Down
Loading

0 comments on commit bd950c2

Please sign in to comment.