[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:
Dan Groshev 2024-02-05 17:54:02 +00:00 committed by GitHub
parent 826433751c
commit e6e4e7f6cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 286 additions and 264 deletions

View file

@ -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)

View file

@ -115,8 +115,8 @@ export function generateSection(section: InputSection, articles: Articles, index
section.id === 'getting-started'
? `/${articleId}`
: isUncategorized
? `/${section.id}/${articleId}`
: `/${section.id}/${categoryId}/${articleId}`,
? `/${section.id}/${articleId}`
: `/${section.id}/${categoryId}/${articleId}`,
}
if (isExamples) {

View file

@ -161,8 +161,8 @@ export class ContentDatabase {
sectionId === 'examples'
? this._sidebarExamplesContentLinks
: sectionId === 'reference'
? this._sidebarReferenceContentLinks
: this._sidebarContentLinks
? this._sidebarReferenceContentLinks
: this._sidebarContentLinks
if (cachedLinks && process.env.NODE_ENV !== 'development') {
// Use the previously cached sidebar links
links = cachedLinks

View file

@ -217,8 +217,8 @@ export async function getVectorDb(
INCLUDE_API_CONTENT && INCLUDE_CONTENT
? await db.all('SELECT * FROM articles')
: INCLUDE_API_CONTENT
? await db.all('SELECT * FROM articles WHERE articles.sectionId = ?', 'reference')
: await db.all('SELECT * FROM articles WHERE articles.sectionId != ?', 'reference')
? await db.all('SELECT * FROM articles WHERE articles.sectionId = ?', 'reference')
: await db.all('SELECT * FROM articles WHERE articles.sectionId != ?', 'reference')
nicelog(`Adding articles to index`)
const max = Math.min(articles.length, MAX_ARTICLES)