Skip to content

Commit

Permalink
chore: regenerate package-lock & update biome (#1482)
Browse files Browse the repository at this point in the history
* fix: regenerate package-lock

* chore: upgrade biome

* fix(useBalancy): tsc error

* fix(code-check): run biome with npx

* cleanup(code-check): remove comments

* fix biome error (#1483)

* style: apply biome write-ci

* revert: take back biome ci change

* ci: bump up biome github action version

* build: pin biomejs version

* refactor: apply write-check after biome bump

---------

Co-authored-by: Dominik Stumpf <[email protected]>
  • Loading branch information
BrickheadJohnny and dominik-stumpf authored Sep 13, 2024
1 parent 897f566 commit d899f5d
Show file tree
Hide file tree
Showing 26 changed files with 7,962 additions and 5,322 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
uses: biomejs/setup-biome@v2.2.1
- name: Run Biome
run: biome ci --reporter=github .
type:
Expand Down
9 changes: 8 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
},
"files": {
"include": ["src", "playwright", "playwright.config.ts"],
"ignore": ["node_modules", ".next", "public", ".out", "package-lock.json"]
"ignore": [
"node_modules",
".next",
"public",
".out",
"package-lock.json",
"*.css"
]
},
"organizeImports": {
"enabled": true
Expand Down
13,160 changes: 7,896 additions & 5,264 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@emotion/styled": "^11.11.0",
"@fuels/connectors": "^0.5.0",
"@fuels/react": "^0.20.0",
"@guildxyz/types": "^1.10.10",
"@guildxyz/types": "^1.10.13",
"@hcaptcha/react-hcaptcha": "^1.4.4",
"@hookform/resolvers": "^3.3.4",
"@lexical/code": "^0.12.0",
Expand Down Expand Up @@ -128,7 +128,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@biomejs/biome": "1.9.0",
"@chromatic-com/storybook": "^1.6.0",
"@hookform/devtools": "^4.3.0",
"@playwright/test": "^1.45.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const RewardBadge: FunctionComponent<{
const rewardName = reward?.platformGuildName ?? reward?.data?.name
const name =
reward?.platformId === PlatformType.DISCORD
? role?.name ?? "Unknown role"
? (role?.name ?? "Unknown role")
: rewardName

const Icon = rewards[reward?.platformName]?.icon
Expand Down
6 changes: 3 additions & 3 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
--farcaster-hover: 261 55% 55%;
--farcaster-active: 239 75% 50%;

/**
* Missing reward colors to work with the current Chakra driven solution.
/**
* Missing reward colors to work with the current Chakra driven solution.
* Should find a better solution when we ditch Chakra and won't need to be backward compatible
*
* Examples of usage -> new: RewardBadge, old: RewardTag
Expand All @@ -132,7 +132,7 @@
--blue: 217, 91%, 60%;
--gold: 40 67% 51%;
--gray: 240, 4%, 46%;

--sm: 640px;
--md: 768px;
--lg: 1024px;
Expand Down
4 changes: 2 additions & 2 deletions src/components/[guild]/JoinModal/utils/mapAccessJobState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ const mapAccessJobState = (progress: JoinJob, isLoading: boolean) => {
? "NO_ACCESS"
: progress.done
? "FINISHED"
: (
: ((
{
none: "PREPARING",
"access-preparation": "CHECKING",
"access-check": "MANAGING_ROLES",
"access-logic": "MANAGING_ROLES",
} as const
)[progress["completed-queue"] ?? "none"] ?? "MANAGING_REWARDS"
)[progress["completed-queue"] ?? "none"] ?? "MANAGING_REWARDS")

const waitingPosition =
(progress as any).currentQueueState === "waiting"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const BuyTotal = (): JSX.Element => {
)
: tokenData?.decimals
? Number(formatUnits(fee, tokenData.decimals)) +
(isNativeCurrency ? estimatedGasInFloat ?? 0 : 0)
(isNativeCurrency ? (estimatedGasInFloat ?? 0) : 0)
: 0
: 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ const PurchaseFeeAndTotal = (): JSX.Element => {
(
(estimatedPriceInSellToken ?? 0) +
(estimatedGuildFeeInSellToken ?? 0) +
(isNativeCurrency ? estimatedGasInFloat ?? 0 : 0)
(isNativeCurrency ? (estimatedGasInFloat ?? 0) : 0)
)?.toFixed(3)
)
const maxPriceSum = Number(
(
(maxPriceInSellToken ?? 0) +
(maxGuildFeeInSellToken ?? 0) +
(isNativeCurrency ? estimatedGasInFloat ?? 0 : 0)
(isNativeCurrency ? (estimatedGasInFloat ?? 0) : 0)
)?.toFixed(3)
)

Expand All @@ -82,8 +82,8 @@ const PurchaseFeeAndTotal = (): JSX.Element => {
{estimatedPriceInUSD && estimatedGuildFeeInUSD
? `$${(
estimatedPriceInUSD +
estimatedGuildFeeInUSD +
(estimatedGasInUSD ?? 0)
estimatedGuildFeeInUSD +
(estimatedGasInUSD ?? 0)
)?.toFixed(2)}`
: "$0.00"}
{" = "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const TransactionStatusModal = ({
{txError
? "Transaction failed"
: txSuccess
? successTitle ?? "Successful payment"
? (successTitle ?? "Successful payment")
: txHash
? "Transaction is processing..."
: title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const useVisibilityTooltipLabel = (

const tooltipDescription =
visibility !== "PRIVATE" ? (
VISIBILITY_DATA[visibility]?.description ?? VISIBILITY_DATA.PUBLIC.description
(VISIBILITY_DATA[visibility]?.description ??
VISIBILITY_DATA.PUBLIC.description)
) : !visibilityRoleId ? (
"Only visible to role holders"
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const UserTag = forwardRef<Props, "span">(
<TagLeftIcon mr={0.5} as={GuildAvatar} address={address} size={3} />
)}
<TagLabel>
{address ? shortenHex(address, 3) : userId ?? "Unknown user"}
{address ? shortenHex(address, 3) : (userId ?? "Unknown user")}
</TagLabel>
{rightIcon && <TagRightIcon as={rightIcon} />}
</Tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const SendNewMessage = (props: ButtonProps) => {
{isReachableUsersLoading ? (
<Spinner size="xs" />
) : (
reachableUsers?.length ?? 0
(reachableUsers?.length ?? 0)
)}
</Text>
<Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const DiscordGuildSetup = ({
return (
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={{ base: 3, md: 4 }}>
<AnimatePresence>
{(selectedServerOption ? [selectedServerOption] : servers ?? [])
{(selectedServerOption ? [selectedServerOption] : (servers ?? []))
.filter(
guildPlatformsOfRole
? (serverData) =>
Expand Down
40 changes: 20 additions & 20 deletions src/components/create-guild/Requirements/hooks/useBalancy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,27 +242,27 @@ const useBalancy = (
holders?.addresses ??
(!!baseFieldPath
? requirement?.data?.validAddresses
: (logic === "OR"
? [
...new Set(
allowlists
?.flat()
?.filter(Boolean)
?.map((addr) => addr.toLowerCase())
),
]
: [
...allowlists?.reduce(
(prev, curr) =>
new Set(
curr?.filter((addr) => !!addr && prev.has(addr.toLowerCase())) ??
[]
),
: logic === "OR"
? [
...new Set(
allowlists
?.flat()
?.filter(Boolean)
?.map((addr) => addr.toLowerCase())
),
]
: [
...allowlists?.reduce(
(prev, curr) =>
new Set(
allowlists?.[0]?.filter(Boolean)?.map((addr) => addr.toLowerCase())
)
),
]) || undefined)
curr?.filter((addr) => !!addr && prev.has(addr.toLowerCase())) ??
[]
),
new Set(
allowlists?.[0]?.filter(Boolean)?.map((addr) => addr.toLowerCase())
)
),
])

return {
addresses,
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useTokenData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ const useTokenData = (chain: Chain, address: string, onFinish?: () => void) => {
const name =
isCoin && chain
? CHAIN_CONFIG[chain].nativeCurrency.name
: tokenDataFromApi?.name ?? swrResponse.data?.name
: (tokenDataFromApi?.name ?? swrResponse.data?.name)
const symbol =
isCoin && chain
? CHAIN_CONFIG[chain].nativeCurrency.symbol
: swrResponse.data?.symbol ?? tokenDataFromApi?.symbol
: (swrResponse.data?.symbol ?? tokenDataFromApi?.symbol)
const decimals =
isCoin && chain
? CHAIN_CONFIG[chain].nativeCurrency.decimals
: tokenDataFromApi?.decimals ?? swrResponse.data?.decimals
: (tokenDataFromApi?.decimals ?? swrResponse.data?.decimals)
const logoURI =
isCoin && chain ? CHAIN_CONFIG[chain].iconUrl : tokenDataFromApi?.logoURI

Expand Down
4 changes: 2 additions & 2 deletions src/requirements/Nft/NftRequirement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ const NftRequirement = (props: RequirementProps) => {

{nftName ||
(!requirement.name || requirement.name === "-"
? metadata?.slug ?? (
? (metadata?.slug ?? (
<DataBlock>{shortenHex(requirementAddress, 3)}</DataBlock>
)
))
: requirement.name !== "-" && requirement.name)}

{requirement.data?.attributes?.length ? (
Expand Down
6 changes: 3 additions & 3 deletions src/requirements/Token/TokenRequirement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const TokenRequirement = ({ ...rest }: Props) => {
image={
requirement.type === "COIN"
? CHAIN_CONFIG[requirementChain]?.nativeCurrency?.iconUrl
: data?.logoURI ?? (
: (data?.logoURI ?? (
<Text as="span" fontWeight="bold" fontSize="xx-small">
ERC20
</Text>
)
))
}
isImageLoading={isValidating}
footer={
Expand Down Expand Up @@ -57,7 +57,7 @@ const TokenRequirement = ({ ...rest }: Props) => {
} ${
requirement.type === "COIN"
? CHAIN_CONFIG[requirementChain].nativeCurrency.symbol
: data?.symbol ?? requirement.symbol
: (data?.symbol ?? requirement.symbol)
}`}
</Requirement>
)
Expand Down
2 changes: 1 addition & 1 deletion src/requirements/VisitLink/VisitLinkRequirement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const VisitLinkRequirement = ({ ...props }: RequirementProps) => {

const isCustomName = data?.customName !== getDefaultVisitLinkCustomName(data)
const [, first, , link, , second] = isCustomName
? VISIT_LINK_REGEX.exec(data.customName) ?? []
? (VISIT_LINK_REGEX.exec(data.customName) ?? [])
: []

const onVisit = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/rewards/Gather/hooks/useClaimGather.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const useClaimGather = (rolePlatformId: number) => {
return {
error: claim.error,
isLoading: claim.isLoading,
response: uniqueValue ? { uniqueValue } : responseFromCache ?? claim.response,
response: uniqueValue ? { uniqueValue } : (responseFromCache ?? claim.response),
onSubmit: () => onClaimGatherSubmit(),
modalProps: {
isOpen,
Expand Down
2 changes: 1 addition & 1 deletion src/rewards/Points/usePointsCardProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const usePointsCardProps: CardPropsHook = (
const { dynamicUserAmount } = useDynamicRewardUserAmount(rolePlatform)

const score = !!rolePlatform?.dynamicAmount
? dynamicUserAmount ?? "some"
? (dynamicUserAmount ?? "some")
: rolePlatform?.platformRoleData?.score

const bgColor = useColorModeValue("gray.700", "gray.600")
Expand Down
2 changes: 1 addition & 1 deletion src/rewards/SecretText/hooks/useClaimText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const useClaimText = (rolePlatformId: number) => {

return {
error: claim.error,
response: uniqueValue ? { uniqueValue } : responseFromCache ?? claim.response,
response: uniqueValue ? { uniqueValue } : (responseFromCache ?? claim.response),
isLoading: claim.isLoading,
onSubmit: onClaimTextSubmit,
modalProps: {
Expand Down
4 changes: 2 additions & 2 deletions src/rewards/components/PointsPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const PointsPreview = (): JSX.Element => {
const { guildPlatform } = useGuildPlatform(guildPlatformId)
const { name, imageUrl } =
guildPlatformId && guildPlatformId !== CREATE_NEW_OPTION
? guildPlatform.platformGuildData ?? {}
: platformGuildData ?? {}
? (guildPlatform.platformGuildData ?? {})
: (platformGuildData ?? {})

return (
<RewardPreview
Expand Down
2 changes: 1 addition & 1 deletion src/rewards/components/PointsReward.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const PointsReward = ({ platform }: RewardProps) => {
const { dynamicUserAmount } = useDynamicRewardUserAmount(platform)

const score = platform?.dynamicAmount
? dynamicUserAmount ?? "some"
? (dynamicUserAmount ?? "some")
: platform.platformRoleData?.score

const iconColor = useColorModeValue("green.500", "green.300")
Expand Down
4 changes: 2 additions & 2 deletions src/rewards/components/SelectRoleOrSetRequirements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ const SelectRoleOrSetRequirements = ({ isRoleSelectorDisabled }: Props) => {

const alreadyUsedRoles = new Set(
existingGuildPlatform
? roles
? (roles
?.filter((role) =>
role.rolePlatforms?.some(
(rp) => rp.guildPlatformId === existingGuildPlatform.id
)
)
?.map((role) => role.id) ?? []
?.map((role) => role.id) ?? [])
: []
)

Expand Down
2 changes: 1 addition & 1 deletion src/utils/pluralize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const pluralize = (
noun: string,
includeNumber = true,
suffix = "s"
) => `${includeNumber ? count ?? 0 : ""} ${noun}${count !== 1 ? suffix : ""}`
) => `${includeNumber ? (count ?? 0) : ""} ${noun}${count !== 1 ? suffix : ""}`

export default pluralize

0 comments on commit d899f5d

Please sign in to comment.