Skip to content

Commit ba5a17c

Browse files
author
Abinash Karmakar
committed
Add biome configuration and update linting scripts in package.json
1 parent 2494395 commit ba5a17c

File tree

4 files changed

+139
-2
lines changed

4 files changed

+139
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ To learn more about React Native, take a look at the following resources:
9696
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
9797
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
9898

99-
CHANGE
99+
CHANGE

biome.json

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4+
"files": { "ignoreUnknown": false, "ignore": ["src/assets/animations/json", "**/build", "**/.gradle"] },
5+
"formatter": {
6+
"enabled": true,
7+
"useEditorconfig": true,
8+
"formatWithErrors": false,
9+
"indentStyle": "space",
10+
"indentWidth": 2,
11+
"lineEnding": "lf",
12+
"lineWidth": 120,
13+
"attributePosition": "auto",
14+
"bracketSpacing": true,
15+
"ignore": ["src/rpc/"]
16+
},
17+
"organizeImports": { "enabled": true },
18+
"linter": {
19+
"enabled": true,
20+
"rules": {
21+
"recommended": false,
22+
"complexity": {
23+
"noExtraBooleanCast": "warn",
24+
"noMultipleSpacesInRegularExpressionLiterals": "warn",
25+
"noUselessLoneBlockStatements": "warn",
26+
"noUselessUndefinedInitialization": "warn",
27+
"noVoid": "warn",
28+
"noWith": "warn",
29+
"useLiteralKeys": "warn"
30+
},
31+
"correctness": {
32+
"noConstAssign": "error",
33+
"noConstantCondition": "off",
34+
"noEmptyCharacterClassInRegex": "warn",
35+
"noGlobalObjectCalls": "warn",
36+
"noInnerDeclarations": "off",
37+
"noInvalidUseBeforeDeclaration": "off",
38+
"noUndeclaredVariables": "error",
39+
"noUnreachable": "error",
40+
"noUnusedVariables": "warn",
41+
"useArrayLiterals": "warn",
42+
"useExhaustiveDependencies": "warn",
43+
"useHookAtTopLevel": "error",
44+
"useIsNan": "warn"
45+
},
46+
"security": { "noGlobalEval": "error" },
47+
"style": {
48+
"noCommaOperator": "warn",
49+
"noYodaExpression": "warn",
50+
"useBlockStatements": "off",
51+
"useCollapsedElseIf": "off",
52+
"useConsistentBuiltinInstantiation": "warn",
53+
"useDefaultSwitchClause": "off",
54+
"useSingleVarDeclarator": "off"
55+
},
56+
"suspicious": {
57+
"noCatchAssign": "warn",
58+
"noCommentText": "error",
59+
"noConsole": "off",
60+
"noControlCharactersInRegex": "warn",
61+
"noDebugger": "warn",
62+
"noDoubleEquals": "warn",
63+
"noDuplicateClassMembers": "error",
64+
"noDuplicateJsxProps": "error",
65+
"noDuplicateObjectKeys": "error",
66+
"noEmptyBlockStatements": "off",
67+
"noFallthroughSwitchClause": "warn",
68+
"noFunctionAssign": "warn",
69+
"noGlobalAssign": "error",
70+
"noLabelVar": "warn",
71+
"noRedeclare": "off",
72+
"noSelfCompare": "warn",
73+
"noShadowRestrictedNames": "warn",
74+
"noSparseArray": "warn",
75+
"useValidTypeof": "warn"
76+
}
77+
},
78+
"ignore": ["src/rpc/"]
79+
},
80+
"javascript": {
81+
"formatter": {
82+
"jsxQuoteStyle": "single",
83+
"quoteProperties": "asNeeded",
84+
"trailingCommas": "all",
85+
"semicolons": "asNeeded",
86+
"arrowParentheses": "always",
87+
"bracketSameLine": false,
88+
"quoteStyle": "single",
89+
"attributePosition": "auto",
90+
"bracketSpacing": true
91+
},
92+
"globals": [
93+
"clearImmediate",
94+
"queueMicrotask",
95+
"Blob",
96+
"Set",
97+
"Promise",
98+
"requestIdleCallback",
99+
"setImmediate",
100+
"requestAnimationFrame",
101+
"File",
102+
"Map",
103+
"__DEV__",
104+
"WebSocket"
105+
]
106+
},
107+
"overrides": [
108+
{ "include": ["*.js"], "linter": { "rules": {} } },
109+
{ "include": ["*.jsx"] },
110+
{
111+
"include": ["*.ts", "*.tsx"],
112+
"linter": { "rules": { "correctness": { "noUndeclaredVariables": "off", "noUnusedVariables": "off" } } }
113+
},
114+
{ "include": ["*.{spec,test}.{js,ts,tsx}", "**/__{mocks,tests}__/**/*.{js,ts,tsx}"], "linter": { "rules": {} } }
115+
]
116+
}

bun.lock

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@babel/core": "^7.26.9",
3535
"@babel/preset-env": "^7.26.9",
3636
"@babel/runtime": "^7.26.9",
37+
"@biomejs/biome": "1.9.4",
3738
"@react-native-community/cli": "15.1.3",
3839
"@react-native-community/cli-platform-android": "15.1.3",
3940
"@react-native-community/cli-platform-ios": "15.1.3",
@@ -305,6 +306,24 @@
305306

306307
"@bcoe/v8-coverage": ["@bcoe/[email protected]", "", {}, "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw=="],
307308

309+
"@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
310+
311+
"@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="],
312+
313+
"@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="],
314+
315+
"@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="],
316+
317+
"@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="],
318+
319+
"@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="],
320+
321+
"@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="],
322+
323+
"@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="],
324+
325+
"@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="],
326+
308327
"@egjs/hammerjs": ["@egjs/[email protected]", "", { "dependencies": { "@types/hammerjs": "^2.0.36" } }, "sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A=="],
309328

310329
"@eslint-community/eslint-utils": ["@eslint-community/[email protected]", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA=="],

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scripts": {
66
"android": "react-native run-android --active-arch-only",
77
"ios": "react-native run-ios",
8-
"lint": "eslint .",
8+
"lint": "biome lint",
9+
"format": "biome format --write",
910
"dev": "react-native start",
1011
"test": "jest",
1112
"build": "cd android && gradlew assembleRelease && cd .. && npm run install-release-apk",
@@ -49,6 +50,7 @@
4950
"@babel/core": "^7.26.9",
5051
"@babel/preset-env": "^7.26.9",
5152
"@babel/runtime": "^7.26.9",
53+
"@biomejs/biome": "1.9.4",
5254
"@react-native-community/cli": "15.1.3",
5355
"@react-native-community/cli-platform-android": "15.1.3",
5456
"@react-native-community/cli-platform-ios": "15.1.3",

0 commit comments

Comments
 (0)