Skip to content

Commit bd3a480

Browse files
chore: upgrade biome and simplify biome config (#1679)
* chore: upgrade biome to 1.4.1 * fix: safe fixes * fix: ternary fomatting * fix: typeof formatting * fix: noUselessElse * fix: align biome config with wevm * fix: noForEach
1 parent 7565fb2 commit bd3a480

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+217
-173
lines changed

.pnpmfile.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function omitRootDependencies(packageName, dependencies) {
3030
// None for now
3131
];
3232

33-
Object.keys(dependencies).forEach((dep) => {
33+
for (const dep of Object.keys(dependencies)) {
3434
if (!rootDependencies[dep] || allowedDuplicatePackages.includes(dep)) {
3535
// Keep the dependency in the app template's package.json since it's not in the
3636
// root package.json (or in the list of allowed duplicate packages).
@@ -46,7 +46,7 @@ function omitRootDependencies(packageName, dependencies) {
4646
.join('\n'),
4747
);
4848
}
49-
});
49+
}
5050

5151
return filteredDependencies;
5252
}

biome.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,29 @@
2121
"enabled": true,
2222
"rules": {
2323
"recommended": true,
24+
"a11y": {
25+
"useButtonType": "off"
26+
},
27+
"complexity": {
28+
"noBannedTypes": "off",
29+
"useLiteralKeys": "off"
30+
},
2431
"correctness": {
2532
"noUnusedVariables": "error"
2633
},
27-
"nursery": {
28-
"useGroupedTypeImport": "off"
29-
},
3034
"performance": {
3135
"noDelete": "off"
3236
},
3337
"style": {
3438
"noNonNullAssertion": "off",
35-
"useShorthandArrayType": "error",
36-
"useSingleVarDeclarator": "off"
39+
"useShorthandArrayType": "error"
3740
},
3841
"suspicious": {
3942
"noArrayIndexKey": "off",
43+
"noAssignInExpressions": "off",
44+
"noConfusingVoidType": "off",
4045
"noExplicitAny": "off",
4146
"noRedeclare": "off"
42-
},
43-
"complexity": {
44-
"useLiteralKeys": "off",
45-
"noForEach": "off"
46-
},
47-
"a11y": {
48-
"noSvgWithoutTitle": "off"
4947
}
5048
}
5149
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"license": "MIT",
4343
"devDependencies": {
44-
"@biomejs/biome": "1.3.3",
44+
"@biomejs/biome": "1.4.1",
4545
"@changesets/cli": "2.26.2",
4646
"@commitlint/cli": "^18.4.2",
4747
"@commitlint/config-conventional": "^18.4.2",

packages/create-rainbowkit/src/cli.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ async function run() {
173173
const packageManager = options.usePnpm
174174
? 'pnpm'
175175
: options.useYarn
176-
? 'yarn'
177-
: options.useNpm
178-
? 'npm'
179-
: detectPackageManager();
176+
? 'yarn'
177+
: options.useNpm
178+
? 'npm'
179+
: detectPackageManager();
180180

181181
log(
182182
chalk.cyan(

packages/create-rainbowkit/src/detectPackageManager.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ export function detectPackageManager(): PackageManager {
77
const userAgent = process.env.npm_config_user_agent;
88

99
if (userAgent) {
10-
if (userAgent.startsWith('pnpm')) {
11-
return 'pnpm';
12-
} else if (userAgent.startsWith('yarn')) {
13-
return 'yarn';
14-
} else if (userAgent.startsWith('npm')) {
15-
return 'npm';
16-
}
10+
if (userAgent.startsWith('pnpm')) return 'pnpm';
11+
if (userAgent.startsWith('yarn')) return 'yarn';
12+
if (userAgent.startsWith('npm')) return 'npm';
1713
}
1814
try {
1915
execSync('pnpm --version', { stdio: 'ignore' });

packages/example/pages/_app.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ const themes = [
218218
{ name: 'dark', theme: darkTheme },
219219
{ name: 'midnight', theme: midnightTheme },
220220
] as const;
221-
type ThemeName = typeof themes[number]['name'];
221+
type ThemeName = (typeof themes)[number]['name'];
222222

223223
const fontStacks = ['rounded', 'system'] as const;
224-
type FontStack = typeof fontStacks[number];
224+
type FontStack = (typeof fontStacks)[number];
225225

226226
const accentColors = [
227227
'blue',
@@ -232,16 +232,16 @@ const accentColors = [
232232
'red',
233233
'custom',
234234
] as const;
235-
type AccentColor = typeof accentColors[number];
235+
type AccentColor = (typeof accentColors)[number];
236236

237237
const radiusScales = ['large', 'medium', 'small', 'none'] as const;
238-
type RadiusScale = typeof radiusScales[number];
238+
type RadiusScale = (typeof radiusScales)[number];
239239

240240
const overlayBlurs = ['large', 'small', 'none'] as const;
241-
type OverlayBlur = typeof overlayBlurs[number];
241+
type OverlayBlur = (typeof overlayBlurs)[number];
242242

243243
const modalSizes = ['wide', 'compact'] as const;
244-
type ModalSize = typeof modalSizes[number];
244+
type ModalSize = (typeof modalSizes)[number];
245245

246246
function RainbowKitApp({
247247
Component,

packages/example/pages/api/auth/[...nextauth].ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
1515
async authorize(credentials) {
1616
try {
1717
const siwe = new SiweMessage(
18-
JSON.parse(credentials?.message || '{}')
18+
JSON.parse(credentials?.message || '{}'),
1919
);
2020

2121
const nextAuthUrl =
@@ -95,7 +95,7 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
9595

9696
const isDefaultSigninPage =
9797
req.method === 'GET' &&
98-
req.query.nextauth.find(value => value === 'signin');
98+
req.query.nextauth.find((value) => value === 'signin');
9999

100100
// Hide Sign-In with Ethereum from default sign page
101101
if (isDefaultSigninPage) {

packages/rainbowkit/src/components/AsyncImage/useAsyncImage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export type AsyncImageSrc = () => Promise<string>;
55
const cachedUrls = new Map<AsyncImageSrc, string>();
66

77
// Store requests in a cache so we don't fetch the same image twice
8-
// biome-ignore lint/suspicious/noConfusingVoidType: TODO
98
const cachedRequestPromises = new Map<AsyncImageSrc, Promise<string | void>>();
109

1110
async function loadAsyncImage(asyncImage: () => Promise<string>) {

packages/rainbowkit/src/components/Button/ActionButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export function ActionButton({
6161
? isPrimary
6262
? 'accentColor'
6363
: isNotLarge
64-
? 'actionButtonSecondaryBackground'
65-
: null
64+
? 'actionButtonSecondaryBackground'
65+
: null
6666
: 'actionButtonSecondaryBackground';
6767
const { fontSize, height, paddingX, paddingY } = sizeVariants[size];
6868
const hasBorder = !mobile || !isNotLarge;

packages/rainbowkit/src/components/ChainModal/ChainModal.test.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ describe('<ChainModal />', () => {
6363
it('Can switch chains', async () => {
6464
let onCloseGotCalled = false;
6565
const modal = renderWithProviders(
66-
// biome-ignore lint/suspicious/noAssignInExpressions: TODO
6766
<ChainModal onClose={() => (onCloseGotCalled = true)} open />,
6867
{
6968
mock: true,
@@ -90,7 +89,6 @@ describe('<ChainModal />', () => {
9089
it('Just closes on switch error (user rejected, or other)', async () => {
9190
let onCloseGotCalled = false;
9291
const modal = renderWithProviders(
93-
// biome-ignore lint/suspicious/noAssignInExpressions: TODO
9492
<ChainModal onClose={() => (onCloseGotCalled = true)} open />,
9593
{
9694
mock: true,
@@ -134,7 +132,6 @@ describe('<ChainModal />', () => {
134132
it('Closes on close button press', async () => {
135133
let onCloseGotCalled = false;
136134
const modal = renderWithProviders(
137-
// biome-ignore lint/suspicious/noAssignInExpressions: TODO
138135
<ChainModal onClose={() => (onCloseGotCalled = true)} open />,
139136
{
140137
mock: true,

0 commit comments

Comments
 (0)