mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 02:21:51 +08:00
chore: migrate oxlint & oxfmt (#15464)
#### PR Dependency Tree * **PR #15464** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Replaced the project’s formatting and linting workflow with Oxfmt and Oxlint. * Added shared formatting and linting configuration, editor integration, and updated automated checks. * Updated generated files, scripts, and lint guidance to use the new tooling. * **Style** * Reformatted templates, source code, examples, and configuration files for consistent readability. * No user-facing functionality or rendering behavior changed. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -52,7 +52,7 @@ export class NGramTokenizer implements Tokenizer {
|
||||
|
||||
tokenize(text: string): Token[] {
|
||||
const splitted: Token[] = [];
|
||||
for (let i = 0; i < text.length; ) {
|
||||
for (let i = 0; i < text.length;) {
|
||||
const nextBreak = Graphemer.nextBreak(text, i);
|
||||
const c = text.substring(i, nextBreak);
|
||||
|
||||
@@ -119,7 +119,7 @@ export class GeneralTokenizer implements Tokenizer {
|
||||
let end = 0;
|
||||
let lang: string | null = null;
|
||||
|
||||
for (let i = 0; i < text.length; ) {
|
||||
for (let i = 0; i < text.length;) {
|
||||
const nextBreak = Graphemer.nextBreak(text, i);
|
||||
const c = text.substring(i, nextBreak);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export class IndexedDBLocker implements Locker {
|
||||
async lock(domain: string, resource: string) {
|
||||
const key = `${domain}:${resource}`;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
// oxlint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const trx = this.db.transaction('locks', 'readwrite');
|
||||
const record = await trx.store.get(key);
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Lock {
|
||||
private release: () => void = () => {};
|
||||
|
||||
async acquire() {
|
||||
// oxlint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
// oxlint-disable-next-line typescript/no-non-null-assertion
|
||||
let release: () => void = null!;
|
||||
const nextLock = new Promise<void>(resolve => {
|
||||
release = resolve;
|
||||
|
||||
@@ -190,7 +190,7 @@ export class BlobSyncImpl implements BlobSync {
|
||||
): Promise<void> {
|
||||
return Promise.race([
|
||||
Promise.all(
|
||||
// oxlint-disable-next-line @typescript-eslint/await-thenable
|
||||
// oxlint-disable-next-line typescript/await-thenable
|
||||
peerId
|
||||
? [this.fullDownloadPeer(peerId)]
|
||||
: this.peers.map(p => this.fullDownloadPeer(p.peerId))
|
||||
|
||||
@@ -94,7 +94,7 @@ export class BlobSyncPeer {
|
||||
Math.pow(2, attempts - 1) * backoffRetry.delay,
|
||||
backoffRetry.maxDelay
|
||||
);
|
||||
// oxlint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
// oxlint-disable-next-line typescript/no-misused-promises
|
||||
setTimeout(attempt, waitTime);
|
||||
} else {
|
||||
// reach the max retry times, resolve the promise with false
|
||||
@@ -107,7 +107,7 @@ export class BlobSyncPeer {
|
||||
}
|
||||
};
|
||||
|
||||
// oxlint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
// oxlint-disable-next-line typescript/no-floating-promises
|
||||
attempt();
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user