chore(lint): biome config + auto-fix sweep + translation hot-path quality fixes
- biome: enable unsafeParameterDecoratorsEnabled (NestJS @Body/@Query); ignore *.gen.ts; spec files override noExplicitAny - translations: remove dictionary fallback DB write — was producing half-translated strings (e.g. "Body frame" → "Kaporta frame") that poisoned future lookups; now misses fall through to bootstrap script - categories: add translateMany() to PCAT root/subgroup/parts insert paths (was only EMEX) - auto-fix: organize imports, type-only imports, node: protocol on stdlib imports, and template-literal cleanups across 24 files Drops lint count from 769 → 257; remaining are legacy noNonNullAssertion / noArrayIndexKey / useExhaustiveDependencies that need manual review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,12 @@ export type { PaginationInput, PaginatedResult } from "./types/pagination.js";
|
||||
|
||||
// Schemas
|
||||
export { vinSchema } from "./schemas/vin.js";
|
||||
export { loginSchema, registerSchema, forgotPasswordSchema, resetPasswordSchema } from "./schemas/auth.js";
|
||||
export {
|
||||
loginSchema,
|
||||
registerSchema,
|
||||
forgotPasswordSchema,
|
||||
resetPasswordSchema,
|
||||
} from "./schemas/auth.js";
|
||||
export { paginationSchema } from "./schemas/pagination.js";
|
||||
|
||||
// Constants
|
||||
@@ -40,4 +45,10 @@ export {
|
||||
extractModelYear,
|
||||
} from "./utils/vin-validator.js";
|
||||
export { formatTRY, kurusToLira, liraToKurus } from "./utils/currency.js";
|
||||
export { formatVin, formatDate, formatDateTime, slugify, generateReferralCode } from "./utils/formatters.js";
|
||||
export {
|
||||
formatVin,
|
||||
formatDate,
|
||||
formatDateTime,
|
||||
slugify,
|
||||
generateReferralCode,
|
||||
} from "./utils/formatters.js";
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
import { VIN_REGEX } from "../constants/regex.js";
|
||||
|
||||
const TRANSLITERATION: Record<string, number> = {
|
||||
A: 1, B: 2, C: 3, D: 4, E: 5, F: 6, G: 7, H: 8,
|
||||
J: 1, K: 2, L: 3, M: 4, N: 5, P: 7, R: 9,
|
||||
S: 2, T: 3, U: 4, V: 5, W: 6, X: 7, Y: 8, Z: 9,
|
||||
A: 1,
|
||||
B: 2,
|
||||
C: 3,
|
||||
D: 4,
|
||||
E: 5,
|
||||
F: 6,
|
||||
G: 7,
|
||||
H: 8,
|
||||
J: 1,
|
||||
K: 2,
|
||||
L: 3,
|
||||
M: 4,
|
||||
N: 5,
|
||||
P: 7,
|
||||
R: 9,
|
||||
S: 2,
|
||||
T: 3,
|
||||
U: 4,
|
||||
V: 5,
|
||||
W: 6,
|
||||
X: 7,
|
||||
Y: 8,
|
||||
Z: 9,
|
||||
};
|
||||
|
||||
const POSITION_WEIGHTS = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];
|
||||
@@ -38,11 +58,36 @@ export function extractWmi(vin: string): string {
|
||||
export function extractModelYear(vin: string): number | null {
|
||||
const yearChar = vin.toUpperCase()[9];
|
||||
const yearMap: Record<string, number> = {
|
||||
A: 2010, B: 2011, C: 2012, D: 2013, E: 2014, F: 2015, G: 2016, H: 2017,
|
||||
J: 2018, K: 2019, L: 2020, M: 2021, N: 2022, P: 2023, R: 2024, S: 2025,
|
||||
T: 2026, V: 2027, W: 2028, X: 2029, Y: 2030,
|
||||
"1": 2001, "2": 2002, "3": 2003, "4": 2004, "5": 2005,
|
||||
"6": 2006, "7": 2007, "8": 2008, "9": 2009,
|
||||
A: 2010,
|
||||
B: 2011,
|
||||
C: 2012,
|
||||
D: 2013,
|
||||
E: 2014,
|
||||
F: 2015,
|
||||
G: 2016,
|
||||
H: 2017,
|
||||
J: 2018,
|
||||
K: 2019,
|
||||
L: 2020,
|
||||
M: 2021,
|
||||
N: 2022,
|
||||
P: 2023,
|
||||
R: 2024,
|
||||
S: 2025,
|
||||
T: 2026,
|
||||
V: 2027,
|
||||
W: 2028,
|
||||
X: 2029,
|
||||
Y: 2030,
|
||||
"1": 2001,
|
||||
"2": 2002,
|
||||
"3": 2003,
|
||||
"4": 2004,
|
||||
"5": 2005,
|
||||
"6": 2006,
|
||||
"7": 2007,
|
||||
"8": 2008,
|
||||
"9": 2009,
|
||||
};
|
||||
return yearMap[yearChar] ?? null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user