mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-25 06:51:11 +00:00
9717259ffc
Enable no-else-return (with allowElseIf: false) and unicorn/no-lonely-if as errors in .oxlintrc.json and fix all 131 pre-existing violations (91 no-else-return, 40 unicorn/no-lonely-if) across 98 files. The no-else-return violations were fixed with the oxlint autofix (iterated to a fixpoint, plus two else-if chains that required --fix-dangerously) followed by Prettier formatting. One comment dropped by the autofix in lib/modules/manager/pub/artifacts.ts was restored manually. The unicorn/no-lonely-if violations were merged by hand, preserving comments and coverage-ignore hints. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
29 lines
676 B
TypeScript
29 lines
676 B
TypeScript
import { logger } from '../../../logger/index.ts';
|
|
import { Pubspec, PubspecLock } from './schema.ts';
|
|
|
|
export function parsePubspec(
|
|
fileName: string,
|
|
fileContent: string,
|
|
): Pubspec | null {
|
|
const res = Pubspec.safeParse(fileContent);
|
|
if (res.success) {
|
|
return res.data;
|
|
}
|
|
logger.debug({ err: res.error, fileName }, 'Error parsing pubspec.');
|
|
|
|
return null;
|
|
}
|
|
|
|
export function parsePubspecLock(
|
|
fileName: string,
|
|
fileContent: string,
|
|
): PubspecLock | null {
|
|
const res = PubspecLock.safeParse(fileContent);
|
|
if (res.success) {
|
|
return res.data;
|
|
}
|
|
logger.debug({ err: res.error, fileName }, 'Error parsing pubspec lockfile.');
|
|
|
|
return null;
|
|
}
|