Skip to content

Commit b8f048d

Browse files
committed
biome 2
1 parent 9fec4cc commit b8f048d

File tree

4,341 files changed

+63287
-66547
lines changed

Some content is hidden

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

4,341 files changed

+63287
-66547
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Setup Biome
6464
uses: biomejs/setup-biome@a9763ed3d2388f5746f9dc3e1a55df7f4609bc89 # v2.5.1
6565
with:
66-
version: latest
66+
version: 2.0.0
6767

6868
- run: pnpm lint
6969

.vscode/settings.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
{
2-
"editor.formatOnSave": true,
3-
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": "explicit",
5-
"source.organizeImports.biome": "explicit",
6-
"quickfix.biome": "explicit"
7-
},
8-
"editor.defaultFormatter": "biomejs.biome",
9-
"typescript.preferences.autoImportFileExcludePatterns": [
10-
"./packages/thirdweb/src/exports"
11-
],
12-
"typescript.preferences.autoImportSpecifierExcludeRegexes": [
13-
"@radix-ui",
14-
"next/router",
15-
"next/dist",
16-
"^lucide-react/dist/lucide-react.suffixed$"
17-
],
18-
"typescript.tsdk": "node_modules/typescript/lib",
19-
"[typescriptreact]": {
2+
"[css]": {
203
"editor.defaultFormatter": "biomejs.biome"
214
},
22-
"[typescript]": {
5+
"[javascript]": {
236
"editor.defaultFormatter": "biomejs.biome"
247
},
258
"[json]": {
@@ -28,14 +11,30 @@
2811
"[markdown]": {
2912
"editor.defaultFormatter": "esbenp.prettier-vscode"
3013
},
31-
"[javascript]": {
14+
"[typescript]": {
3215
"editor.defaultFormatter": "biomejs.biome"
3316
},
34-
"[css]": {
17+
"[typescriptreact]": {
3518
"editor.defaultFormatter": "biomejs.biome"
3619
},
20+
"editor.codeActionsOnSave": {
21+
"quickfix.biome": "explicit",
22+
"source.fixAll.biome": "explicit"
23+
},
24+
"editor.defaultFormatter": "biomejs.biome",
25+
"editor.formatOnSave": true,
3726
"eslint.workingDirectories": [
3827
{ "pattern": "./packages/*/" },
3928
{ "pattern": "./apps/*/" }
40-
]
29+
],
30+
"typescript.preferences.autoImportFileExcludePatterns": [
31+
"./packages/thirdweb/src/exports"
32+
],
33+
"typescript.preferences.autoImportSpecifierExcludeRegexes": [
34+
"@radix-ui",
35+
"next/router",
36+
"next/dist",
37+
"^lucide-react/dist/lucide-react.suffixed$"
38+
],
39+
"typescript.tsdk": "node_modules/typescript/lib"
4140
}

apps/dashboard/.eslintrc.js

Lines changed: 117 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,97 @@
11
module.exports = {
2+
env: {
3+
browser: true,
4+
node: true,
5+
},
26
extends: [
37
"eslint:recommended",
48
"plugin:@typescript-eslint/recommended",
59
"plugin:@next/next/recommended",
610
"plugin:storybook/recommended",
711
],
8-
rules: {
9-
"react-compiler/react-compiler": "error",
10-
"no-restricted-syntax": [
11-
"error",
12-
{
13-
selector: "CallExpression[callee.name='useEffect']",
14-
message:
15-
'Are you *sure* you need to use "useEffect" here? If you loading any async function prefer using "useQuery".',
12+
overrides: [
13+
// disable restricted imports in tw-components
14+
{
15+
files: "src/tw-components/**/*",
16+
rules: {
17+
"no-restricted-imports": ["off"],
1618
},
17-
{
18-
selector: "CallExpression[callee.name='createContext']",
19-
message:
20-
'Are you *sure* you need to use a "Context"? In almost all cases you should prefer passing props directly.',
19+
},
20+
// allow direct PostHog imports inside analytics helpers
21+
{
22+
files: "src/@/analytics/**/*",
23+
rules: {
24+
"no-restricted-imports": ["off"],
2125
},
22-
{
23-
selector: "CallExpression[callee.name='defineChain']",
24-
message:
25-
"Use useV5DashboardChain instead if you are using it inside a component",
26+
},
27+
// enable rule specifically for TypeScript files
28+
{
29+
files: ["*.ts", "*.tsx"],
30+
rules: {
31+
"@typescript-eslint/explicit-module-boundary-types": ["off"],
2632
},
27-
{
28-
selector: "CallExpression[callee.name='defineDashboardChain']",
29-
message:
30-
"Use useV5DashboardChain instead if you are using it inside a component",
33+
},
34+
35+
// in test files, allow null assertions and anys and eslint is sometimes weird about the react-scope thing
36+
{
37+
files: ["*test.ts?(x)"],
38+
rules: {
39+
"@typescript-eslint/no-explicit-any": "off",
40+
"@typescript-eslint/no-non-null-assertion": "off",
41+
42+
"react/display-name": "off",
3143
},
32-
{
33-
selector: "CallExpression[callee.name='mapV4ChainToV5Chain']",
34-
message:
35-
"Use useV5DashboardChain instead if you are using it inside a component",
44+
},
45+
// allow requires in non-transpiled JS files and logical key ordering in config files
46+
{
47+
files: [
48+
"babel-node.js",
49+
"*babel.config.js",
50+
"env.config.js",
51+
"next.config.js",
52+
"webpack.config.js",
53+
"packages/mobile-web/package-builder/**",
54+
],
55+
rules: {},
56+
},
57+
58+
// setupTests can have separated imports for logical grouping
59+
{
60+
files: ["setupTests.ts"],
61+
rules: {
62+
"import/newline-after-import": "off",
3663
},
37-
{
38-
selector: "CallExpression[callee.name='resolveScheme']",
39-
message:
40-
"resolveScheme can throw error if resolution fails. Either catch the error and ignore the lint warning or Use `resolveSchemeWithErrorHandler` / `replaceIpfsUrl` utility in dashboard instead",
64+
},
65+
// turn OFF unused vars via eslint
66+
{
67+
files: ["*.ts", "*.tsx"],
68+
rules: {
69+
"@next/next/no-img-element": "off",
70+
"@typescript-eslint/no-unused-vars": "off",
4171
},
42-
],
72+
},
73+
// THIS NEEDS TO GO LAST!
74+
{
75+
extends: ["biome"],
76+
files: ["*.ts", "*.js", "*.tsx", "*.jsx"],
77+
},
78+
],
79+
parser: "@typescript-eslint/parser",
80+
parserOptions: {
81+
ecmaFeatures: {
82+
impliedStrict: true,
83+
jsx: true,
84+
},
85+
ecmaVersion: 2019,
86+
warnOnUnsupportedTypeScriptVersion: true,
87+
},
88+
plugins: ["@typescript-eslint", "react-compiler"],
89+
rules: {
4390
"no-restricted-imports": [
4491
"error",
4592
{
4693
paths: [
4794
{
48-
name: "@chakra-ui/react",
4995
// these are provided by tw-components, so we don't want to import them from chakra directly
5096
importNames: [
5197
"Card",
@@ -82,52 +128,77 @@ module.exports = {
82128
],
83129
message:
84130
'Use the equivalent component from "tw-components" instead.',
131+
name: "@chakra-ui/react",
85132
},
86133
{
87-
name: "@chakra-ui/layout",
88134
message:
89135
"Import from `@chakra-ui/react` instead of `@chakra-ui/layout`.",
136+
name: "@chakra-ui/layout",
90137
},
91138
{
92-
name: "@chakra-ui/button",
93139
message:
94140
"Import from `@chakra-ui/react` instead of `@chakra-ui/button`.",
141+
name: "@chakra-ui/button",
95142
},
96143
{
97-
name: "@chakra-ui/menu",
98144
message:
99145
"Import from `@chakra-ui/react` instead of `@chakra-ui/menu`.",
146+
name: "@chakra-ui/menu",
100147
},
101148
{
102-
name: "next/navigation",
103149
importNames: ["useRouter"],
104150
message:
105151
'Use `import { useDashboardRouter } from "@/lib/DashboardRouter";` instead',
152+
name: "next/navigation",
106153
},
107154
{
108-
name: "lucide-react",
109155
importNames: ["Link", "Table", "Sidebar"],
110156
message:
111157
'This is likely a mistake. If you really want to import this - postfix the imported name with Icon. Example - "LinkIcon"',
158+
name: "lucide-react",
112159
},
113160
{
114-
name: "posthog-js",
115161
message:
116162
'Import "posthog-js" directly only within the analytics helpers ("src/@/analytics/*"). Use the exported helpers from "@/analytics/track" elsewhere.',
163+
name: "posthog-js",
117164
},
118165
],
119166
},
120167
],
121-
},
122-
parser: "@typescript-eslint/parser",
123-
plugins: ["@typescript-eslint", "react-compiler"],
124-
parserOptions: {
125-
ecmaVersion: 2019,
126-
ecmaFeatures: {
127-
impliedStrict: true,
128-
jsx: true,
129-
},
130-
warnOnUnsupportedTypeScriptVersion: true,
168+
"no-restricted-syntax": [
169+
"error",
170+
{
171+
message:
172+
'Are you *sure* you need to use "useEffect" here? If you loading any async function prefer using "useQuery".',
173+
selector: "CallExpression[callee.name='useEffect']",
174+
},
175+
{
176+
message:
177+
'Are you *sure* you need to use a "Context"? In almost all cases you should prefer passing props directly.',
178+
selector: "CallExpression[callee.name='createContext']",
179+
},
180+
{
181+
message:
182+
"Use useV5DashboardChain instead if you are using it inside a component",
183+
selector: "CallExpression[callee.name='defineChain']",
184+
},
185+
{
186+
message:
187+
"Use useV5DashboardChain instead if you are using it inside a component",
188+
selector: "CallExpression[callee.name='defineDashboardChain']",
189+
},
190+
{
191+
message:
192+
"Use useV5DashboardChain instead if you are using it inside a component",
193+
selector: "CallExpression[callee.name='mapV4ChainToV5Chain']",
194+
},
195+
{
196+
message:
197+
"resolveScheme can throw error if resolution fails. Either catch the error and ignore the lint warning or Use `resolveSchemeWithErrorHandler` / `replaceIpfsUrl` utility in dashboard instead",
198+
selector: "CallExpression[callee.name='resolveScheme']",
199+
},
200+
],
201+
"react-compiler/react-compiler": "error",
131202
},
132203
settings: {
133204
react: {
@@ -136,67 +207,4 @@ module.exports = {
136207
version: "detect",
137208
},
138209
},
139-
overrides: [
140-
// disable restricted imports in tw-components
141-
{
142-
files: "src/tw-components/**/*",
143-
rules: {
144-
"no-restricted-imports": ["off"],
145-
},
146-
},
147-
// allow direct PostHog imports inside analytics helpers
148-
{
149-
files: "src/@/analytics/**/*",
150-
rules: {
151-
"no-restricted-imports": ["off"],
152-
},
153-
},
154-
// enable rule specifically for TypeScript files
155-
{
156-
files: ["*.ts", "*.tsx"],
157-
rules: {
158-
"@typescript-eslint/explicit-module-boundary-types": ["off"],
159-
},
160-
},
161-
162-
// in test files, allow null assertions and anys and eslint is sometimes weird about the react-scope thing
163-
{
164-
files: ["*test.ts?(x)"],
165-
rules: {
166-
"@typescript-eslint/no-non-null-assertion": "off",
167-
"@typescript-eslint/no-explicit-any": "off",
168-
169-
"react/display-name": "off",
170-
},
171-
},
172-
// allow requires in non-transpiled JS files and logical key ordering in config files
173-
{
174-
files: [
175-
"babel-node.js",
176-
"*babel.config.js",
177-
"env.config.js",
178-
"next.config.js",
179-
"webpack.config.js",
180-
"packages/mobile-web/package-builder/**",
181-
],
182-
rules: {},
183-
},
184-
185-
// setupTests can have separated imports for logical grouping
186-
{
187-
files: ["setupTests.ts"],
188-
rules: {
189-
"import/newline-after-import": "off",
190-
},
191-
},
192-
// THIS NEEDS TO GO LAST!
193-
{
194-
files: ["*.ts", "*.js", "*.tsx", "*.jsx"],
195-
extends: ["biome"],
196-
},
197-
],
198-
env: {
199-
browser: true,
200-
node: true,
201-
},
202210
};

apps/dashboard/biome.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
3-
"extends": ["../../biome.json"],
4-
"overrides": [
5-
{
6-
"include": ["src/css/swagger-ui.css"],
7-
"linter": {
8-
"rules": {
9-
"suspicious": {
10-
"noImportantInKeyframe": "off"
11-
}
12-
}
13-
}
14-
}
15-
]
2+
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
3+
"extends": "//"
164
}

0 commit comments

Comments
 (0)