From 77cf4d264179847650af103621923961ead47541 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Mon, 11 May 2026 01:33:59 -0700 Subject: [PATCH 1/5] feat(code): highlight files commonly shipped unnecessarily in packages Adds a `possibly unnecessary` hint in the package code browser for files and directories that are commonly published to npm by accident -- editor configs (.vscode/, .editorconfig), lint/format settings, test trees, local env files, etc. Each affected node gets a subtle `i-lucide:info` indicator plus an aria-label so the cue is announced to screen readers. Closes #2582 --- app/components/Code/DirectoryListing.vue | 12 +++ app/components/Code/FileTree.vue | 21 +++++ app/utils/package-content-hints.ts | 65 +++++++++++++ i18n/locales/ar-EG.json | 3 +- i18n/locales/ar.json | 3 +- i18n/locales/az-AZ.json | 3 +- i18n/locales/bg-BG.json | 3 +- i18n/locales/bn-IN.json | 3 +- i18n/locales/cs-CZ.json | 3 +- i18n/locales/de.json | 3 +- i18n/locales/en.json | 3 +- i18n/locales/es.json | 3 +- i18n/locales/fr-FR.json | 3 +- i18n/locales/hi-IN.json | 3 +- i18n/locales/hu-HU.json | 3 +- i18n/locales/id-ID.json | 3 +- i18n/locales/it-IT.json | 3 +- i18n/locales/ja-JP.json | 3 +- i18n/locales/kn-IN.json | 3 +- i18n/locales/mr-IN.json | 3 +- i18n/locales/nb-NO.json | 3 +- i18n/locales/ne-NP.json | 3 +- i18n/locales/nl.json | 3 +- i18n/locales/pl-PL.json | 3 +- i18n/locales/pt-BR.json | 3 +- i18n/locales/pt-PT.json | 3 +- i18n/locales/ru-RU.json | 3 +- i18n/locales/sr-Latn-RS.json | 3 +- i18n/locales/ta-IN.json | 3 +- i18n/locales/te-IN.json | 3 +- i18n/locales/tr-TR.json | 3 +- i18n/locales/uk-UA.json | 3 +- i18n/locales/vi-VN.json | 3 +- i18n/locales/zh-CN.json | 3 +- i18n/locales/zh-TW.json | 3 +- i18n/schema.json | 3 + .../app/utils/package-content-hints.spec.ts | 91 +++++++++++++++++++ 37 files changed, 256 insertions(+), 32 deletions(-) create mode 100644 app/utils/package-content-hints.ts create mode 100644 test/unit/app/utils/package-content-hints.spec.ts diff --git a/app/components/Code/DirectoryListing.vue b/app/components/Code/DirectoryListing.vue index cae0f3635e..b97fdf0864 100644 --- a/app/components/Code/DirectoryListing.vue +++ b/app/components/Code/DirectoryListing.vue @@ -2,6 +2,7 @@ import type { RouteLocationRaw } from 'vue-router' import type { RouteNamedMap } from 'vue-router/auto-routes' import { ADDITIONAL_ICONS, getFileIcon } from '~/utils/file-icons' +import { isPossiblyUnnecessaryContent } from '~/utils/package-content-hints' const props = defineProps<{ tree: PackageFileTree[] @@ -10,6 +11,8 @@ const props = defineProps<{ baseRoute: Pick }>() +const { t } = useI18n() + // Get the current directory's contents const currentContents = computed(() => { if (!props.currentPath) { @@ -103,6 +106,9 @@ const bytesFormatter = useBytesFormatter() @@ -118,6 +124,12 @@ const bytesFormatter = useBytesFormatter() {{ node.name }} + diff --git a/app/utils/package-content-hints.ts b/app/utils/package-content-hints.ts new file mode 100644 index 0000000000..b269d8aba4 --- /dev/null +++ b/app/utils/package-content-hints.ts @@ -0,0 +1,65 @@ +/** + * Heuristics for identifying files and directories that are commonly shipped + * to npm by accident: editor configs, lint/format settings, test trees, + * local-only env files, etc. Used by the package code browser to surface + * "this is probably bloat" hints next to affected nodes. + * + * Source list: https://github.com/npmx-dev/npmx.dev/issues/2582 + */ + +const POSSIBLY_UNNECESSARY_FILES: ReadonlySet = new Set([ + '.editorconfig', + '.prettierignore', + '.eslintignore', + '.gitignore', + '.gitattributes', + 'tsconfig.json', + '.node-version', + '.nvmrc', + 'mise.toml', + '.tool-versions', + '.env', + '.env.local', + '.env.development', + '.env.development.local', + '.env.test', + '.env.test.local', + '.env.production.local', + '.nycrc', + 'nyc.json', +]) + +const POSSIBLY_UNNECESSARY_DIRECTORIES: ReadonlySet = new Set([ + '.vscode', + '.claude', + '.github', + '.idea', + '.zed', + 'test', + 'tests', + '__tests__', + 'spec', + 'specs', +]) + +const POSSIBLY_UNNECESSARY_PATTERNS: readonly RegExp[] = [ + /^eslint\.config\.(?:js|cjs|mjs|ts|mts|cts)$/, + /^\.eslintrc(?:\.(?:json|js|cjs|yml|yaml))?$/, + /^\.prettierrc(?:\.(?:json|js|cjs|yml|yaml|toml))?$/, + /^prettier\.config\.(?:js|cjs|mjs|ts|mts|cts)$/, + /^oxlint\.config\.(?:js|cjs|mjs|ts|mts|cts)$/, + /^\.oxlintrc(?:\.(?:json|js|cjs|yml|yaml))?$/, + /^oxfmt\.config\.(?:js|cjs|mjs|ts|mts|cts)$/, + /^\.oxfmtrc(?:\.(?:json|js|cjs|yml|yaml))?$/, +] + +export function isPossiblyUnnecessaryContent( + name: string, + type: 'file' | 'directory', +): boolean { + if (type === 'directory') { + return POSSIBLY_UNNECESSARY_DIRECTORIES.has(name) + } + if (POSSIBLY_UNNECESSARY_FILES.has(name)) return true + return POSSIBLY_UNNECESSARY_PATTERNS.some(pattern => pattern.test(name)) +} diff --git a/i18n/locales/ar-EG.json b/i18n/locales/ar-EG.json index 18682843b5..370ee89f4c 100644 --- a/i18n/locales/ar-EG.json +++ b/i18n/locales/ar-EG.json @@ -230,7 +230,8 @@ }, "code": { "binary_file": "ملف ثنائي", - "binary_rendering_warning": "لا يمكن عرض هذا الملف الثنائي في المتصفح" + "binary_rendering_warning": "لا يمكن عرض هذا الملف الثنائي في المتصفح", + "possibly_unnecessary": "May be unnecessary in a published package" }, "filters": { "view_selected": "عرض المحدد", diff --git a/i18n/locales/ar.json b/i18n/locales/ar.json index 179ed6251f..625caed4cd 100644 --- a/i18n/locales/ar.json +++ b/i18n/locales/ar.json @@ -672,7 +672,8 @@ "preview": "معاينة", "code": "الكود" }, - "file_path": "مسار الملف" + "file_path": "مسار الملف", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/az-AZ.json b/i18n/locales/az-AZ.json index 93c9a8117a..982fc59835 100644 --- a/i18n/locales/az-AZ.json +++ b/i18n/locales/az-AZ.json @@ -776,7 +776,8 @@ "preview": "önbaxış", "code": "kod" }, - "file_path": "Fayl yolu" + "file_path": "Fayl yolu", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/bg-BG.json b/i18n/locales/bg-BG.json index f937b02e1e..3fe9a04488 100644 --- a/i18n/locales/bg-BG.json +++ b/i18n/locales/bg-BG.json @@ -737,7 +737,8 @@ "preview": "преглед", "code": "код" }, - "file_path": "Път към файл" + "file_path": "Път към файл", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/bn-IN.json b/i18n/locales/bn-IN.json index 3712252621..44af66584d 100644 --- a/i18n/locales/bn-IN.json +++ b/i18n/locales/bn-IN.json @@ -566,7 +566,8 @@ "preview": "প্রিভিউ", "code": "কোড" }, - "file_path": "ফাইল পাথ" + "file_path": "ফাইল পাথ", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/cs-CZ.json b/i18n/locales/cs-CZ.json index b5ffca3a02..81c8997fa2 100644 --- a/i18n/locales/cs-CZ.json +++ b/i18n/locales/cs-CZ.json @@ -965,7 +965,8 @@ }, "file_path": "Cesta k souboru", "binary_file": "Binární soubor", - "binary_rendering_warning": "Náhled pro typy souborů \"{contentType}\" není k dispozici." + "binary_rendering_warning": "Náhled pro typy souborů \"{contentType}\" není k dispozici.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/de.json b/i18n/locales/de.json index e805f32888..d3e2a0acfb 100644 --- a/i18n/locales/de.json +++ b/i18n/locales/de.json @@ -964,7 +964,8 @@ }, "file_path": "Dateipfad", "binary_file": "Binärdatei", - "binary_rendering_warning": "Dateityp „{contentType}“ wird für die Vorschau nicht unterstützt." + "binary_rendering_warning": "Dateityp „{contentType}“ wird für die Vorschau nicht unterstützt.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/en.json b/i18n/locales/en.json index f93a6d7472..8c3dd40e87 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -1025,7 +1025,8 @@ }, "file_path": "File path", "binary_file": "Binary file", - "binary_rendering_warning": "File type \"{contentType}\" is not supported for preview." + "binary_rendering_warning": "File type \"{contentType}\" is not supported for preview.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/es.json b/i18n/locales/es.json index 9bcb7263fc..6477b001cf 100644 --- a/i18n/locales/es.json +++ b/i18n/locales/es.json @@ -846,7 +846,8 @@ }, "file_path": "Ruta del archivo", "binary_file": "Archivo binario", - "binary_rendering_warning": "Tipo de archivo no compatible para vista previa." + "binary_rendering_warning": "Tipo de archivo no compatible para vista previa.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/fr-FR.json b/i18n/locales/fr-FR.json index ef6b16f298..f6d37c2726 100644 --- a/i18n/locales/fr-FR.json +++ b/i18n/locales/fr-FR.json @@ -1010,7 +1010,8 @@ "open_path_dropdown": "Ouvrir le menu du chemin", "file_path": "Chemin du fichier", "binary_file": "Fichier binaire", - "binary_rendering_warning": "Le type de fichier \"{contentType}\" n'est pas pris en charge pour l'aperçu." + "binary_rendering_warning": "Le type de fichier \"{contentType}\" n'est pas pris en charge pour l'aperçu.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/hi-IN.json b/i18n/locales/hi-IN.json index ea702a7728..65080a23b8 100644 --- a/i18n/locales/hi-IN.json +++ b/i18n/locales/hi-IN.json @@ -828,7 +828,8 @@ }, "file_path": "फ़ाइल पाथ", "binary_file": "बाइनरी फ़ाइल", - "binary_rendering_warning": "फ़ाइल प्रकार \"{contentType}\" पूर्वावलोकन के लिए समर्थित नहीं है।" + "binary_rendering_warning": "फ़ाइल प्रकार \"{contentType}\" पूर्वावलोकन के लिए समर्थित नहीं है।", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/hu-HU.json b/i18n/locales/hu-HU.json index c14948a6e1..1852552a24 100644 --- a/i18n/locales/hu-HU.json +++ b/i18n/locales/hu-HU.json @@ -737,7 +737,8 @@ "preview": "előnézet", "code": "kód" }, - "file_path": "Fájl elérési útja" + "file_path": "Fájl elérési útja", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/id-ID.json b/i18n/locales/id-ID.json index 9646ca17b1..0cc8b06429 100644 --- a/i18n/locales/id-ID.json +++ b/i18n/locales/id-ID.json @@ -846,7 +846,8 @@ }, "file_path": "Path file", "binary_file": "File biner", - "binary_rendering_warning": "File ini adalah file biner dan tidak dapat ditampilkan sebagai teks." + "binary_rendering_warning": "File ini adalah file biner dan tidak dapat ditampilkan sebagai teks.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/it-IT.json b/i18n/locales/it-IT.json index b19efca8db..3f402cbd6c 100644 --- a/i18n/locales/it-IT.json +++ b/i18n/locales/it-IT.json @@ -655,7 +655,8 @@ "preview": "anteprima", "code": "codice" }, - "file_path": "Percorso del file" + "file_path": "Percorso del file", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/ja-JP.json b/i18n/locales/ja-JP.json index 72397e4907..1c7640ec85 100644 --- a/i18n/locales/ja-JP.json +++ b/i18n/locales/ja-JP.json @@ -790,7 +790,8 @@ "preview": "プレビュー", "code": "コード" }, - "file_path": "ファイルパス" + "file_path": "ファイルパス", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/kn-IN.json b/i18n/locales/kn-IN.json index 2111c4dd23..6ff189e92c 100644 --- a/i18n/locales/kn-IN.json +++ b/i18n/locales/kn-IN.json @@ -567,7 +567,8 @@ "preview": "ಪೂರ್ವದೃಶ್ಯ", "code": "ಕೋಡ್" }, - "file_path": "ಫೈಲ್ ಮಾರ್ಗ" + "file_path": "ಫೈಲ್ ಮಾರ್ಗ", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/mr-IN.json b/i18n/locales/mr-IN.json index 57c36430e0..eb9a524853 100644 --- a/i18n/locales/mr-IN.json +++ b/i18n/locales/mr-IN.json @@ -806,7 +806,8 @@ }, "file_path": "फाइल मार्ग", "binary_file": "बायनरी फाइल", - "binary_rendering_warning": "\"{contentType}\" फाइल प्रकार पूर्वावलोकनासाठी समर्थित नाही." + "binary_rendering_warning": "\"{contentType}\" फाइल प्रकार पूर्वावलोकनासाठी समर्थित नाही.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/nb-NO.json b/i18n/locales/nb-NO.json index 63b84714fa..64aea675c6 100644 --- a/i18n/locales/nb-NO.json +++ b/i18n/locales/nb-NO.json @@ -1011,7 +1011,8 @@ }, "file_path": "Filsti", "binary_file": "Binærfil", - "binary_rendering_warning": "Filtypen «{contentType}» støttes ikke for forhåndsvisning." + "binary_rendering_warning": "Filtypen «{contentType}» støttes ikke for forhåndsvisning.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/ne-NP.json b/i18n/locales/ne-NP.json index 60b7dec1f1..b90fa19418 100644 --- a/i18n/locales/ne-NP.json +++ b/i18n/locales/ne-NP.json @@ -552,7 +552,8 @@ "preview": "preview", "code": "code" }, - "file_path": "फाइल पथ" + "file_path": "फाइल पथ", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/nl.json b/i18n/locales/nl.json index 85e5f13c1a..34f68aef85 100644 --- a/i18n/locales/nl.json +++ b/i18n/locales/nl.json @@ -964,7 +964,8 @@ }, "file_path": "Bestand pad", "binary_file": "Binair bestand", - "binary_rendering_warning": "Bestand type \"{contentType}\" wordt niet ondersteund om te weergeven." + "binary_rendering_warning": "Bestand type \"{contentType}\" wordt niet ondersteund om te weergeven.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/pl-PL.json b/i18n/locales/pl-PL.json index f4acd249ed..b841f2d3f1 100644 --- a/i18n/locales/pl-PL.json +++ b/i18n/locales/pl-PL.json @@ -790,7 +790,8 @@ "preview": "podgląd", "code": "kod" }, - "file_path": "Ścieżka pliku" + "file_path": "Ścieżka pliku", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/pt-BR.json b/i18n/locales/pt-BR.json index a09e5e5ae8..18e6623f72 100644 --- a/i18n/locales/pt-BR.json +++ b/i18n/locales/pt-BR.json @@ -997,7 +997,8 @@ }, "file_path": "Caminho do arquivo", "binary_file": "Arquivo binário", - "binary_rendering_warning": "Tipo de arquivo não suportado para visualização." + "binary_rendering_warning": "Tipo de arquivo não suportado para visualização.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/pt-PT.json b/i18n/locales/pt-PT.json index 8540dec556..dc154f04f1 100644 --- a/i18n/locales/pt-PT.json +++ b/i18n/locales/pt-PT.json @@ -1011,7 +1011,8 @@ }, "file_path": "Caminho do ficheiro", "binary_file": "Ficheiro binário", - "binary_rendering_warning": "Tipo de ficheiro \"{contentType}\" não suportado para pré-visualização." + "binary_rendering_warning": "Tipo de ficheiro \"{contentType}\" não suportado para pré-visualização.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/ru-RU.json b/i18n/locales/ru-RU.json index 66dc858a5a..c719184783 100644 --- a/i18n/locales/ru-RU.json +++ b/i18n/locales/ru-RU.json @@ -985,7 +985,8 @@ }, "file_path": "Путь к файлу", "binary_file": "Бинарный файл", - "binary_rendering_warning": "Предпросмотр для типа «{contentType}» не поддерживается." + "binary_rendering_warning": "Предпросмотр для типа «{contentType}» не поддерживается.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/sr-Latn-RS.json b/i18n/locales/sr-Latn-RS.json index c015089b8c..f0b4de62d9 100644 --- a/i18n/locales/sr-Latn-RS.json +++ b/i18n/locales/sr-Latn-RS.json @@ -843,7 +843,8 @@ }, "file_path": "Putanja datoteke", "binary_file": "Binarna datoteka", - "binary_rendering_warning": "Tip datoteke \"{contentType}\" nije podržan za pregled." + "binary_rendering_warning": "Tip datoteke \"{contentType}\" nije podržan za pregled.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/ta-IN.json b/i18n/locales/ta-IN.json index e8b657110c..3ff14467af 100644 --- a/i18n/locales/ta-IN.json +++ b/i18n/locales/ta-IN.json @@ -647,7 +647,8 @@ "preview": "முன்னோட்டம்", "code": "குறியீடு" }, - "file_path": "கோப்பு பாதை" + "file_path": "கோப்பு பாதை", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/te-IN.json b/i18n/locales/te-IN.json index 7e92347d2e..d5d6ff3669 100644 --- a/i18n/locales/te-IN.json +++ b/i18n/locales/te-IN.json @@ -567,7 +567,8 @@ "preview": "ప్రివ్యూ", "code": "కోడ్" }, - "file_path": "ఫైల్ పాత్" + "file_path": "ఫైల్ పాత్", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/tr-TR.json b/i18n/locales/tr-TR.json index 6e51af9a50..1d9ebc4bb3 100644 --- a/i18n/locales/tr-TR.json +++ b/i18n/locales/tr-TR.json @@ -779,7 +779,8 @@ "preview": "önizleme", "code": "kod" }, - "file_path": "Dosya yolu" + "file_path": "Dosya yolu", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/uk-UA.json b/i18n/locales/uk-UA.json index 336c409e1b..5cd25320f0 100644 --- a/i18n/locales/uk-UA.json +++ b/i18n/locales/uk-UA.json @@ -843,7 +843,8 @@ }, "file_path": "Шлях до файлу", "binary_file": "Бінарний файл", - "binary_rendering_warning": "Перегляд для даного типу файлів не підтримується" + "binary_rendering_warning": "Перегляд для даного типу файлів не підтримується", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/vi-VN.json b/i18n/locales/vi-VN.json index d9a5698fa2..6508fd5bf2 100644 --- a/i18n/locales/vi-VN.json +++ b/i18n/locales/vi-VN.json @@ -843,7 +843,8 @@ }, "file_path": "Đường dẫn tệp", "binary_file": "Tệp binary", - "binary_rendering_warning": "Loại tệp \"{contentType}\" không hỗ trợ xem trước." + "binary_rendering_warning": "Loại tệp \"{contentType}\" không hỗ trợ xem trước.", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index eb423981ba..4155959e1a 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -1025,7 +1025,8 @@ }, "file_path": "文件路径", "binary_file": "二进制文件", - "binary_rendering_warning": "暂不支持预览“{contentType}”类型的文件。" + "binary_rendering_warning": "暂不支持预览“{contentType}”类型的文件。", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/locales/zh-TW.json b/i18n/locales/zh-TW.json index 623e3955fe..8cbd7411d1 100644 --- a/i18n/locales/zh-TW.json +++ b/i18n/locales/zh-TW.json @@ -963,7 +963,8 @@ }, "file_path": "檔案路徑", "binary_file": "二進位檔案", - "binary_rendering_warning": "檔案類型 \"{contentType}\" 不支援預覽。" + "binary_rendering_warning": "檔案類型 \"{contentType}\" 不支援預覽。", + "possibly_unnecessary": "May be unnecessary in a published package" }, "badges": { "provenance": { diff --git a/i18n/schema.json b/i18n/schema.json index 0338a9a4d3..f72074675a 100644 --- a/i18n/schema.json +++ b/i18n/schema.json @@ -3081,6 +3081,9 @@ }, "binary_rendering_warning": { "type": "string" + }, + "possibly_unnecessary": { + "type": "string" } }, "additionalProperties": false diff --git a/test/unit/app/utils/package-content-hints.spec.ts b/test/unit/app/utils/package-content-hints.spec.ts new file mode 100644 index 0000000000..1eecaa46cf --- /dev/null +++ b/test/unit/app/utils/package-content-hints.spec.ts @@ -0,0 +1,91 @@ +import { describe, expect, it } from 'vitest' +import { isPossiblyUnnecessaryContent } from '~/utils/package-content-hints' + +describe('isPossiblyUnnecessaryContent', () => { + it('flags well-known editor and config filenames', () => { + expect(isPossiblyUnnecessaryContent('.editorconfig', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.gitignore', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.gitattributes', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.prettierignore', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.eslintignore', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('tsconfig.json', 'file')).toBe(true) + }) + + it('flags local environment files', () => { + expect(isPossiblyUnnecessaryContent('.env', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.env.local', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.env.development', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.env.test.local', 'file')).toBe(true) + }) + + it('flags node version files and coverage configs', () => { + expect(isPossiblyUnnecessaryContent('.node-version', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.nvmrc', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('mise.toml', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.tool-versions', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.nycrc', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('nyc.json', 'file')).toBe(true) + }) + + it('matches ESLint configuration patterns', () => { + expect(isPossiblyUnnecessaryContent('eslint.config.js', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('eslint.config.mjs', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('eslint.config.ts', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.eslintrc', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.eslintrc.json', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.eslintrc.yml', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.eslintrc.cjs', 'file')).toBe(true) + }) + + it('matches Prettier configuration patterns', () => { + expect(isPossiblyUnnecessaryContent('.prettierrc', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.prettierrc.json', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.prettierrc.yml', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('prettier.config.js', 'file')).toBe(true) + }) + + it('matches oxlint and oxfmt configuration patterns', () => { + expect(isPossiblyUnnecessaryContent('oxlint.config.ts', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.oxlintrc.json', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('oxfmt.config.ts', 'file')).toBe(true) + expect(isPossiblyUnnecessaryContent('.oxfmtrc.json', 'file')).toBe(true) + }) + + it('flags editor and CI directories', () => { + expect(isPossiblyUnnecessaryContent('.vscode', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('.claude', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('.github', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('.idea', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('.zed', 'directory')).toBe(true) + }) + + it('flags test directories', () => { + expect(isPossiblyUnnecessaryContent('test', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('tests', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('__tests__', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('spec', 'directory')).toBe(true) + expect(isPossiblyUnnecessaryContent('specs', 'directory')).toBe(true) + }) + + it('does not flag ordinary source files or directories', () => { + expect(isPossiblyUnnecessaryContent('index.js', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('package.json', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('README.md', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('LICENSE', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('main.ts', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('src', 'directory')).toBe(false) + expect(isPossiblyUnnecessaryContent('lib', 'directory')).toBe(false) + expect(isPossiblyUnnecessaryContent('dist', 'directory')).toBe(false) + }) + + it('does not confuse a directory name passed as a file with the directory match', () => { + expect(isPossiblyUnnecessaryContent('.vscode', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('test', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('tsconfig.json', 'directory')).toBe(false) + }) + + it('treats matching as case-sensitive (npm packages live in a case-sensitive world)', () => { + expect(isPossiblyUnnecessaryContent('TSCONFIG.JSON', 'file')).toBe(false) + expect(isPossiblyUnnecessaryContent('.VSCode', 'directory')).toBe(false) + }) +}) From 19dff0abaf175ebd1f0957dfb4b9dd64106021cd Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 08:36:42 +0000 Subject: [PATCH 2/5] [autofix.ci] apply automated fixes --- app/components/Code/DirectoryListing.vue | 8 +++++--- app/components/Code/FileTree.vue | 16 ++++++++++------ app/utils/package-content-hints.ts | 5 +---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/components/Code/DirectoryListing.vue b/app/components/Code/DirectoryListing.vue index b97fdf0864..ce9ce3a20f 100644 --- a/app/components/Code/DirectoryListing.vue +++ b/app/components/Code/DirectoryListing.vue @@ -106,9 +106,11 @@ const bytesFormatter = useBytesFormatter() diff --git a/app/components/Code/FileTree.vue b/app/components/Code/FileTree.vue index 3f711ff8e5..0c2362147a 100644 --- a/app/components/Code/FileTree.vue +++ b/app/components/Code/FileTree.vue @@ -59,9 +59,11 @@ watch( class="w-full justify-start! rounded-none! border-none! transition-[color,background-color]! duration-100!" block :aria-pressed="isNodeActive(node)" - :aria-label="isPossiblyUnnecessaryContent(node.name, 'directory') - ? `${node.name} - ${t('code.possibly_unnecessary')}` - : undefined" + :aria-label=" + isPossiblyUnnecessaryContent(node.name, 'directory') + ? `${node.name} - ${t('code.possibly_unnecessary')}` + : undefined + " :style="{ paddingLeft: `${depth * 12 + 12}px` }" @click="toggleDir(node.path)" :classicon="isExpanded(node.path) ? 'i-lucide:chevron-down' : 'i-lucide:chevron-right'" @@ -100,9 +102,11 @@ watch( variant="button-secondary" :to="getFileRoute(node.path)" :aria-current="currentPath === node.path" - :aria-label="isPossiblyUnnecessaryContent(node.name, 'file') - ? `${node.name} - ${t('code.possibly_unnecessary')}` - : undefined" + :aria-label=" + isPossiblyUnnecessaryContent(node.name, 'file') + ? `${node.name} - ${t('code.possibly_unnecessary')}` + : undefined + " class="w-full justify-start! rounded-none! border-none! transition-[color,background-color]! duration-100!" block :style="{ paddingLeft: `${depth * 12 + 32}px` }" diff --git a/app/utils/package-content-hints.ts b/app/utils/package-content-hints.ts index b269d8aba4..2d2b1949e7 100644 --- a/app/utils/package-content-hints.ts +++ b/app/utils/package-content-hints.ts @@ -53,10 +53,7 @@ const POSSIBLY_UNNECESSARY_PATTERNS: readonly RegExp[] = [ /^\.oxfmtrc(?:\.(?:json|js|cjs|yml|yaml))?$/, ] -export function isPossiblyUnnecessaryContent( - name: string, - type: 'file' | 'directory', -): boolean { +export function isPossiblyUnnecessaryContent(name: string, type: 'file' | 'directory'): boolean { if (type === 'directory') { return POSSIBLY_UNNECESSARY_DIRECTORIES.has(name) } From 56dbe3500bb444539f0ef98c5355e22bd2754472 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Mon, 11 May 2026 22:11:27 -0700 Subject: [PATCH 3/5] fix(i18n,ui): drop English fallback from non-en locales and unused useI18n Per reviewer feedback: - @gameroman: English text shouldn't be added to non-en locale files when adding a new key. en.json is the source locale; non-en locales fall back to source automatically until a translation is contributed. - @graphieros: $t is auto-injected in templates; the const { t } = useI18n() import in FileTree.vue is unnecessary. Removes the possibly_unnecessary English string from 31 non-en locale files and switches FileTree.vue to use $t directly in template bindings. --- app/components/Code/FileTree.vue | 10 ++++------ i18n/locales/ar-EG.json | 3 +-- i18n/locales/ar.json | 3 +-- i18n/locales/az-AZ.json | 3 +-- i18n/locales/bg-BG.json | 3 +-- i18n/locales/bn-IN.json | 3 +-- i18n/locales/cs-CZ.json | 3 +-- i18n/locales/de.json | 3 +-- i18n/locales/es.json | 3 +-- i18n/locales/fr-FR.json | 3 +-- i18n/locales/hi-IN.json | 3 +-- i18n/locales/hu-HU.json | 3 +-- i18n/locales/id-ID.json | 3 +-- i18n/locales/it-IT.json | 3 +-- i18n/locales/ja-JP.json | 3 +-- i18n/locales/kn-IN.json | 3 +-- i18n/locales/mr-IN.json | 3 +-- i18n/locales/nb-NO.json | 3 +-- i18n/locales/ne-NP.json | 3 +-- i18n/locales/nl.json | 3 +-- i18n/locales/pl-PL.json | 3 +-- i18n/locales/pt-BR.json | 3 +-- i18n/locales/pt-PT.json | 3 +-- i18n/locales/ru-RU.json | 3 +-- i18n/locales/sr-Latn-RS.json | 3 +-- i18n/locales/ta-IN.json | 3 +-- i18n/locales/te-IN.json | 3 +-- i18n/locales/tr-TR.json | 3 +-- i18n/locales/uk-UA.json | 3 +-- i18n/locales/vi-VN.json | 3 +-- i18n/locales/zh-CN.json | 3 +-- i18n/locales/zh-TW.json | 3 +-- 32 files changed, 35 insertions(+), 68 deletions(-) diff --git a/app/components/Code/FileTree.vue b/app/components/Code/FileTree.vue index 0c2362147a..1407d929e2 100644 --- a/app/components/Code/FileTree.vue +++ b/app/components/Code/FileTree.vue @@ -12,8 +12,6 @@ const props = defineProps<{ depth?: number }>() -const { t } = useI18n() - const depth = computed(() => props.depth ?? 0) // Check if a node or any of its children is currently selected @@ -61,7 +59,7 @@ watch( :aria-pressed="isNodeActive(node)" :aria-label=" isPossiblyUnnecessaryContent(node.name, 'directory') - ? `${node.name} - ${t('code.possibly_unnecessary')}` + ? `${node.name} - ${$t('code.possibly_unnecessary')}` : undefined " :style="{ paddingLeft: `${depth * 12 + 12}px` }" @@ -83,7 +81,7 @@ watch( v-if="isPossiblyUnnecessaryContent(node.name, 'directory')" class="i-lucide:info size-[0.85em] ms-1 shrink-0 text-amber-600 dark:text-amber-400" aria-hidden="true" - :title="t('code.possibly_unnecessary')" + :title="$t('code.possibly_unnecessary')" /> diff --git a/i18n/locales/ar-EG.json b/i18n/locales/ar-EG.json index 370ee89f4c..18682843b5 100644 --- a/i18n/locales/ar-EG.json +++ b/i18n/locales/ar-EG.json @@ -230,8 +230,7 @@ }, "code": { "binary_file": "ملف ثنائي", - "binary_rendering_warning": "لا يمكن عرض هذا الملف الثنائي في المتصفح", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "لا يمكن عرض هذا الملف الثنائي في المتصفح" }, "filters": { "view_selected": "عرض المحدد", diff --git a/i18n/locales/ar.json b/i18n/locales/ar.json index 625caed4cd..179ed6251f 100644 --- a/i18n/locales/ar.json +++ b/i18n/locales/ar.json @@ -672,8 +672,7 @@ "preview": "معاينة", "code": "الكود" }, - "file_path": "مسار الملف", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "مسار الملف" }, "badges": { "provenance": { diff --git a/i18n/locales/az-AZ.json b/i18n/locales/az-AZ.json index 982fc59835..93c9a8117a 100644 --- a/i18n/locales/az-AZ.json +++ b/i18n/locales/az-AZ.json @@ -776,8 +776,7 @@ "preview": "önbaxış", "code": "kod" }, - "file_path": "Fayl yolu", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "Fayl yolu" }, "badges": { "provenance": { diff --git a/i18n/locales/bg-BG.json b/i18n/locales/bg-BG.json index 3fe9a04488..f937b02e1e 100644 --- a/i18n/locales/bg-BG.json +++ b/i18n/locales/bg-BG.json @@ -737,8 +737,7 @@ "preview": "преглед", "code": "код" }, - "file_path": "Път към файл", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "Път към файл" }, "badges": { "provenance": { diff --git a/i18n/locales/bn-IN.json b/i18n/locales/bn-IN.json index 44af66584d..3712252621 100644 --- a/i18n/locales/bn-IN.json +++ b/i18n/locales/bn-IN.json @@ -566,8 +566,7 @@ "preview": "প্রিভিউ", "code": "কোড" }, - "file_path": "ফাইল পাথ", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "ফাইল পাথ" }, "badges": { "provenance": { diff --git a/i18n/locales/cs-CZ.json b/i18n/locales/cs-CZ.json index 81c8997fa2..b5ffca3a02 100644 --- a/i18n/locales/cs-CZ.json +++ b/i18n/locales/cs-CZ.json @@ -965,8 +965,7 @@ }, "file_path": "Cesta k souboru", "binary_file": "Binární soubor", - "binary_rendering_warning": "Náhled pro typy souborů \"{contentType}\" není k dispozici.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Náhled pro typy souborů \"{contentType}\" není k dispozici." }, "badges": { "provenance": { diff --git a/i18n/locales/de.json b/i18n/locales/de.json index d3e2a0acfb..e805f32888 100644 --- a/i18n/locales/de.json +++ b/i18n/locales/de.json @@ -964,8 +964,7 @@ }, "file_path": "Dateipfad", "binary_file": "Binärdatei", - "binary_rendering_warning": "Dateityp „{contentType}“ wird für die Vorschau nicht unterstützt.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Dateityp „{contentType}“ wird für die Vorschau nicht unterstützt." }, "badges": { "provenance": { diff --git a/i18n/locales/es.json b/i18n/locales/es.json index 6477b001cf..9bcb7263fc 100644 --- a/i18n/locales/es.json +++ b/i18n/locales/es.json @@ -846,8 +846,7 @@ }, "file_path": "Ruta del archivo", "binary_file": "Archivo binario", - "binary_rendering_warning": "Tipo de archivo no compatible para vista previa.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Tipo de archivo no compatible para vista previa." }, "badges": { "provenance": { diff --git a/i18n/locales/fr-FR.json b/i18n/locales/fr-FR.json index f6d37c2726..ef6b16f298 100644 --- a/i18n/locales/fr-FR.json +++ b/i18n/locales/fr-FR.json @@ -1010,8 +1010,7 @@ "open_path_dropdown": "Ouvrir le menu du chemin", "file_path": "Chemin du fichier", "binary_file": "Fichier binaire", - "binary_rendering_warning": "Le type de fichier \"{contentType}\" n'est pas pris en charge pour l'aperçu.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Le type de fichier \"{contentType}\" n'est pas pris en charge pour l'aperçu." }, "badges": { "provenance": { diff --git a/i18n/locales/hi-IN.json b/i18n/locales/hi-IN.json index 65080a23b8..ea702a7728 100644 --- a/i18n/locales/hi-IN.json +++ b/i18n/locales/hi-IN.json @@ -828,8 +828,7 @@ }, "file_path": "फ़ाइल पाथ", "binary_file": "बाइनरी फ़ाइल", - "binary_rendering_warning": "फ़ाइल प्रकार \"{contentType}\" पूर्वावलोकन के लिए समर्थित नहीं है।", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "फ़ाइल प्रकार \"{contentType}\" पूर्वावलोकन के लिए समर्थित नहीं है।" }, "badges": { "provenance": { diff --git a/i18n/locales/hu-HU.json b/i18n/locales/hu-HU.json index 1852552a24..c14948a6e1 100644 --- a/i18n/locales/hu-HU.json +++ b/i18n/locales/hu-HU.json @@ -737,8 +737,7 @@ "preview": "előnézet", "code": "kód" }, - "file_path": "Fájl elérési útja", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "Fájl elérési útja" }, "badges": { "provenance": { diff --git a/i18n/locales/id-ID.json b/i18n/locales/id-ID.json index 0cc8b06429..9646ca17b1 100644 --- a/i18n/locales/id-ID.json +++ b/i18n/locales/id-ID.json @@ -846,8 +846,7 @@ }, "file_path": "Path file", "binary_file": "File biner", - "binary_rendering_warning": "File ini adalah file biner dan tidak dapat ditampilkan sebagai teks.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "File ini adalah file biner dan tidak dapat ditampilkan sebagai teks." }, "badges": { "provenance": { diff --git a/i18n/locales/it-IT.json b/i18n/locales/it-IT.json index 3f402cbd6c..b19efca8db 100644 --- a/i18n/locales/it-IT.json +++ b/i18n/locales/it-IT.json @@ -655,8 +655,7 @@ "preview": "anteprima", "code": "codice" }, - "file_path": "Percorso del file", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "Percorso del file" }, "badges": { "provenance": { diff --git a/i18n/locales/ja-JP.json b/i18n/locales/ja-JP.json index 1c7640ec85..72397e4907 100644 --- a/i18n/locales/ja-JP.json +++ b/i18n/locales/ja-JP.json @@ -790,8 +790,7 @@ "preview": "プレビュー", "code": "コード" }, - "file_path": "ファイルパス", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "ファイルパス" }, "badges": { "provenance": { diff --git a/i18n/locales/kn-IN.json b/i18n/locales/kn-IN.json index 6ff189e92c..2111c4dd23 100644 --- a/i18n/locales/kn-IN.json +++ b/i18n/locales/kn-IN.json @@ -567,8 +567,7 @@ "preview": "ಪೂರ್ವದೃಶ್ಯ", "code": "ಕೋಡ್" }, - "file_path": "ಫೈಲ್ ಮಾರ್ಗ", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "ಫೈಲ್ ಮಾರ್ಗ" }, "badges": { "provenance": { diff --git a/i18n/locales/mr-IN.json b/i18n/locales/mr-IN.json index eb9a524853..57c36430e0 100644 --- a/i18n/locales/mr-IN.json +++ b/i18n/locales/mr-IN.json @@ -806,8 +806,7 @@ }, "file_path": "फाइल मार्ग", "binary_file": "बायनरी फाइल", - "binary_rendering_warning": "\"{contentType}\" फाइल प्रकार पूर्वावलोकनासाठी समर्थित नाही.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "\"{contentType}\" फाइल प्रकार पूर्वावलोकनासाठी समर्थित नाही." }, "badges": { "provenance": { diff --git a/i18n/locales/nb-NO.json b/i18n/locales/nb-NO.json index 64aea675c6..63b84714fa 100644 --- a/i18n/locales/nb-NO.json +++ b/i18n/locales/nb-NO.json @@ -1011,8 +1011,7 @@ }, "file_path": "Filsti", "binary_file": "Binærfil", - "binary_rendering_warning": "Filtypen «{contentType}» støttes ikke for forhåndsvisning.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Filtypen «{contentType}» støttes ikke for forhåndsvisning." }, "badges": { "provenance": { diff --git a/i18n/locales/ne-NP.json b/i18n/locales/ne-NP.json index b90fa19418..60b7dec1f1 100644 --- a/i18n/locales/ne-NP.json +++ b/i18n/locales/ne-NP.json @@ -552,8 +552,7 @@ "preview": "preview", "code": "code" }, - "file_path": "फाइल पथ", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "फाइल पथ" }, "badges": { "provenance": { diff --git a/i18n/locales/nl.json b/i18n/locales/nl.json index 34f68aef85..85e5f13c1a 100644 --- a/i18n/locales/nl.json +++ b/i18n/locales/nl.json @@ -964,8 +964,7 @@ }, "file_path": "Bestand pad", "binary_file": "Binair bestand", - "binary_rendering_warning": "Bestand type \"{contentType}\" wordt niet ondersteund om te weergeven.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Bestand type \"{contentType}\" wordt niet ondersteund om te weergeven." }, "badges": { "provenance": { diff --git a/i18n/locales/pl-PL.json b/i18n/locales/pl-PL.json index b841f2d3f1..f4acd249ed 100644 --- a/i18n/locales/pl-PL.json +++ b/i18n/locales/pl-PL.json @@ -790,8 +790,7 @@ "preview": "podgląd", "code": "kod" }, - "file_path": "Ścieżka pliku", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "Ścieżka pliku" }, "badges": { "provenance": { diff --git a/i18n/locales/pt-BR.json b/i18n/locales/pt-BR.json index 18e6623f72..a09e5e5ae8 100644 --- a/i18n/locales/pt-BR.json +++ b/i18n/locales/pt-BR.json @@ -997,8 +997,7 @@ }, "file_path": "Caminho do arquivo", "binary_file": "Arquivo binário", - "binary_rendering_warning": "Tipo de arquivo não suportado para visualização.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Tipo de arquivo não suportado para visualização." }, "badges": { "provenance": { diff --git a/i18n/locales/pt-PT.json b/i18n/locales/pt-PT.json index dc154f04f1..8540dec556 100644 --- a/i18n/locales/pt-PT.json +++ b/i18n/locales/pt-PT.json @@ -1011,8 +1011,7 @@ }, "file_path": "Caminho do ficheiro", "binary_file": "Ficheiro binário", - "binary_rendering_warning": "Tipo de ficheiro \"{contentType}\" não suportado para pré-visualização.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Tipo de ficheiro \"{contentType}\" não suportado para pré-visualização." }, "badges": { "provenance": { diff --git a/i18n/locales/ru-RU.json b/i18n/locales/ru-RU.json index c719184783..66dc858a5a 100644 --- a/i18n/locales/ru-RU.json +++ b/i18n/locales/ru-RU.json @@ -985,8 +985,7 @@ }, "file_path": "Путь к файлу", "binary_file": "Бинарный файл", - "binary_rendering_warning": "Предпросмотр для типа «{contentType}» не поддерживается.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Предпросмотр для типа «{contentType}» не поддерживается." }, "badges": { "provenance": { diff --git a/i18n/locales/sr-Latn-RS.json b/i18n/locales/sr-Latn-RS.json index f0b4de62d9..c015089b8c 100644 --- a/i18n/locales/sr-Latn-RS.json +++ b/i18n/locales/sr-Latn-RS.json @@ -843,8 +843,7 @@ }, "file_path": "Putanja datoteke", "binary_file": "Binarna datoteka", - "binary_rendering_warning": "Tip datoteke \"{contentType}\" nije podržan za pregled.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Tip datoteke \"{contentType}\" nije podržan za pregled." }, "badges": { "provenance": { diff --git a/i18n/locales/ta-IN.json b/i18n/locales/ta-IN.json index 3ff14467af..e8b657110c 100644 --- a/i18n/locales/ta-IN.json +++ b/i18n/locales/ta-IN.json @@ -647,8 +647,7 @@ "preview": "முன்னோட்டம்", "code": "குறியீடு" }, - "file_path": "கோப்பு பாதை", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "கோப்பு பாதை" }, "badges": { "provenance": { diff --git a/i18n/locales/te-IN.json b/i18n/locales/te-IN.json index d5d6ff3669..7e92347d2e 100644 --- a/i18n/locales/te-IN.json +++ b/i18n/locales/te-IN.json @@ -567,8 +567,7 @@ "preview": "ప్రివ్యూ", "code": "కోడ్" }, - "file_path": "ఫైల్ పాత్", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "ఫైల్ పాత్" }, "badges": { "provenance": { diff --git a/i18n/locales/tr-TR.json b/i18n/locales/tr-TR.json index 1d9ebc4bb3..6e51af9a50 100644 --- a/i18n/locales/tr-TR.json +++ b/i18n/locales/tr-TR.json @@ -779,8 +779,7 @@ "preview": "önizleme", "code": "kod" }, - "file_path": "Dosya yolu", - "possibly_unnecessary": "May be unnecessary in a published package" + "file_path": "Dosya yolu" }, "badges": { "provenance": { diff --git a/i18n/locales/uk-UA.json b/i18n/locales/uk-UA.json index 5cd25320f0..336c409e1b 100644 --- a/i18n/locales/uk-UA.json +++ b/i18n/locales/uk-UA.json @@ -843,8 +843,7 @@ }, "file_path": "Шлях до файлу", "binary_file": "Бінарний файл", - "binary_rendering_warning": "Перегляд для даного типу файлів не підтримується", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Перегляд для даного типу файлів не підтримується" }, "badges": { "provenance": { diff --git a/i18n/locales/vi-VN.json b/i18n/locales/vi-VN.json index 6508fd5bf2..d9a5698fa2 100644 --- a/i18n/locales/vi-VN.json +++ b/i18n/locales/vi-VN.json @@ -843,8 +843,7 @@ }, "file_path": "Đường dẫn tệp", "binary_file": "Tệp binary", - "binary_rendering_warning": "Loại tệp \"{contentType}\" không hỗ trợ xem trước.", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "Loại tệp \"{contentType}\" không hỗ trợ xem trước." }, "badges": { "provenance": { diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index 4155959e1a..eb423981ba 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -1025,8 +1025,7 @@ }, "file_path": "文件路径", "binary_file": "二进制文件", - "binary_rendering_warning": "暂不支持预览“{contentType}”类型的文件。", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "暂不支持预览“{contentType}”类型的文件。" }, "badges": { "provenance": { diff --git a/i18n/locales/zh-TW.json b/i18n/locales/zh-TW.json index 8cbd7411d1..623e3955fe 100644 --- a/i18n/locales/zh-TW.json +++ b/i18n/locales/zh-TW.json @@ -963,8 +963,7 @@ }, "file_path": "檔案路徑", "binary_file": "二進位檔案", - "binary_rendering_warning": "檔案類型 \"{contentType}\" 不支援預覽。", - "possibly_unnecessary": "May be unnecessary in a published package" + "binary_rendering_warning": "檔案類型 \"{contentType}\" 不支援預覽。" }, "badges": { "provenance": { From 33f4ff7a3d6384844bc5917aae19c09ad5dd30e9 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Wed, 13 May 2026 10:27:31 -0700 Subject: [PATCH 4/5] feat(code): add gameroman's pattern + style suggestions Per @gameroman feedback on #2714: - Match __xyz__ directories via a new POSSIBLY_UNNECESSARY_DIRECTORY_PATTERNS regex set (catches __mocks__, __snapshots__, __fixtures__, etc. without enumerating each) - Add three conservative dot-prefixed config patterns (.babelrc, .stylelintrc.json, .x.config.js style). Explicit negative lookaheads exclude .npmrc since it is sometimes an intentional shipped artifact. - Apply text-yellow-600 dark:text-yellow-400 to the file/directory name span in FileTree.vue and DirectoryListing.vue when isPossiblyUnnecessaryContent returns true, complementing the existing amber info icon. Extends unit tests to cover the new patterns and pins .npmrc as a non-match so future broadening cannot silently break the exclusion. Signed-off-by: Matt Van Horn --- app/components/Code/DirectoryListing.vue | 10 +++++++++- app/components/Code/FileTree.vue | 20 +++++++++++++++++-- app/utils/package-content-hints.ts | 12 ++++++++++- .../app/utils/package-content-hints.spec.ts | 11 ++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/app/components/Code/DirectoryListing.vue b/app/components/Code/DirectoryListing.vue index ce9ce3a20f..ea47dd1adb 100644 --- a/app/components/Code/DirectoryListing.vue +++ b/app/components/Code/DirectoryListing.vue @@ -125,7 +125,15 @@ const bytesFormatter = useBytesFormatter() /> - {{ node.name }} + {{ node.name }} - {{ node.name }} + {{ node.name }}