From a6f4e99e2796d0d2d38c466b35d3a7293bfc386f Mon Sep 17 00:00:00 2001
From: Jamie Magee <jamie.magee@gmail.com>
Date: Mon, 23 Aug 2021 21:50:37 +0100
Subject: [PATCH] refactor: no implicit override (#11395)

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
---
 lib/datasource/adoptium-java/index.ts      |  6 +++---
 lib/datasource/bitbucket-tags/index.ts     |  2 +-
 lib/datasource/cdnjs/index.ts              |  6 +++---
 lib/datasource/clojure/index.ts            |  9 +++++----
 lib/datasource/dart/index.ts               |  4 ++--
 lib/datasource/galaxy-collection/index.ts  |  4 ++--
 lib/datasource/galaxy/index.ts             |  4 ++--
 lib/datasource/gradle-version/index.ts     |  8 +++++---
 lib/datasource/helm/index.ts               |  4 ++--
 lib/datasource/orb/index.ts                |  4 ++--
 lib/datasource/ruby-version/index.ts       |  6 +++---
 lib/datasource/terraform-module/index.ts   |  6 +++---
 lib/datasource/terraform-provider/index.ts |  8 ++++----
 lib/util/http/bitbucket-server.ts          |  2 +-
 lib/util/http/bitbucket.ts                 |  2 +-
 lib/util/http/gitea.ts                     |  2 +-
 lib/util/http/github.ts                    |  2 +-
 lib/util/http/gitlab.ts                    |  2 +-
 lib/versioning/index.spec.ts               |  2 +-
 lib/versioning/loose/utils.spec.ts         |  2 +-
 lib/versioning/regex/index.ts              | 16 +++++++++++-----
 tools/jest-gh-reporter.ts                  |  5 ++++-
 tsconfig.json                              |  1 +
 23 files changed, 60 insertions(+), 47 deletions(-)

diff --git a/lib/datasource/adoptium-java/index.ts b/lib/datasource/adoptium-java/index.ts
index 0d51760f0d..ae380a9edf 100644
--- a/lib/datasource/adoptium-java/index.ts
+++ b/lib/datasource/adoptium-java/index.ts
@@ -13,11 +13,11 @@ export class AdoptiumJavaDatasource extends Datasource {
     super(datasource);
   }
 
-  customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  defaultRegistryUrls = [defaultRegistryUrl];
+  override readonly defaultRegistryUrls = [defaultRegistryUrl];
 
-  caching = true;
+  override readonly caching = true;
 
   @cache({
     namespace: `datasource-${datasource}`,
diff --git a/lib/datasource/bitbucket-tags/index.ts b/lib/datasource/bitbucket-tags/index.ts
index 33be94ef77..59b98e44ab 100644
--- a/lib/datasource/bitbucket-tags/index.ts
+++ b/lib/datasource/bitbucket-tags/index.ts
@@ -106,7 +106,7 @@ export class BitBucketTagsDatasource extends Datasource {
     key: ({ registryUrl, lookupName }: DigestConfig) =>
       BitBucketTagsDatasource.getCacheKey(registryUrl, lookupName, 'digest'),
   })
-  async getDigest(
+  override async getDigest(
     { lookupName: repo, registryUrl }: DigestConfig,
     newValue?: string
   ): Promise<string | null> {
diff --git a/lib/datasource/cdnjs/index.ts b/lib/datasource/cdnjs/index.ts
index 0944d32d39..cac132885f 100644
--- a/lib/datasource/cdnjs/index.ts
+++ b/lib/datasource/cdnjs/index.ts
@@ -10,11 +10,11 @@ export class CdnJsDatasource extends Datasource {
     super(CdnJsDatasource.id);
   }
 
-  customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  defaultRegistryUrls = ['https://api.cdnjs.com/'];
+  override readonly defaultRegistryUrls = ['https://api.cdnjs.com/'];
 
-  caching = true;
+  override readonly caching = true;
 
   // this.handleErrors will always throw
   // eslint-disable-next-line consistent-return
diff --git a/lib/datasource/clojure/index.ts b/lib/datasource/clojure/index.ts
index de4f1e1489..79b2c8cf03 100644
--- a/lib/datasource/clojure/index.ts
+++ b/lib/datasource/clojure/index.ts
@@ -10,11 +10,12 @@ export class ClojureDatasource extends Datasource {
     super(ClojureDatasource.id);
   }
 
-  readonly registryStrategy = 'merge';
+  override readonly registryStrategy = 'merge';
 
-  readonly customRegistrySupport = true;
-
-  readonly defaultRegistryUrls = ['https://clojars.org/repo', MAVEN_REPO];
+  override readonly defaultRegistryUrls = [
+    'https://clojars.org/repo',
+    MAVEN_REPO,
+  ];
 
   // eslint-disable-next-line class-methods-use-this
   getReleases({
diff --git a/lib/datasource/dart/index.ts b/lib/datasource/dart/index.ts
index eebf87e82b..1a29573116 100644
--- a/lib/datasource/dart/index.ts
+++ b/lib/datasource/dart/index.ts
@@ -10,9 +10,9 @@ export class DartDatasource extends Datasource {
     super(DartDatasource.id);
   }
 
-  readonly customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  readonly defaultRegistryUrls = ['https://pub.dartlang.org/'];
+  override readonly defaultRegistryUrls = ['https://pub.dartlang.org/'];
 
   async getReleases({
     lookupName,
diff --git a/lib/datasource/galaxy-collection/index.ts b/lib/datasource/galaxy-collection/index.ts
index 856c85561a..8b57b2063e 100644
--- a/lib/datasource/galaxy-collection/index.ts
+++ b/lib/datasource/galaxy-collection/index.ts
@@ -17,9 +17,9 @@ export class GalaxyCollectionDatasource extends Datasource {
     super(GalaxyCollectionDatasource.id);
   }
 
-  readonly customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  readonly defaultRegistryUrls = ['https://galaxy.ansible.com/'];
+  override readonly defaultRegistryUrls = ['https://galaxy.ansible.com/'];
 
   @cache({
     namespace: `datasource-${GalaxyCollectionDatasource.id}`,
diff --git a/lib/datasource/galaxy/index.ts b/lib/datasource/galaxy/index.ts
index ad9c03595e..960f3f5621 100644
--- a/lib/datasource/galaxy/index.ts
+++ b/lib/datasource/galaxy/index.ts
@@ -12,9 +12,9 @@ export class GalaxyDatasource extends Datasource {
     super(GalaxyDatasource.id);
   }
 
-  readonly customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  readonly defaultRegistryUrls = ['https://galaxy.ansible.com/'];
+  override readonly defaultRegistryUrls = ['https://galaxy.ansible.com/'];
 
   @cache({
     namespace: 'datasource-galaxy',
diff --git a/lib/datasource/gradle-version/index.ts b/lib/datasource/gradle-version/index.ts
index 56756a7e09..63f3dba74b 100644
--- a/lib/datasource/gradle-version/index.ts
+++ b/lib/datasource/gradle-version/index.ts
@@ -12,11 +12,13 @@ export class GradleVersionDatasource extends Datasource {
     super(GradleVersionDatasource.id);
   }
 
-  readonly defaultRegistryUrls = ['https://services.gradle.org/versions/all'];
+  override readonly defaultRegistryUrls = [
+    'https://services.gradle.org/versions/all',
+  ];
 
-  readonly defaultVersioning = gradleVersioning.id;
+  override readonly defaultVersioning = gradleVersioning.id;
 
-  readonly registryStrategy = 'merge';
+  override readonly registryStrategy = 'merge';
 
   private static readonly buildTimeRegex = regEx(
     '^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\+\\d\\d\\d\\d)$'
diff --git a/lib/datasource/helm/index.ts b/lib/datasource/helm/index.ts
index 6cf0e412cb..64e8ebabbc 100644
--- a/lib/datasource/helm/index.ts
+++ b/lib/datasource/helm/index.ts
@@ -14,9 +14,9 @@ export class HelmDatasource extends Datasource {
     super(HelmDatasource.id);
   }
 
-  readonly defaultRegistryUrls = ['https://charts.helm.sh/stable'];
+  override readonly defaultRegistryUrls = ['https://charts.helm.sh/stable'];
 
-  readonly defaultConfig = {
+  override readonly defaultConfig = {
     commitMessageTopic: 'Helm release {{depName}}',
     group: {
       commitMessageTopic: '{{{groupName}}} Helm releases',
diff --git a/lib/datasource/orb/index.ts b/lib/datasource/orb/index.ts
index 83da94996b..59b9ff90b1 100644
--- a/lib/datasource/orb/index.ts
+++ b/lib/datasource/orb/index.ts
@@ -24,9 +24,9 @@ export class OrbDatasource extends Datasource {
     super(OrbDatasource.id);
   }
 
-  customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  defaultRegistryUrls = ['https://circleci.com/'];
+  override readonly defaultRegistryUrls = ['https://circleci.com/'];
 
   @cache({
     namespace: `datasource-${OrbDatasource.id}`,
diff --git a/lib/datasource/ruby-version/index.ts b/lib/datasource/ruby-version/index.ts
index 9019d63c88..c5c845b7b7 100644
--- a/lib/datasource/ruby-version/index.ts
+++ b/lib/datasource/ruby-version/index.ts
@@ -13,11 +13,11 @@ export class RubyVersionDatasource extends Datasource {
     super(RubyVersionDatasource.id);
   }
 
-  readonly defaultRegistryUrls = ['https://www.ruby-lang.org/'];
+  override readonly defaultRegistryUrls = ['https://www.ruby-lang.org/'];
 
-  readonly customRegistrySupport = false;
+  override readonly customRegistrySupport = false;
 
-  readonly defaultVersioning = rubyVersioningId;
+  override readonly defaultVersioning = rubyVersioningId;
 
   @cache({ namespace: `datasource-${RubyVersionDatasource.id}`, key: 'all' })
   async getReleases({
diff --git a/lib/datasource/terraform-module/index.ts b/lib/datasource/terraform-module/index.ts
index 6c3f329657..3c2a9eca2b 100644
--- a/lib/datasource/terraform-module/index.ts
+++ b/lib/datasource/terraform-module/index.ts
@@ -8,15 +8,15 @@ import { TerraformDatasource } from './base';
 import type { RegistryRepository, TerraformRelease } from './types';
 
 export class TerraformModuleDatasource extends TerraformDatasource {
-  static readonly id = 'terraform-module';
+  static override readonly id = 'terraform-module';
 
   constructor() {
     super(TerraformModuleDatasource.id);
   }
 
-  readonly defaultRegistryUrls = ['https://registry.terraform.io'];
+  override readonly defaultRegistryUrls = ['https://registry.terraform.io'];
 
-  readonly defaultVersioning = hashicorpVersioning.id;
+  override readonly defaultVersioning = hashicorpVersioning.id;
 
   /**
    * This function will fetch a package from the specified Terraform registry and return all semver versions.
diff --git a/lib/datasource/terraform-provider/index.ts b/lib/datasource/terraform-provider/index.ts
index 4bd19dbd0a..1500d3b8af 100644
--- a/lib/datasource/terraform-provider/index.ts
+++ b/lib/datasource/terraform-provider/index.ts
@@ -16,7 +16,7 @@ import type {
 } from './types';
 
 export class TerraformProviderDatasource extends TerraformDatasource {
-  static readonly id = 'terraform-provider';
+  static override readonly id = 'terraform-provider';
 
   static readonly defaultRegistryUrls = [
     'https://registry.terraform.io',
@@ -29,12 +29,12 @@ export class TerraformProviderDatasource extends TerraformDatasource {
     super(TerraformProviderDatasource.id);
   }
 
-  readonly defaultRegistryUrls =
+  override readonly defaultRegistryUrls =
     TerraformProviderDatasource.defaultRegistryUrls;
 
-  readonly defaultVersioning = hashicorpVersioning.id;
+  override readonly defaultVersioning = hashicorpVersioning.id;
 
-  readonly registryStrategy = 'hunt';
+  override readonly registryStrategy = 'hunt';
 
   @cache({
     namespace: `datasource-${TerraformProviderDatasource.id}`,
diff --git a/lib/util/http/bitbucket-server.ts b/lib/util/http/bitbucket-server.ts
index c3017256d7..dd96385b99 100644
--- a/lib/util/http/bitbucket-server.ts
+++ b/lib/util/http/bitbucket-server.ts
@@ -12,7 +12,7 @@ export class BitbucketServerHttp extends Http {
     super(PLATFORM_TYPE_BITBUCKET_SERVER, options);
   }
 
-  protected request<T>(
+  protected override request<T>(
     path: string,
     options?: InternalHttpOptions
   ): Promise<HttpResponse<T> | null> {
diff --git a/lib/util/http/bitbucket.ts b/lib/util/http/bitbucket.ts
index db74f462b0..10f56e4a25 100644
--- a/lib/util/http/bitbucket.ts
+++ b/lib/util/http/bitbucket.ts
@@ -12,7 +12,7 @@ export class BitbucketHttp extends Http {
     super(PLATFORM_TYPE_BITBUCKET, options);
   }
 
-  protected request<T>(
+  protected override request<T>(
     url: string | URL,
     options?: InternalHttpOptions
   ): Promise<HttpResponse<T> | null> {
diff --git a/lib/util/http/gitea.ts b/lib/util/http/gitea.ts
index ab1e062259..5410284e38 100644
--- a/lib/util/http/gitea.ts
+++ b/lib/util/http/gitea.ts
@@ -33,7 +33,7 @@ export class GiteaHttp extends Http<GiteaHttpOptions, GiteaHttpOptions> {
     super(PLATFORM_TYPE_GITEA, options);
   }
 
-  protected async request<T>(
+  protected override async request<T>(
     path: string,
     options?: InternalHttpOptions & GiteaHttpOptions
   ): Promise<HttpResponse<T> | null> {
diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts
index 70d55b7022..722ea322a3 100644
--- a/lib/util/http/github.ts
+++ b/lib/util/http/github.ts
@@ -162,7 +162,7 @@ export class GithubHttp extends Http<GithubHttpOptions, GithubHttpOptions> {
     super(PLATFORM_TYPE_GITHUB, options);
   }
 
-  protected async request<T>(
+  protected override async request<T>(
     url: string | URL,
     options?: GithubInternalOptions & GithubHttpOptions,
     okToRetry = true
diff --git a/lib/util/http/gitlab.ts b/lib/util/http/gitlab.ts
index f93df7358a..a9ca70f00c 100644
--- a/lib/util/http/gitlab.ts
+++ b/lib/util/http/gitlab.ts
@@ -24,7 +24,7 @@ export class GitlabHttp extends Http<GitlabHttpOptions, GitlabHttpOptions> {
     super(PLATFORM_TYPE_GITLAB, options);
   }
 
-  protected async request<T>(
+  protected override async request<T>(
     url: string | URL,
     options?: GitlabInternalOptions & GitlabHttpOptions
   ): Promise<HttpResponse<T> | null> {
diff --git a/lib/versioning/index.spec.ts b/lib/versioning/index.spec.ts
index 9de3bba101..9209756861 100644
--- a/lib/versioning/index.spec.ts
+++ b/lib/versioning/index.spec.ts
@@ -113,7 +113,7 @@ describe('versioning/index', () => {
     it('dummy', () => {
       class DummyScheme extends GenericVersioningApi {
         // eslint-disable-next-line class-methods-use-this
-        protected _compare(_version: string, _other: string): number {
+        protected override _compare(_version: string, _other: string): number {
           throw new Error('Method not implemented.');
         }
 
diff --git a/lib/versioning/loose/utils.spec.ts b/lib/versioning/loose/utils.spec.ts
index 91b33aec2a..0a2e2652ab 100644
--- a/lib/versioning/loose/utils.spec.ts
+++ b/lib/versioning/loose/utils.spec.ts
@@ -32,7 +32,7 @@ describe('versioning/loose/utils', () => {
   describe('GenericVersioningApi', () => {
     class DummyScheme extends GenericVersioningApi {
       // eslint-disable-next-line class-methods-use-this
-      protected _compare(_version: string, _other: string): number {
+      protected override _compare(_version: string, _other: string): number {
         return _version ? _version.localeCompare(_other) : 0;
       }
 
diff --git a/lib/versioning/regex/index.ts b/lib/versioning/regex/index.ts
index 43252b36ae..f597df18a8 100644
--- a/lib/versioning/regex/index.ts
+++ b/lib/versioning/regex/index.ts
@@ -92,31 +92,37 @@ export class RegExpVersioningApi extends GenericVersioningApi<RegExpVersion> {
     };
   }
 
-  isCompatible(version: string, range: string): boolean {
+  override isCompatible(version: string, range: string): boolean {
     return (
       this._parse(version).compatibility === this._parse(range).compatibility
     );
   }
 
-  isLessThanRange(version: string, range: string): boolean {
+  override isLessThanRange(version: string, range: string): boolean {
     return ltr(asSemver(this._parse(version)), asSemver(this._parse(range)));
   }
 
-  getSatisfyingVersion(versions: string[], range: string): string | null {
+  override getSatisfyingVersion(
+    versions: string[],
+    range: string
+  ): string | null {
     return maxSatisfying(
       versions.map((v) => asSemver(this._parse(v))),
       asSemver(this._parse(range))
     );
   }
 
-  minSatisfyingVersion(versions: string[], range: string): string | null {
+  override minSatisfyingVersion(
+    versions: string[],
+    range: string
+  ): string | null {
     return minSatisfying(
       versions.map((v) => asSemver(this._parse(v))),
       asSemver(this._parse(range))
     );
   }
 
-  matches(version: string, range: string): boolean {
+  override matches(version: string, range: string): boolean {
     return satisfies(
       asSemver(this._parse(version)),
       asSemver(this._parse(range))
diff --git a/tools/jest-gh-reporter.ts b/tools/jest-gh-reporter.ts
index 3112a8c883..a6c154690b 100644
--- a/tools/jest-gh-reporter.ts
+++ b/tools/jest-gh-reporter.ts
@@ -46,7 +46,10 @@ function getPos(msg: string): Record<string, string> {
 
 class GitHubReporter extends BaseReporter {
   // eslint-disable-next-line class-methods-use-this
-  onRunComplete(_contexts: Set<Context>, testResult: AggregatedResult): void {
+  override onRunComplete(
+    _contexts: Set<Context>,
+    testResult: AggregatedResult
+  ): void {
     try {
       if (getEnv('GITHUB_ACTIONS') !== 'true') {
         return;
diff --git a/tsconfig.json b/tsconfig.json
index f3cee72242..920493bcb7 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,6 +11,7 @@
     "esModuleInterop": true,
     "resolveJsonModule": false,
     "noUnusedLocals": true,
+    "noImplicitOverride": true,
     "experimentalDecorators": true,
     "lib": ["es2018"],
     "types": ["node", "jest", "jest-extended"],
-- 
GitLab