diff --git a/.eslintrc.js b/.eslintrc.js
index 658660bd8a15fd9098e6c3800e16786d85a2173d..7162401f80cee54600953d2dd2f2f480696c2948 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -36,6 +36,7 @@ module.exports = {
     'import/prefer-default-export': 0, // no benefit
 
     // other rules
+    'consistent-return': 'error',
     'no-negated-condition': 'error',
     'no-param-reassign': 'error',
     'sort-imports': [
diff --git a/lib/datasource/cdnjs/index.ts b/lib/datasource/cdnjs/index.ts
index 7fbce6cb9fcfa59c2ed51910cb795b8aad8a8c32..8f3aa41dd2b51e018857759c5ea6409bb8dbf82f 100644
--- a/lib/datasource/cdnjs/index.ts
+++ b/lib/datasource/cdnjs/index.ts
@@ -25,6 +25,7 @@ export class CdnJsDatasource extends Datasource {
     // Each library contains multiple assets, so we cache at the library level instead of per-asset
     const library = lookupName.split('/')[0];
     const url = `${registryUrl}libraries/${library}?fields=homepage,repository,assets`;
+    let result: ReleaseResult;
     try {
       const { assets, homepage, repository } = (
         await this.http.getJson<CdnjsResponse>(url)
@@ -37,7 +38,7 @@ export class CdnJsDatasource extends Datasource {
         .filter(({ files }) => files.includes(assetName))
         .map(({ version, sri }) => ({ version, newDigest: sri[assetName] }));
 
-      const result: ReleaseResult = { releases };
+      result = { releases };
 
       if (homepage) {
         result.homepage = homepage;
@@ -45,12 +46,12 @@ export class CdnJsDatasource extends Datasource {
       if (repository?.url) {
         result.sourceUrl = repository.url;
       }
-      return result;
     } catch (err) {
       if (err.statusCode !== 404) {
         throw new ExternalHostError(err);
       }
       this.handleGenericErrors(err);
     }
+    return result || null;
   }
 }