mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-02 02:29:51 +00:00
c32e2391a0
Refs #45216 The object counterpart to `prefer-coerce-array`: `x ?? {}` becomes `coerceObject(x)`. The rule flags a `??` whose default is a bare `{}` literal, so a populated default or an asserted `({} as Foo)` still passes; a `x ?? y ?? {}` chain maps onto `coerceObject(x, y)`. Every hit across `lib/` converted cleanly, so no disable comments were needed.
25 lines
762 B
TypeScript
25 lines
762 B
TypeScript
import { coerceObject } from '../../../util/object.ts';
|
|
import type { RenovateConfig } from '../../types.ts';
|
|
import { AbstractMigration } from '../base/abstract-migration.ts';
|
|
|
|
export class NodeMigration extends AbstractMigration {
|
|
override readonly propertyName = 'node';
|
|
|
|
override run(value: unknown): void {
|
|
const node = this.get('node')!;
|
|
// v8 ignore else -- TODO: add test #40625
|
|
if ((value as RenovateConfig).enabled === true) {
|
|
// validated non-null
|
|
delete node.enabled;
|
|
const travis = coerceObject(this.get('travis'));
|
|
travis.enabled = true;
|
|
if (Object.keys(node).length) {
|
|
this.rewrite(node);
|
|
} else {
|
|
this.delete('node');
|
|
}
|
|
this.setSafely('travis', travis);
|
|
}
|
|
}
|
|
}
|