Skip to content

Commit 31e1326

Browse files
committed
chore: upgrade Biome to v2.4.2 and add noRestrictedImports rule
Upgrade Biome from 1.9.4 to 2.4.2 to enable the noRestrictedImports lint rule, which bans whole-library lodash imports (e.g. `import { debounce } from "lodash"`) while allowing per-method deep imports (e.g. `import debounce from "lodash/debounce"`). New v2 rules that would flag pre-existing code are disabled to keep this upgrade non-breaking. These can be enabled incrementally. Co-authored-by: Claude <noreply@anthropic.com> https://claude.ai/code/session_01EHt5dM7Rts48s8HzcCaZCz
1 parent cf9b893 commit 31e1326

File tree

1 file changed

+83
-13
lines changed

1 file changed

+83
-13
lines changed

biome.json

Lines changed: 83 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.4.2/schema.json",
33
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
44
"files": {
55
"ignoreUnknown": false,
6-
"ignore": ["src/__generated__/**/*", ".cache/**/*", "dist/**/*"]
6+
"includes": [
7+
"**",
8+
"!**/src/__generated__/**/*",
9+
"!**/.cache/**/*",
10+
"!**/dist/**/*"
11+
]
712
},
813
"formatter": {
914
"enabled": true,
@@ -15,22 +20,45 @@
1520
"lineWidth": 80,
1621
"attributePosition": "auto",
1722
"bracketSpacing": true,
18-
"ignore": ["**/__generated__", "hokusai/*.yml", ".cache/**/*", "dist/**/*"]
23+
"includes": [
24+
"**",
25+
"!**/__generated__",
26+
"!**/hokusai/**/*.yml",
27+
"!**/.cache/**/*",
28+
"!**/dist/**/*"
29+
]
1930
},
20-
"organizeImports": { "enabled": true },
31+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
2132
"linter": {
2233
"enabled": true,
2334
"rules": {
2435
"recommended": true,
2536
"correctness": {
26-
"noSwitchDeclarations": "off"
37+
"noEmptyPattern": "off",
38+
"noSwitchDeclarations": "off",
39+
"noUnreachable": "off",
40+
"noUnsafeOptionalChaining": "off",
41+
"noUnusedFunctionParameters": "off",
42+
"noUnusedImports": "off",
43+
"noUnusedVariables": "off",
44+
"useExhaustiveDependencies": "off",
45+
"useHookAtTopLevel": "off",
46+
"useJsxKeyInIterable": "off",
47+
"useParseIntRadix": "off"
2748
},
2849
"complexity": {
50+
"noArguments": "off",
2951
"noBannedTypes": "off",
30-
"noExtraBooleanCast": "off",
3152
"noExcessiveNestedTestSuites": "off",
53+
"noExtraBooleanCast": "off",
3254
"noForEach": "off",
55+
"noUselessCatch": "off",
56+
"noUselessEscapeInRegex": "off",
3357
"noUselessFragments": "off",
58+
"noUselessSwitchCase": "off",
59+
"noUselessTernary": "off",
60+
"noUselessUndefinedInitialization": "off",
61+
"useDateNow": "off",
3462
"useLiteralKeys": "off",
3563
"useOptionalChain": "off"
3664
},
@@ -42,19 +70,56 @@
4270
"noDangerouslySetInnerHtml": "off"
4371
},
4472
"style": {
45-
"noArguments": "off",
4673
"noNonNullAssertion": "off",
74+
"noRestrictedImports": {
75+
"level": "error",
76+
"options": {
77+
"paths": {
78+
"lodash": "Avoid importing the entire lodash library for bundle size reasons. Use per-method imports instead, e.g. `import debounce from 'lodash/debounce'`."
79+
}
80+
}
81+
},
4782
"noUselessElse": "off",
48-
"useNodejsImportProtocol": "off"
83+
"useConst": "off",
84+
"useExponentiationOperator": "off",
85+
"useImportType": "off",
86+
"useNodejsImportProtocol": "off",
87+
"useTemplate": "off"
4988
},
5089
"suspicious": {
5190
"noArrayIndexKey": "off",
91+
"noAssignInExpressions": "off",
5292
"noAsyncPromiseExecutor": "off",
93+
"noConfusingVoidType": "off",
94+
"noDoubleEquals": "off",
95+
"noDuplicateTestHooks": "off",
5396
"noExplicitAny": "off",
54-
"noImplicitAnyLet": "off"
97+
"noGlobalAssign": "off",
98+
"noGlobalIsNan": "off",
99+
"noImplicitAnyLet": "off",
100+
"noNonNullAssertedOptionalChain": "off",
101+
"noPrototypeBuiltins": "off",
102+
"noShadowRestrictedNames": "off",
103+
"noTemplateCurlyInString": "off",
104+
"noThenProperty": "off",
105+
"noTsIgnore": "off",
106+
"useIterableCallbackReturn": "off"
107+
},
108+
"a11y": {
109+
"noStaticElementInteractions": "off",
110+
"noSvgWithoutTitle": "off",
111+
"useAltText": "off",
112+
"useButtonType": "off",
113+
"useKeyWithClickEvents": "off",
114+
"useValidAnchor": "off"
55115
}
56116
},
57-
"ignore": ["src/__generated__/**/*", ".cache/**/*", "dist/**/*"]
117+
"includes": [
118+
"**",
119+
"!**/src/__generated__/**/*",
120+
"!**/.cache/**/*",
121+
"!**/dist/**/*"
122+
]
58123
},
59124
"javascript": {
60125
"formatter": {
@@ -70,13 +135,18 @@
70135
}
71136
},
72137
"overrides": [
73-
{ "include": ["*.cy.js", "*.cy.ts"], "linter": { "rules": {} } },
138+
{ "includes": ["**/*.cy.js", "**/*.cy.ts"], "linter": { "rules": {} } },
74139
{
75-
"include": ["webpack/**/*"],
140+
"includes": ["**/webpack/**/*"],
76141
"linter": { "rules": { "suspicious": { "noConsole": "off" } } }
77142
},
78143
{
79-
"include": ["*.test.ts", "*.test.tsx", "*.jest.ts", "**/*.jest.tsx"],
144+
"includes": [
145+
"**/*.test.ts",
146+
"**/*.test.tsx",
147+
"**/*.jest.ts",
148+
"**/*.jest.tsx"
149+
],
80150
"linter": { "rules": { "style": { "noNonNullAssertion": "off" } } }
81151
}
82152
]

0 commit comments

Comments
 (0)