From 6a30926b5efa1619654d56cd3ec25cdb24020e33 Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Mon, 14 Sep 2026 14:14:02 +0200 Subject: [PATCH 1/2] few more tweaks for lint tools detection, add to statistics --- pages/api/libraries/statistic.ts | 12 ++++++++++++ scripts/fetch-github-data.ts | 8 ++++---- types/index.ts | 5 ++++- util/github/detectModuleType.ts | 4 ++-- util/github/hasFiles.ts | 2 ++ 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/pages/api/libraries/statistic.ts b/pages/api/libraries/statistic.ts index d130b88a8..99e562e3d 100644 --- a/pages/api/libraries/statistic.ts +++ b/pages/api/libraries/statistic.ts @@ -35,6 +35,14 @@ export default function handler(_: NextApiRequest, res: NextApiResponse) { npm: 0, yarn: 0, }, + lintTools: { + oxlint: 0, + oxfmt: 0, + eslint: 0, + prettier: 0, + biome: 0, + commitlint: 0, + }, }; DATASET.libraries.forEach(library => { @@ -120,6 +128,10 @@ export default function handler(_: NextApiRequest, res: NextApiResponse) { result.vegaos++; } + library.github.lintTools?.forEach(tool => { + result.lintTools[tool]++; + }); + if (library.github.packageManager) { if (library.github.packageManager.includes('bun')) { result.packageManager.bun++; diff --git a/scripts/fetch-github-data.ts b/scripts/fetch-github-data.ts index 8913f62f7..374b806e0 100644 --- a/scripts/fetch-github-data.ts +++ b/scripts/fetch-github-data.ts @@ -168,7 +168,6 @@ function createRepoDataWithResponse(json: any, monorepo: boolean): LibraryType[' try { const packageJson = JSON.parse(json.packageJson.text); - json.pasedPackageJson = packageJson; json.newArchitecture = Boolean(packageJson.codegenConfig); json.name = packageJson.name; json.isPackagePrivate = packageJson.private ?? false; @@ -177,6 +176,8 @@ function createRepoDataWithResponse(json: any, monorepo: boolean): LibraryType[' ? Object.keys(packageJson.dependencies).length : 0; json.packageManager = packageJson.packageManager ?? undefined; + json.lintTools = getLintToolsFromPackageJson(packageJson); + json.moduleType = detectModuleType(json.files, packageJson); if (monorepo) { json.homepageUrl = packageJson.homepage; @@ -196,7 +197,6 @@ function createRepoDataWithResponse(json: any, monorepo: boolean): LibraryType[' json.description = packageJson.description ?? json.description; json.homepageUrl = packageJson.homepage ?? json.homepageUrl; - json.lintTools = getLintToolsFromPackageJson(packageJson); if (!json.licenseInfo || json.licenseInfo?.key === 'other') { json.licenseInfo = getLicenseFromPackageJson(packageJson) ?? json.licenseInfo; @@ -263,7 +263,7 @@ function createRepoDataWithResponse(json: any, monorepo: boolean): LibraryType[' hasSecurity: hasSecurityFile(json.files) || hasSecurityFile(json.rootFiles), hasNativeCode: hasNativeCode(json.files), configPlugin: hasConfigPlugin(json.files), - moduleType: detectModuleType(json.files, json.pasedPackageJson), + moduleType: json.moduleType, packageManager: json.packageManager ?? detectPackageManager(json.files) ?? @@ -272,6 +272,6 @@ function createRepoDataWithResponse(json: any, monorepo: boolean): LibraryType[' ...json.lintTools, ...detectLintStack(json.files), ...detectLintStack(json.rootFiles), - ]), + ]).sort((a, b) => a.localeCompare(b)), }; } diff --git a/types/index.ts b/types/index.ts index 375e8d9c2..2ca17ec82 100644 --- a/types/index.ts +++ b/types/index.ts @@ -99,7 +99,7 @@ export type LibraryType = LibraryDataEntryType & { hasCC?: boolean; hasSecurity?: boolean; configPlugin?: boolean; - moduleType?: 'expo' | 'nitro' | 'turbo'; + moduleType?: ModuleType; packageManager?: string; lintTools?: LintTool[]; urls: { @@ -253,6 +253,7 @@ export type StatisticResultType = { tvos: number; visionos: number; vegaos: number; + lintTools: Record; packageManager: { bun: number; pnpm: number; @@ -424,4 +425,6 @@ export type PackageNavigationTab = { counter?: number | string; }; +export type ModuleType = 'expo' | 'nitro' | 'turbo'; + export type LintTool = 'oxlint' | 'oxfmt' | 'eslint' | 'prettier' | 'biome' | 'commitlint'; diff --git a/util/github/detectModuleType.ts b/util/github/detectModuleType.ts index c422bede8..4a8710088 100644 --- a/util/github/detectModuleType.ts +++ b/util/github/detectModuleType.ts @@ -1,9 +1,9 @@ -import { type RepositoryTreeNode } from '~/types'; +import { type ModuleType, type RepositoryTreeNode } from '~/types'; export default function detectModuleType( rootFiles: { entries: RepositoryTreeNode[] } | null, packageJson: any -) { +): ModuleType | undefined { if (!rootFiles?.entries.length) { return undefined; } diff --git a/util/github/hasFiles.ts b/util/github/hasFiles.ts index 7e85a305c..b3a61a07c 100644 --- a/util/github/hasFiles.ts +++ b/util/github/hasFiles.ts @@ -94,6 +94,7 @@ const ESLINT_CONFIG_FILE_NAMES = new Set([ '.eslintrc.json', '.eslintrc.yaml', '.eslintrc.yml', + '.eslintignore', ]); const PRETTIER_CONFIG_FILE_NAMES = new Set([ '.prettierrc', @@ -108,6 +109,7 @@ const PRETTIER_CONFIG_FILE_NAMES = new Set([ 'prettier.config.js', 'prettier.config.cjs', 'prettier.config.mjs', + '.prettierignore', ]); const BIOME_CONFIG_FILE_NAMES = new Set(['biome.json', 'biome.jsonc']); const COMMITLINT_CONFIG_FILE_NAMES = new Set([ From cd77a7519ca100852ebd862ebdde3214ebf871f0 Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Mon, 14 Sep 2026 14:19:58 +0200 Subject: [PATCH 2/2] add module types to statistics, types tweaks --- pages/api/libraries/statistic.ts | 15 +++++++++++++++ types/index.ts | 18 +++++++----------- util/github/hasFiles.ts | 4 ++-- util/strings.ts | 4 ++-- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/pages/api/libraries/statistic.ts b/pages/api/libraries/statistic.ts index 99e562e3d..405f55fc9 100644 --- a/pages/api/libraries/statistic.ts +++ b/pages/api/libraries/statistic.ts @@ -35,6 +35,11 @@ export default function handler(_: NextApiRequest, res: NextApiResponse) { npm: 0, yarn: 0, }, + moduleType: { + expo: 0, + nitro: 0, + turbo: 0, + }, lintTools: { oxlint: 0, oxfmt: 0, @@ -132,6 +137,16 @@ export default function handler(_: NextApiRequest, res: NextApiResponse) { result.lintTools[tool]++; }); + if (library.github.moduleType) { + if (library.github.moduleType === 'expo') { + result.moduleType.expo++; + } else if (library.github.moduleType === 'nitro') { + result.moduleType.nitro++; + } else if (library.github.moduleType === 'turbo') { + result.moduleType.turbo++; + } + } + if (library.github.packageManager) { if (library.github.packageManager.includes('bun')) { result.packageManager.bun++; diff --git a/types/index.ts b/types/index.ts index 2ca17ec82..17ac6c198 100644 --- a/types/index.ts +++ b/types/index.ts @@ -100,8 +100,8 @@ export type LibraryType = LibraryDataEntryType & { hasSecurity?: boolean; configPlugin?: boolean; moduleType?: ModuleType; - packageManager?: string; - lintTools?: LintTool[]; + packageManager?: PackageManagerType; + lintTools?: LintToolType[]; urls: { repo: string; homepage?: string | null; @@ -253,13 +253,9 @@ export type StatisticResultType = { tvos: number; visionos: number; vegaos: number; - lintTools: Record; - packageManager: { - bun: number; - pnpm: number; - npm: number; - yarn: number; - }; + packageManager: Record; + moduleType: Record; + lintTools: Record; }; type NpmRegistryCommonData = { @@ -425,6 +421,6 @@ export type PackageNavigationTab = { counter?: number | string; }; +export type PackageManagerType = 'bun' | 'pnpm' | 'npm' | 'yarn'; export type ModuleType = 'expo' | 'nitro' | 'turbo'; - -export type LintTool = 'oxlint' | 'oxfmt' | 'eslint' | 'prettier' | 'biome' | 'commitlint'; +export type LintToolType = 'oxlint' | 'oxfmt' | 'eslint' | 'prettier' | 'biome' | 'commitlint'; diff --git a/util/github/hasFiles.ts b/util/github/hasFiles.ts index b3a61a07c..006103b65 100644 --- a/util/github/hasFiles.ts +++ b/util/github/hasFiles.ts @@ -1,4 +1,4 @@ -import { type LintTool, type RepositoryTreeNode } from '~/types'; +import { type LintToolType, type RepositoryTreeNode } from '~/types'; type RootFiles = { entries: RepositoryTreeNode[] } | null; @@ -132,7 +132,7 @@ const COMMITLINT_CONFIG_FILE_NAMES = new Set([ ]); export function detectLintStack(rootFiles: RootFiles) { - const lintTools: LintTool[] = []; + const lintTools: LintToolType[] = []; if (hasMatchingFiles(rootFiles, OXLINT_CONFIG_FILE_NAMES)) { lintTools.push('oxlint'); } diff --git a/util/strings.ts b/util/strings.ts index f0bb5e620..4d9a05341 100644 --- a/util/strings.ts +++ b/util/strings.ts @@ -1,6 +1,6 @@ import { Children, isValidElement, type PropsWithChildren, type ReactNode } from 'react'; -import { type LintTool } from '~/types'; +import { type LintToolType } from '~/types'; export const NUMBER_FORMATTER = new Intl.NumberFormat('en-US', { notation: 'compact', @@ -63,7 +63,7 @@ export function formatPackageManager(pmRaw?: string) { } } -export function formatLintTools(lintTool: LintTool) { +export function formatLintTools(lintTool: LintToolType) { switch (lintTool) { case 'oxlint': return 'Oxlint';