feat(migrations): strict null checks (#13756)

This commit is contained in:
Maksim 2022-01-23 18:08:02 +01:00 коммит произвёл GitHub
Родитель 9d87ffbe38
Коммит dd8b5ad6a8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 28 добавлений и 28 удалений

Просмотреть файл

@ -2,7 +2,7 @@ import type { RenovateConfig } from '../../types';
import { AbstractMigration } from './abstract-migration';
export class RemovePropertyMigration extends AbstractMigration {
readonly propertyName: string;
override readonly propertyName: string;
constructor(
propertyName: string,

Просмотреть файл

@ -3,7 +3,7 @@ import { AbstractMigration } from './abstract-migration';
export class RenamePropertyMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName: string;
override readonly propertyName: string;
private readonly newPropertyName: string;
@ -18,7 +18,7 @@ export class RenamePropertyMigration extends AbstractMigration {
this.newPropertyName = newPropertyName;
}
override run(value): void {
override run(value: unknown): void {
this.setSafely(this.newPropertyName, value);
}
}

Просмотреть файл

@ -1,9 +1,9 @@
import { AbstractMigration } from '../base/abstract-migration';
export class BinarySourceMigration extends AbstractMigration {
readonly propertyName = 'binarySource';
override readonly propertyName = 'binarySource';
override run(value): void {
override run(value: unknown): void {
if (value === 'auto') {
this.rewrite('global');
}

Просмотреть файл

@ -2,9 +2,9 @@ import is from '@sindresorhus/is';
import { AbstractMigration } from '../base/abstract-migration';
export class EnabledManagersMigration extends AbstractMigration {
readonly propertyName = 'enabledManagers';
override readonly propertyName = 'enabledManagers';
override run(value: string[]): void {
override run(value: unknown): void {
if (is.array(value)) {
const newValue = value.map((manager) =>
manager === 'yarn' ? 'npm' : manager

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class GoModTidyMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'gomodTidy';
override readonly propertyName = 'gomodTidy';
override run(value): void {
override run(value: unknown): void {
const postUpdateOptions = this.get('postUpdateOptions');
if (value) {

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class IgnoreNodeModulesMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'ignoreNodeModules';
override readonly propertyName = 'ignoreNodeModules';
override run(value): void {
override run(value: unknown): void {
this.setSafely('ignorePaths', value ? ['node_modules/'] : []);
}
}

Просмотреть файл

@ -3,9 +3,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class PinVersionsMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'pinVersions';
override readonly propertyName = 'pinVersions';
override run(value): void {
override run(value: unknown): void {
if (is.boolean(value)) {
this.setSafely('rangeStrategy', value ? 'pin' : 'replace');
}

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class RebaseConflictedPrs extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'rebaseConflictedPrs';
override readonly propertyName = 'rebaseConflictedPrs';
override run(value): void {
override run(value: unknown): void {
if (value === false) {
this.setSafely('rebaseWhen', 'never');
}

Просмотреть файл

@ -3,9 +3,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class RebaseStalePrsMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'rebaseStalePrs';
override readonly propertyName = 'rebaseStalePrs';
override run(value): void {
override run(value: unknown): void {
const rebaseConflictedPrs = this.get('rebaseConflictedPrs');
if (rebaseConflictedPrs !== false) {

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class RequiredStatusChecksMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'requiredStatusChecks';
override readonly propertyName = 'requiredStatusChecks';
override run(value): void {
override run(value: unknown): void {
if (value === null) {
this.setSafely('ignoreTests', true);
}

Просмотреть файл

@ -2,9 +2,9 @@ import is from '@sindresorhus/is';
import { AbstractMigration } from '../base/abstract-migration';
export class SemanticCommitsMigration extends AbstractMigration {
readonly propertyName = 'semanticCommits';
override readonly propertyName = 'semanticCommits';
override run(value): void {
override run(value: unknown): void {
if (is.boolean(value)) {
this.rewrite(value ? 'enabled' : 'disabled');
} else if (value !== 'enabled' && value !== 'disabled') {

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class TrustLevelMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'trustLevel';
override readonly propertyName = 'trustLevel';
override run(value): void {
override run(value: unknown): void {
if (value === 'high') {
this.setSafely('allowCustomCrateRegistries', true);
this.setSafely('allowScripts', true);

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class UpgradeInRangeMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'upgradeInRange';
override readonly propertyName = 'upgradeInRange';
override run(value): void {
override run(value: unknown): void {
if (value === true) {
this.setSafely('rangeStrategy', 'bump');
}

Просмотреть файл

@ -2,9 +2,9 @@ import { AbstractMigration } from '../base/abstract-migration';
export class VersionStrategyMigration extends AbstractMigration {
override readonly deprecated = true;
readonly propertyName = 'versionStrategy';
override readonly propertyName = 'versionStrategy';
override run(value): void {
override run(value: unknown): void {
if (value === 'widen') {
this.setSafely('rangeStrategy', 'widen');
}

Просмотреть файл

@ -8,7 +8,7 @@
"include": [
"lib/config/app-strings.ts",
"lib/config/global.ts",
"lib/config/migrations/types.ts",
"lib/config/migrations/*",
"lib/config/presets/common.ts",
"lib/constants/**/*.ts",
"lib/data-files.generated.ts",