[dx] use Biome instead of Prettier, part 2 (#2731)
Biome seems to be MUCH faster than Prettier. Unfortunately, it introduces some formatting changes around the ternary operator, so we have to update files in the repo. To make revert easier if we need it, the change is split into two PRs. This PR introduces a Biome CI check and reformats all files accordingly. ## Change Type - [x] `minor` — New feature
This commit is contained in:
parent
826433751c
commit
e6e4e7f6cb
56 changed files with 286 additions and 264 deletions
4
.github/workflows/checks.yml
vendored
4
.github/workflows/checks.yml
vendored
|
@ -41,8 +41,8 @@ jobs:
|
|||
- name: Setup Biome CLI
|
||||
uses: biomejs/setup-biome@v2
|
||||
|
||||
# - name: Run Biome
|
||||
# run: biome ci --formatter-enabled=true --linter-enabled=false --organize-imports-enabled=false .
|
||||
- name: Run Biome
|
||||
run: biome ci --formatter-enabled=true --linter-enabled=false --organize-imports-enabled=false .
|
||||
|
||||
- name: Typecheck
|
||||
run: yarn build-types
|
||||
|
|
|
@ -109,7 +109,9 @@ export async function GET(req: NextRequest) {
|
|||
}
|
||||
})
|
||||
|
||||
Object.keys(results).forEach((section: string) => results[section as keyof Data['results']].sort((a, b) => b.score - a.score))
|
||||
Object.keys(results).forEach((section: string) =>
|
||||
results[section as keyof Data['results']].sort((a, b) => b.score - a.score)
|
||||
)
|
||||
|
||||
results.articles.sort(
|
||||
(a, b) => (b.type === 'heading' ? -1 : 1) - (a.type === 'heading' ? -1 : 1)
|
||||
|
|
|
@ -3,9 +3,11 @@ import { AlarmScheduler } from './AlarmScheduler'
|
|||
|
||||
jest.useFakeTimers()
|
||||
|
||||
function makeMockAlarmScheduler<Key extends string>(alarms: {
|
||||
function makeMockAlarmScheduler<Key extends string>(
|
||||
alarms: {
|
||||
[K in Key]: jest.Mock<Promise<void>, []>
|
||||
}) {
|
||||
}
|
||||
) {
|
||||
const data = new Map<string, number>()
|
||||
let scheduledAlarm: number | null = null
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ export function LocalMigration() {
|
|||
|
||||
useEffect(() => {
|
||||
let didCancel = false
|
||||
|
||||
;(async () => {
|
||||
if (!isEditorEmpty(editor)) return
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ const InsideOfEditorContext = () => {
|
|||
return null
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Introduction:
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
[
|
||||
["functions", ["atom-1", "computed-1", "react", "reactor-1", "transact", "transaction"]],
|
||||
[
|
||||
"functions",
|
||||
["atom-1", "computed-1", "react", "reactor-1", "transact", "transaction"]
|
||||
],
|
||||
["classes"],
|
||||
["interfaces", ["Signal"]]
|
||||
]
|
||||
|
|
|
@ -91,11 +91,16 @@ const CurrentState = track(function CurrentState() {
|
|||
const shape = path === 'select.idle' || !path.includes('select.') ? hoverShape : selectedShape
|
||||
const shapeInfo =
|
||||
shape && path.includes('select.')
|
||||
? ` / ${shape.type || ''}${'geo' in shape.props ? ' / ' + shape.props.geo : ''} / [${Vec.ToFixed(editor.getPointInShapeSpace(shape, editor.inputs.currentPagePoint), 0)}]`
|
||||
? ` / ${shape.type || ''}${
|
||||
'geo' in shape.props ? ' / ' + shape.props.geo : ''
|
||||
} / [${Vec.ToFixed(editor.getPointInShapeSpace(shape, editor.inputs.currentPagePoint), 0)}]`
|
||||
: ''
|
||||
const ruler =
|
||||
path.startsWith('select.') && !path.includes('.idle')
|
||||
? ` / [${Vec.ToFixed(editor.inputs.originPagePoint, 0)}] → [${Vec.ToFixed(editor.inputs.currentPagePoint, 0)}] = ${Vec.Dist(editor.inputs.originPagePoint, editor.inputs.currentPagePoint).toFixed(0)}`
|
||||
? ` / [${Vec.ToFixed(editor.inputs.originPagePoint, 0)}] → [${Vec.ToFixed(
|
||||
editor.inputs.currentPagePoint,
|
||||
0
|
||||
)}] = ${Vec.Dist(editor.inputs.originPagePoint, editor.inputs.currentPagePoint).toFixed(0)}`
|
||||
: ''
|
||||
|
||||
return <div className="tlui-debug-panel__current-state">{`${path}${shapeInfo}${ruler}`}</div>
|
||||
|
|
|
@ -50,8 +50,10 @@ type DefaultHelpers = ReturnType<typeof useDefaultHelpers>
|
|||
|
||||
export type TLUiOverride<Type, Helpers> = (editor: Editor, schema: Type, helpers: Helpers) => Type
|
||||
|
||||
type WithDefaultHelpers<T extends TLUiOverride<any, any>> =
|
||||
T extends TLUiOverride<infer Type, infer Helpers>
|
||||
type WithDefaultHelpers<T extends TLUiOverride<any, any>> = T extends TLUiOverride<
|
||||
infer Type,
|
||||
infer Helpers
|
||||
>
|
||||
? TLUiOverride<Type, Helpers extends undefined ? DefaultHelpers : Helpers & DefaultHelpers>
|
||||
: never
|
||||
|
||||
|
|
|
@ -58,9 +58,11 @@ export function deepCopy<T = unknown>(obj: T): T {
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
export function objectMapKeys<Key extends string>(object: {
|
||||
export function objectMapKeys<Key extends string>(
|
||||
object: {
|
||||
readonly [K in Key]: unknown
|
||||
}): Array<Key> {
|
||||
}
|
||||
): Array<Key> {
|
||||
return Object.keys(object) as Key[]
|
||||
}
|
||||
|
||||
|
@ -70,9 +72,11 @@ export function objectMapKeys<Key extends string>(object: {
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
export function objectMapValues<Key extends string, Value>(object: {
|
||||
export function objectMapValues<Key extends string, Value>(
|
||||
object: {
|
||||
[K in Key]: Value
|
||||
}): Array<Value> {
|
||||
}
|
||||
): Array<Value> {
|
||||
return Object.values(object) as Value[]
|
||||
}
|
||||
|
||||
|
@ -82,9 +86,11 @@ export function objectMapValues<Key extends string, Value>(object: {
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
export function objectMapEntries<Key extends string, Value>(object: {
|
||||
export function objectMapEntries<Key extends string, Value>(
|
||||
object: {
|
||||
[K in Key]: Value
|
||||
}): Array<[Key, Value]> {
|
||||
}
|
||||
): Array<[Key, Value]> {
|
||||
return Object.entries(object) as [Key, Value][]
|
||||
}
|
||||
|
||||
|
|
|
@ -242,9 +242,11 @@ export class ObjectValidator<Shape extends object> extends Validator<Shape> {
|
|||
* })
|
||||
* ```
|
||||
*/
|
||||
extend<Extension extends Record<string, unknown>>(extension: {
|
||||
extend<Extension extends Record<string, unknown>>(
|
||||
extension: {
|
||||
readonly [K in keyof Extension]: Validatable<Extension[K]>
|
||||
}): ObjectValidator<Shape & Extension> {
|
||||
}
|
||||
): ObjectValidator<Shape & Extension> {
|
||||
return new ObjectValidator({ ...this.config, ...extension }) as ObjectValidator<
|
||||
Shape & Extension
|
||||
>
|
||||
|
@ -470,9 +472,11 @@ export const unknownObject = new Validator<Record<string, unknown>>((value) => {
|
|||
*
|
||||
* @public
|
||||
*/
|
||||
export function object<Shape extends object>(config: {
|
||||
export function object<Shape extends object>(
|
||||
config: {
|
||||
readonly [K in keyof Shape]: Validatable<Shape[K]>
|
||||
}): ObjectValidator<Shape> {
|
||||
}
|
||||
): ObjectValidator<Shape> {
|
||||
return new ObjectValidator(config)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue