Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Prettier & ESLint to Biome #1267

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install && npm test && npm run lint
- run: npm install && npm test && npm run check
env:
CI: true
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

46 changes: 46 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"files": {
"include": ["src/**/*.ts", "test/**/*.ts"]
},
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noUselessTypeConstraint": "off",
"noBannedTypes": "off",
"useArrowFunction": "off"
},
"suspicious": {
"noAssignInExpressions": "off",
"noExplicitAny": "off",
"noGlobalIsNan": "off",
"noImplicitAnyLet": "off"
},
"style": {
"noParameterAssign": "off",
"useNumberNamespace": "off",
"noNonNullAssertion": "off",
"noUselessElse": "off",
"useImportType": "off",
"useConst": "off",
"useNodejsImportProtocol": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "es5"
}
}
}
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,28 @@
"node": ">=14.0.0"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/expect": "^24.3.0",
"@types/lodash": "^4.14.144",
"@types/node": "^18.7.14",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"lodash": "^4.17.15",
"np": "^10.0.0",
"prettier": "^3.2.5",
"rollup": "^4.12.1",
"typescript": "^4.8.3",
"vitest": "^1.6.0"
},
"scripts": {
"build": "rm -rf ./{dist} && rollup --config ./rollup.config.js",
"clean": "rm -rf ./{dist,node_modules}",
"fix": "npm run fix:eslint && npm run fix:prettier",
"fix:eslint": "npm run lint:eslint --fix",
"fix:prettier": "prettier '**/*.{js,json,ts}' --write",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint '{src,test}/*.{js,ts}'",
"lint:prettier": "prettier '**/*.{js,json,ts}' --check",
"fix": "npx @biomejs/biome check --write .",
"fix:lint": "npx @biomejs/biome lint --write .",
"fix:format": "npx @biomejs/biome format --write .",
"check": "npx @biomejs/biome check .",
"check:lint": "npx @biomejs/biome lint .",
"check:format": "npx @biomejs/biome format .",
"release": "npm run build && npm run lint && np",
"test": "npm run build && npm run test:types && npm run test:vitest",
"test:types": "tsc --noEmit && tsc --project ./test/tsconfig.json --noEmit",
Expand Down
19 changes: 13 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ export function* run<T, S>(
*/

export type UnionToIntersection<U> = (
U extends any ? (arg: U) => any : never
U extends any
? (arg: U) => any
: never
) extends (arg: infer I) => void
? I
: never
Expand Down Expand Up @@ -230,10 +232,11 @@ export type IsMatch<T, G> = T extends G ? (G extends T ? T : never) : never
* Check if a type is an exact match.
*/

export type IsExactMatch<T, U> =
(<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2
? T
: never
export type IsExactMatch<T, U> = (<G>() => G extends T ? 1 : 2) extends <
G,
>() => G extends U ? 1 : 2
? T
: never

/**
* Check if a type is a record type.
Expand Down Expand Up @@ -265,7 +268,11 @@ export type IsTuple<T> = T extends [any]
*/

export type IsUnion<T, U extends T = T> = (
T extends any ? (U extends T ? false : true) : false
T extends any
? U extends T
? false
: true
: false
) extends false
? never
: T
Expand Down