env-sentinel
Version:
Zero-dependency tool that auto-validates .env files against schema.env, with optional fallback and secure warnings.
17 lines (16 loc) • 501 B
JavaScript
import { isEmptyOrCommentLine } from '../utils.js';
export function noLeadingSpacesCheck(lineNumber, lineContent) {
if (isEmptyOrCommentLine(lineContent)) {
return;
}
const [rawKey] = lineContent.split('=');
if (rawKey.length > 0 && rawKey !== rawKey.trimStart()) {
return {
line: lineNumber,
issue: `Variable name has leading spaces: "${rawKey}"`,
content: lineContent,
severity: 'error',
};
}
return;
}