From dd8b5ad6a8d0e73055fdcf21994be5e07e26ca9a Mon Sep 17 00:00:00 2001 From: Maksim Date: Sun, 23 Jan 2022 18:08:02 +0100 Subject: [PATCH] feat(migrations): strict null checks (#13756) --- lib/config/migrations/base/remove-property-migration.ts | 2 +- lib/config/migrations/base/rename-property-migration.ts | 4 ++-- lib/config/migrations/custom/binary-source-migration.ts | 4 ++-- lib/config/migrations/custom/enabled-managers-migration.ts | 4 ++-- lib/config/migrations/custom/go-mod-tidy-migration.ts | 4 ++-- lib/config/migrations/custom/ignore-node-modules-migration.ts | 4 ++-- lib/config/migrations/custom/pin-versions-migration.ts | 4 ++-- .../migrations/custom/rebase-conflicted-prs-migration.ts | 4 ++-- lib/config/migrations/custom/rebase-stale-prs-migration.ts | 4 ++-- .../migrations/custom/required-status-checks-migration.ts | 4 ++-- lib/config/migrations/custom/semantic-commits-migration.ts | 4 ++-- lib/config/migrations/custom/trust-level-migration.ts | 4 ++-- lib/config/migrations/custom/upgrade-in-range-migration.ts | 4 ++-- lib/config/migrations/custom/version-strategy-migration.ts | 4 ++-- tsconfig.strict.json | 2 +- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/config/migrations/base/remove-property-migration.ts b/lib/config/migrations/base/remove-property-migration.ts index 21c8b61e0..409296455 100644 --- a/lib/config/migrations/base/remove-property-migration.ts +++ b/lib/config/migrations/base/remove-property-migration.ts @@ -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, diff --git a/lib/config/migrations/base/rename-property-migration.ts b/lib/config/migrations/base/rename-property-migration.ts index 5a93a9c4d..088cf1f49 100644 --- a/lib/config/migrations/base/rename-property-migration.ts +++ b/lib/config/migrations/base/rename-property-migration.ts @@ -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); } } diff --git a/lib/config/migrations/custom/binary-source-migration.ts b/lib/config/migrations/custom/binary-source-migration.ts index 81337609e..22c6dfd2f 100644 --- a/lib/config/migrations/custom/binary-source-migration.ts +++ b/lib/config/migrations/custom/binary-source-migration.ts @@ -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'); } diff --git a/lib/config/migrations/custom/enabled-managers-migration.ts b/lib/config/migrations/custom/enabled-managers-migration.ts index 0841b68e0..ddc0b2d4b 100644 --- a/lib/config/migrations/custom/enabled-managers-migration.ts +++ b/lib/config/migrations/custom/enabled-managers-migration.ts @@ -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 diff --git a/lib/config/migrations/custom/go-mod-tidy-migration.ts b/lib/config/migrations/custom/go-mod-tidy-migration.ts index 455a21bca..532e47e79 100644 --- a/lib/config/migrations/custom/go-mod-tidy-migration.ts +++ b/lib/config/migrations/custom/go-mod-tidy-migration.ts @@ -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) { diff --git a/lib/config/migrations/custom/ignore-node-modules-migration.ts b/lib/config/migrations/custom/ignore-node-modules-migration.ts index a579603f2..fd2d69201 100644 --- a/lib/config/migrations/custom/ignore-node-modules-migration.ts +++ b/lib/config/migrations/custom/ignore-node-modules-migration.ts @@ -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/'] : []); } } diff --git a/lib/config/migrations/custom/pin-versions-migration.ts b/lib/config/migrations/custom/pin-versions-migration.ts index 1e6bf5e26..03e764943 100644 --- a/lib/config/migrations/custom/pin-versions-migration.ts +++ b/lib/config/migrations/custom/pin-versions-migration.ts @@ -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'); } diff --git a/lib/config/migrations/custom/rebase-conflicted-prs-migration.ts b/lib/config/migrations/custom/rebase-conflicted-prs-migration.ts index 388d8d7dd..7c7003ef5 100644 --- a/lib/config/migrations/custom/rebase-conflicted-prs-migration.ts +++ b/lib/config/migrations/custom/rebase-conflicted-prs-migration.ts @@ -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'); } diff --git a/lib/config/migrations/custom/rebase-stale-prs-migration.ts b/lib/config/migrations/custom/rebase-stale-prs-migration.ts index 27e68d382..6df27b8bf 100644 --- a/lib/config/migrations/custom/rebase-stale-prs-migration.ts +++ b/lib/config/migrations/custom/rebase-stale-prs-migration.ts @@ -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) { diff --git a/lib/config/migrations/custom/required-status-checks-migration.ts b/lib/config/migrations/custom/required-status-checks-migration.ts index db4bd86fb..a2f4c6f22 100644 --- a/lib/config/migrations/custom/required-status-checks-migration.ts +++ b/lib/config/migrations/custom/required-status-checks-migration.ts @@ -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); } diff --git a/lib/config/migrations/custom/semantic-commits-migration.ts b/lib/config/migrations/custom/semantic-commits-migration.ts index 6deab7ad7..9fdd141b9 100644 --- a/lib/config/migrations/custom/semantic-commits-migration.ts +++ b/lib/config/migrations/custom/semantic-commits-migration.ts @@ -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') { diff --git a/lib/config/migrations/custom/trust-level-migration.ts b/lib/config/migrations/custom/trust-level-migration.ts index b7ec2cab0..a39fdc7d9 100644 --- a/lib/config/migrations/custom/trust-level-migration.ts +++ b/lib/config/migrations/custom/trust-level-migration.ts @@ -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); diff --git a/lib/config/migrations/custom/upgrade-in-range-migration.ts b/lib/config/migrations/custom/upgrade-in-range-migration.ts index 4a36a6d3b..88d5e99f1 100644 --- a/lib/config/migrations/custom/upgrade-in-range-migration.ts +++ b/lib/config/migrations/custom/upgrade-in-range-migration.ts @@ -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'); } diff --git a/lib/config/migrations/custom/version-strategy-migration.ts b/lib/config/migrations/custom/version-strategy-migration.ts index 8df84ee19..7815cc6c5 100644 --- a/lib/config/migrations/custom/version-strategy-migration.ts +++ b/lib/config/migrations/custom/version-strategy-migration.ts @@ -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'); } diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 443ad272b..2969e1b1b 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -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",