* Validate the `extensions` map. Every failure mode degrades to "no overrides * from this entry" — a bad value or a typo'd language never throws.
(parsed: object, file: string)
| 143 | * from this entry" — a bad value or a typo'd language never throws. |
| 144 | */ |
| 145 | function extractExtensions(parsed: object, file: string): Record<string, Language> { |
| 146 | const exts = (parsed as ProjectConfig).extensions; |
| 147 | if (!exts || typeof exts !== 'object' || Array.isArray(exts)) return EMPTY_EXTENSIONS; |
| 148 | |
| 149 | const out: Record<string, Language> = {}; |
| 150 | for (const [rawKey, rawVal] of Object.entries(exts)) { |
| 151 | const key = normalizeExtKey(rawKey); |
| 152 | if (!key) { |
| 153 | logWarn(`Ignoring extension mapping in ${PROJECT_CONFIG_FILENAME}: "${rawKey}" is not a valid file extension`, { file }); |
| 154 | continue; |
| 155 | } |
| 156 | if (typeof rawVal !== 'string' || !isLanguageSupported(rawVal as Language)) { |
| 157 | logWarn(`Ignoring extension "${rawKey}" in ${PROJECT_CONFIG_FILENAME}: "${String(rawVal)}" is not a supported language`, { file }); |
| 158 | continue; |
| 159 | } |
| 160 | out[key] = rawVal as Language; |
| 161 | } |
| 162 | |
| 163 | return Object.keys(out).length > 0 ? out : EMPTY_EXTENSIONS; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Validate the `includeIgnored` patterns: an array of non-empty gitignore-style |
no test coverage detected