Skip to content

Commit 2d6e6cc

Browse files
burakunal28gemxx
authored andcommitted
feat: add Biome configuration for code formatting
Add biome.json configuration with comprehensive formatting rules Configure 2-space indentation and 90-character line width Set up file inclusion/exclusion patterns for proper scope Add format script to package.json for easy code formatting Apply consistent formatting across all JavaScript/TypeScript files Exclude test files, build outputs, and third-party dependencies Improve code consistency and maintainability across the project
1 parent 4f910df commit 2d6e6cc

File tree

5 files changed

+121
-187
lines changed

5 files changed

+121
-187
lines changed

.eslintignore

Lines changed: 0 additions & 20 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 139 deletions
This file was deleted.

.prettierrc.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

biome.json

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"includes": [
11+
"**",
12+
"!**/node_modules/**",
13+
"!**/browser/**",
14+
"!**/dist/**",
15+
"!**/fixtures/**",
16+
"!**/examples/**",
17+
"!**/__tests__/**",
18+
"!/**/dist/**",
19+
"!/**/es/**",
20+
"!/**/lib/**",
21+
"!/**/liv/**",
22+
"!/**/browser/**",
23+
"!**/jest.config.js",
24+
"!**/jest.setup.js",
25+
"!**/babel.config.js",
26+
"!**/packages/xgplayer-shaka/**",
27+
"!**/packages/xgplayer-helper-transmuxers/**",
28+
"!**/packages/xgplayer-helper-utils/**",
29+
"!**/packages/xgplayer-m4a/**",
30+
"!**/packages/xgplayer-xgvideo/src/decoder/wasm/**",
31+
"!**/packages/xgplayer-xgvideo/src/decoder/webcodec/**",
32+
"!**/packages/xgplayer-xgvideo/src/polyfills/**",
33+
"!**/packages/xgplayer-flv.js/src/flv/**",
34+
"!**/packages/xgplayer-hls.js/src/hls.js/**",
35+
"!**/packages/xgplayer-transmuxer/__tests__/movies/**",
36+
"*.json",
37+
"*.js",
38+
"*.ts",
39+
"*.tsx",
40+
"*.jsx",
41+
"*.cjs",
42+
"*.mjs",
43+
"*.md"
44+
]
45+
},
46+
"formatter": {
47+
"enabled": true,
48+
"indentStyle": "space",
49+
"indentWidth": 2,
50+
"lineWidth": 90,
51+
"lineEnding": "lf"
52+
},
53+
"javascript": {
54+
"formatter": {
55+
"quoteStyle": "single",
56+
"quoteProperties": "asNeeded",
57+
"semicolons": "asNeeded",
58+
"trailingCommas": "none",
59+
"arrowParentheses": "asNeeded",
60+
"bracketSpacing": true,
61+
"bracketSameLine": false
62+
},
63+
"globals": ["__VERSION__", "__DEV__", "module", "fetch", "Headers", "global"]
64+
},
65+
"linter": {
66+
"enabled": true,
67+
"rules": {
68+
"recommended": true,
69+
"complexity": {
70+
"noExtraBooleanCast": "off",
71+
"noStaticOnlyClass": "off",
72+
"useOptionalChain": "warn",
73+
"noArguments": "off"
74+
},
75+
"correctness": {
76+
"noConstantCondition": "off",
77+
"noConstructorReturn": "error",
78+
"useExhaustiveDependencies": "off"
79+
},
80+
"style": {
81+
"useConst": "warn",
82+
"useTemplate": "warn"
83+
},
84+
"suspicious": {
85+
"noAssignInExpressions": "off",
86+
"noControlCharactersInRegex": "off",
87+
"noDoubleEquals": "error",
88+
"noPrototypeBuiltins": "off",
89+
"noShadowRestrictedNames": "off",
90+
"noExplicitAny": "off",
91+
"noDuplicateClassMembers": "off",
92+
"noGlobalAssign": "off",
93+
"noImplicitAnyLet": "off"
94+
},
95+
"nursery": {
96+
"noUnassignedVariables": "error"
97+
}
98+
}
99+
},
100+
"assist": {
101+
"enabled": true,
102+
"actions": {
103+
"source": {
104+
"organizeImports": "on"
105+
}
106+
}
107+
},
108+
"overrides": [
109+
{
110+
"includes": ["packages/**/*.js"],
111+
"javascript": {
112+
"globals": ["fetch", "Headers", "global"]
113+
}
114+
}
115+
]
116+
}

package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"build": "yarn libd build",
2020
"build:all": "yarn libd build -a",
2121
"release": "yarn libd release",
22-
"lint": "eslint packages --fix",
22+
"lint": "biome check --write packages",
23+
"format": "biome format --write",
2324
"test": "jest --verbose",
2425
"test:watch": "jest --watch",
2526
"test:coverage": "jest --coverage",
@@ -59,10 +60,11 @@
5960
"homepage": "https://github.com/bytedance/xgplayer#readme",
6061
"devDependencies": {
6162
"@babel/core": "^7.17.9",
62-
"@babel/eslint-parser": "^7.14.3",
63+
6364
"@babel/parser": "^7.15.3",
6465
"@babel/preset-env": "^7.16.11",
6566
"@babel/preset-typescript": "^7.26.0",
67+
"@biomejs/biome": "2.1.3",
6668
"@rollup/plugin-babel": "^5.3.1",
6769
"@types/events": "^3.0.0",
6870
"@types/jest": "^28.1.1",
@@ -79,12 +81,7 @@
7981
"core-js": "3.12.1",
8082
"dts-bundle-generator": "^6.4.0",
8183
"enquirer": "^2.3.6",
82-
"eslint": "^7.28.0",
83-
"eslint-plugin-import": "^2.23.4",
84-
"eslint-plugin-no-lookahead-lookbehind-regexp": "^0.1.0",
85-
"eslint-plugin-node": "^11.1.0",
86-
"eslint-plugin-promise": "^5.1.0",
87-
"eslint-plugin-standard": "^3.1.0",
84+
8885
"execa": "^5.1.1",
8986
"fs-extra": "^10.0.0",
9087
"jest": "^28.1.1",

0 commit comments

Comments
 (0)