Skip to content

Commit

Permalink
feat: use biome
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Dec 12, 2023
1 parent fb17055 commit 7cfd399
Show file tree
Hide file tree
Showing 35 changed files with 2,149 additions and 2,260 deletions.
22 changes: 0 additions & 22 deletions .deepsource.toml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- name: Lint 🪩
run: pnpm lint:affected

- name: Prettier
run: pnpm prettier:affected
- name: Biome
run: pnpm biome:affected

- name: Build 🎁
run: pnpm build
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
. "$(dirname "$0")/_/husky.sh"

pnpm lint:affected
pnpm biome:affected
pnpm typecheck:affected
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"editor.tabSize": 2
"editor.tabSize": 2,
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"quickfix.biome": "always"
}
}
2 changes: 0 additions & 2 deletions apps/api/.prettierignore

This file was deleted.

4 changes: 2 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"postinstall": "pnpm codegen",
"lint": "eslint . --ext .js,.ts,.tsx",
"lint:fix": "eslint . --fix --ext .js,.ts,.tsx",
"prettier": "prettier --check \"**/*.{js,ts,tsx,md}\" --cache",
"prettier:fix": "prettier --write \"**/*.{js,ts,tsx,md}\" --cache",
"biome": "biome check *",
"biome:fix": "biome check * --apply",
"prisma:format": "prisma format --schema ./src/db/schema.prisma",
"prisma:migrate": "prisma migrate dev --schema ./src/db/schema.prisma",
"prisma:studio": "prisma studio --schema ./src/db/schema.prisma",
Expand Down
25 changes: 13 additions & 12 deletions apps/api/src/routes/stats/profileDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@ export const get: Handler = async (req, res) => {
`
});

const result = await rows.json<
Array<{
actor: string;
most_common_browser: string;
most_common_browser_version: string;
most_common_city: string;
most_common_country: string;
most_common_os: string;
most_common_region: string;
number_of_events: string;
}>
>();
const result =
await rows.json<
Array<{
actor: string;
most_common_browser: string;
most_common_browser_version: string;
most_common_city: string;
most_common_country: string;
most_common_os: string;
most_common_region: string;
number_of_events: string;
}>
>();
logger.info(`Profile details fetched for ${id}`);

return res
Expand Down
4 changes: 0 additions & 4 deletions apps/web/.prettierignore

This file was deleted.

4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"dev": "next dev --port 4783",
"lint": "eslint . --ext .ts,.tsx",
"lint:fix": "eslint . --fix --ext .ts,.tsx",
"prettier": "prettier --check \"**/*.{js,ts,tsx,md}\" --cache",
"prettier:fix": "prettier --write \"**/*.{js,ts,tsx,md}\" --cache",
"biome": "biome check *",
"biome:fix": "biome check * --apply",
"start": "next start --port 4783",
"typecheck": "tsc --pretty"
},
Expand Down
40 changes: 20 additions & 20 deletions apps/web/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"id": "xyz.hey",
"name": "Hey",
"short_name": "Hey",
"start_url": "/",
"background_color": "#ffffff",
"theme_color": "#ffffff",
"display": "standalone",
"scope": "/",
"icons": [
{
"src": "/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
"id": "xyz.hey",
"name": "Hey",
"short_name": "Hey",
"start_url": "/",
"background_color": "#ffffff",
"theme_color": "#ffffff",
"display": "standalone",
"scope": "/",
"icons": [
{
"src": "/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
26 changes: 13 additions & 13 deletions apps/web/src/components/Profile/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ const Details: FC<DetailsProps> = ({ profile }) => {
</Link>
</Tooltip>
</MetaDetails>
{getProfileAttribute(profile?.metadata?.attributes, 'location') ? (
{getProfileAttribute('location', profile?.metadata?.attributes) ? (
<MetaDetails icon={<MapPinIcon className="h-4 w-4" />}>
{getProfileAttribute(profile?.metadata?.attributes, 'location')}
{getProfileAttribute('location', profile?.metadata?.attributes)}
</MetaDetails>
) : null}
{profile?.onchainIdentity?.ens?.name ? (
Expand All @@ -225,7 +225,7 @@ const Details: FC<DetailsProps> = ({ profile }) => {
{profile?.onchainIdentity?.ens?.name}
</MetaDetails>
) : null}
{getProfileAttribute(profile?.metadata?.attributes, 'website') ? (
{getProfileAttribute('website', profile?.metadata?.attributes) ? (
<MetaDetails
icon={
<img
Expand All @@ -234,8 +234,8 @@ const Details: FC<DetailsProps> = ({ profile }) => {
height={16}
src={getFavicon(
getProfileAttribute(
profile?.metadata?.attributes,
'website'
'website',
profile?.metadata?.attributes
)
)}
width={16}
Expand All @@ -244,21 +244,21 @@ const Details: FC<DetailsProps> = ({ profile }) => {
>
<Link
href={`https://${getProfileAttribute(
profile?.metadata?.attributes,
'website'
'website',
profile?.metadata?.attributes
)
?.replace('https://', '')
.replace('http://', '')}`}
rel="noreferrer noopener me"
target="_blank"
>
{getProfileAttribute(profile?.metadata?.attributes, 'website')
{getProfileAttribute('website', profile?.metadata?.attributes)
?.replace('https://', '')
.replace('http://', '')}
</Link>
</MetaDetails>
) : null}
{getProfileAttribute(profile?.metadata?.attributes, 'x') ? (
{getProfileAttribute('x', profile?.metadata?.attributes) ? (
<MetaDetails
icon={
<img
Expand All @@ -275,16 +275,16 @@ const Details: FC<DetailsProps> = ({ profile }) => {
<Link
href={urlcat('https://x.com/:username', {
username: getProfileAttribute(
profile?.metadata?.attributes,
'x'
'x',
profile?.metadata?.attributes
)?.replace('https://x.com/', '')
})}
rel="noreferrer noopener"
target="_blank"
>
{getProfileAttribute(
profile?.metadata?.attributes,
'x'
'x',
profile?.metadata?.attributes
)?.replace('https://x.com/', '')}
</Link>
</MetaDetails>
Expand Down
18 changes: 8 additions & 10 deletions apps/web/src/components/Profile/MutualFollowers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@ const MutualFollowers: FC<MutualFollowersProps> = ({
onClick={() => setShowMutualFollowersModal?.(true)}
>
<div className="contents -space-x-2">
{profiles
.slice(0, 3)
?.map((profile) => (
<Image
alt={profile.id}
className="h-5 w-5 rounded-full border dark:border-gray-700"
key={profile.id}
src={getAvatar(profile)}
/>
))}
{profiles.slice(0, 3)?.map((profile) => (
<Image
alt={profile.id}
className="h-5 w-5 rounded-full border dark:border-gray-700"
key={profile.id}
src={getAvatar(profile)}
/>
))}
</div>
<div>
<span>Followed by </span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ const MintAction: FC<MintActionProps> = ({
setCanMintOnHey(
!isPrepareError ||
(isPrepareError &&
ALLOWED_ERRORS_FOR_MINTING.some(
(error) => prepareError?.message.includes(error)
ALLOWED_ERRORS_FOR_MINTING.some((error) =>
prepareError?.message.includes(error)
))
);
}, [isPrepareFetching]);
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Settings/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ const ProfileSettingsForm: FC<ProfileSettingsFormProps> = ({ profile }) => {
const form = useZodForm({
defaultValues: {
bio: profile?.metadata?.bio ?? '',
location: getProfileAttribute(profile?.metadata?.attributes, 'location'),
location: getProfileAttribute('location', profile?.metadata?.attributes),
name: profile?.metadata?.displayName ?? '',
website: getProfileAttribute(profile?.metadata?.attributes, 'website'),
x: getProfileAttribute(profile?.metadata?.attributes, 'x')?.replace(
website: getProfileAttribute('website', profile?.metadata?.attributes),
x: getProfileAttribute('x', profile?.metadata?.attributes)?.replace(
/(https:\/\/)?x\.com\//,
''
)
Expand Down
35 changes: 35 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"organizeImports": {
"enabled": false
},
"files": {
"maxSize": 100000000
},
"javascript": {
"formatter": {
"indentWidth": 2,
"quoteStyle": "single",
"trailingComma": "none",
"indentStyle": "space"
}
},
"linter": {
"ignore": [
"dist/**/*",
"sw.js",
"*.md",
"package.json",
"tsconfig.json",
"tsconfig.tsbuildinfo",
"index.html"
],
"enabled": true,
"rules": {
"a11y": { "useKeyWithClickEvents": "off" },
"correctness": { "useExhaustiveDependencies": "off" },
"suspicious": { "noExplicitAny": "off" },
"recommended": true
}
}
}
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"lint:affected": "turbo run lint --parallel --filter=[origin/main]",
"lint:fix": "turbo run lint:fix --parallel",
"prepare": "husky install",
"prettier": "turbo run prettier --parallel",
"prettier:affected": "turbo run prettier --parallel --filter=[origin/main]",
"prettier:fix": "turbo run prettier:fix --parallel",
"biome": "turbo run biome --parallel",
"biome:affected": "turbo run biome --parallel --filter=[origin/main]",
"biome:fix": "turbo run biome:fix --parallel",
"start": "turbo run start --parallel",
"test:dev": "turbo run test:dev",
"typecheck": "turbo run typecheck --parallel",
Expand All @@ -23,9 +23,8 @@
"root": true
},
"devDependencies": {
"@biomejs/biome": "^1.4.1",
"husky": "^8.0.3",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.9",
"turbo": "^1.11.1"
},
"packageManager": "pnpm@8.10.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/abis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --fix --ext .ts",
"prettier": "prettier --check \"**/*.{js,ts,tsx,md}\" --cache",
"prettier:fix": "prettier --write \"**/*.{js,ts,tsx,md}\" --cache",
"biome": "biome check *",
"biome:fix": "biome check * --apply",
"typecheck": "tsc --pretty"
},
"devDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions packages/config/eslint/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ module.exports = {
plugins: [
'@typescript-eslint',
'unused-imports',
'prettier',
'unicorn',
'import',
'perfectionist'
],
rules: {
curly: 'error',
'no-unused-vars': 'off',
'prettier/prettier': 'error',
'unused-imports/no-unused-imports': 'error',
'import/no-duplicates': ['error', { considerQueryString: true }],
'prefer-destructuring': ['error', { VariableDeclarator: { object: true } }],
Expand Down
1 change: 0 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"eslint": "^8.55.0",
"eslint-config-next": "^14.0.4",
"eslint-plugin-perfectionist": "^2.5.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/data/hashflags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export const hashflags: Record<string, string> = {
lens: 'lens',
lenstube: 'lenstube',
voted: 'voted',
// biome-ignore lint/performance/noAccumulatingSpread: <explanation>
...prideHashtags.reduce((acc, cur) => ({ ...acc, [cur]: 'pride' }), {})
};
Loading

0 comments on commit 7cfd399

Please sign in to comment.