UNPKG

env-sentinel

Version:

Zero-dependency tool that auto-validates .env files against schema.env, with optional fallback and secure warnings.

20 lines (19 loc) 706 B
export function noEmptyQuotesCheck(lineNumber, lineContent) { const equalIndex = lineContent.indexOf('='); if (equalIndex === -1) return; const rawKey = lineContent.slice(0, equalIndex).trim(); const rawValue = lineContent.slice(equalIndex + 1).trim(); const value = rawValue.split('#')[0].trim(); const isDoubleEmpty = value === '""'; const isSingleEmpty = value === "''"; if (isDoubleEmpty || isSingleEmpty) { return { line: lineNumber, issue: `Empty quoted string in "${rawKey}" is discouraged — use unquoted empty value instead`, content: lineContent, severity: 'warning', }; } return; }