From cfc6c5ccdfb2aa69605e5d025233db68a7484d2e Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <renovate[bot]@users.noreply.github.com>
Date: Fri, 15 Sep 2017 19:46:25 +0200
Subject: [PATCH] fix: update dependency eslint-config-airbnb-base to v12
 (#771)

* chore(deps): update dependency eslint-config-airbnb-base to v12.0.0

* fix lint
---
 lib/api/docker.js                   |  2 +-
 lib/api/github.js                   |  4 ++--
 lib/api/gitlab.js                   | 12 ++++++------
 lib/config/decrypt.js               |  2 +-
 lib/config/migration.js             |  2 +-
 lib/config/presets.js               |  6 +++---
 lib/logger/pretty-stdout.js         |  2 +-
 lib/workers/branch/status-checks.js |  2 +-
 lib/workers/package-file/index.js   |  6 +++---
 lib/workers/package/index.js        |  2 +-
 lib/workers/package/versions.js     |  4 ++--
 lib/workers/pr/index.js             |  5 ++---
 lib/workers/repository/apis.js      |  4 ++--
 lib/workers/repository/cleanup.js   |  2 +-
 package.json                        |  2 +-
 test/.eslintrc.js                   | 15 ++++++++-------
 yarn.lock                           |  6 +++---
 17 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/lib/api/docker.js b/lib/api/docker.js
index 159b058d1e..196d0b9cb4 100644
--- a/lib/api/docker.js
+++ b/lib/api/docker.js
@@ -9,7 +9,7 @@ async function getDigest(name, tag, logger) {
   try {
     const authUrl = `https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repository}:pull`;
     logger.debug(`Obtaining docker registry token for ${repository}`);
-    const token = (await got(authUrl, { json: true })).body.token;
+    const { token } = (await got(authUrl, { json: true })).body;
     if (!token) {
       logger.warn('Failed to obtain docker registry token');
       return null;
diff --git a/lib/api/github.js b/lib/api/github.js
index 95f9626b6e..dc2e9247ba 100644
--- a/lib/api/github.js
+++ b/lib/api/github.js
@@ -651,7 +651,7 @@ async function getFileContent(filePath, branchName) {
   );
   try {
     const file = await getFile(filePath, branchName);
-    return new Buffer(file, 'base64').toString();
+    return Buffer.from(file, 'base64').toString();
   } catch (error) {
     if (error.statusCode === 404) {
       // If file not found, then return null JSON
@@ -751,7 +751,7 @@ async function createBlob(fileContents) {
   return (await ghGotRetry.post(`repos/${config.repoName}/git/blobs`, {
     body: {
       encoding: 'base64',
-      content: new Buffer(fileContents).toString('base64'),
+      content: Buffer.from(fileContents).toString('base64'),
     },
   })).body.sha;
 }
diff --git a/lib/api/gitlab.js b/lib/api/gitlab.js
index bb25a9b9dd..55022b0709 100644
--- a/lib/api/gitlab.js
+++ b/lib/api/gitlab.js
@@ -226,7 +226,7 @@ async function getBranchStatus(branchName, requiredStatusChecks) {
       if (check.status === 'failed') {
         status = 'failure';
       } else if (check.status !== 'success') {
-        status = check.status;
+        ({ status } = check);
       }
     }
   });
@@ -448,7 +448,7 @@ async function getFile(filePath, branchName) {
 async function getFileContent(filePath, branchName) {
   try {
     const file = await getFile(filePath, branchName);
-    return new Buffer(file, 'base64').toString();
+    return Buffer.from(file, 'base64').toString();
   } catch (error) {
     if (error.statusCode === 404) {
       // If file not found, then return null JSON
@@ -475,7 +475,7 @@ async function createFile(branchName, filePath, fileContents, message) {
       branch_name: branchName,
       commit_message: message,
       encoding: 'base64',
-      content: new Buffer(fileContents).toString('base64'),
+      content: Buffer.from(fileContents).toString('base64'),
     };
   } else {
     url = `projects/${config.repoName}/repository/files/${filePath}`;
@@ -483,7 +483,7 @@ async function createFile(branchName, filePath, fileContents, message) {
       branch: branchName,
       commit_message: message,
       encoding: 'base64',
-      content: new Buffer(fileContents).toString('base64'),
+      content: Buffer.from(fileContents).toString('base64'),
     };
   }
   await glGot.post(url, opts);
@@ -500,7 +500,7 @@ async function updateFile(branchName, filePath, fileContents, message) {
       branch_name: branchName,
       commit_message: message,
       encoding: 'base64',
-      content: new Buffer(fileContents).toString('base64'),
+      content: Buffer.from(fileContents).toString('base64'),
     };
   } else {
     url = `projects/${config.repoName}/repository/files/${filePath}`;
@@ -508,7 +508,7 @@ async function updateFile(branchName, filePath, fileContents, message) {
       branch: branchName,
       commit_message: message,
       encoding: 'base64',
-      content: new Buffer(fileContents).toString('base64'),
+      content: Buffer.from(fileContents).toString('base64'),
     };
   }
   await glGot.put(url, opts);
diff --git a/lib/config/decrypt.js b/lib/config/decrypt.js
index 1a13820645..e0c3ae04dc 100644
--- a/lib/config/decrypt.js
+++ b/lib/config/decrypt.js
@@ -21,7 +21,7 @@ function decryptConfig(
             const decryptedStr = crypto
               .privateDecrypt(
                 privateKey,
-                new Buffer(val[encryptedKey], 'base64')
+                Buffer.from(val[encryptedKey], 'base64')
               )
               .toString();
             logger.info(`Decrypted ${encryptedKey}`);
diff --git a/lib/config/migration.js b/lib/config/migration.js
index 74dea3413b..0d5a349135 100644
--- a/lib/config/migration.js
+++ b/lib/config/migration.js
@@ -145,7 +145,7 @@ function migrateConfig(config, parentConfig) {
       }
       if (isMigrated) {
         if (typeof val === 'string' && schedules.length === 1) {
-          migratedConfig.schedule = schedules[0];
+          [migratedConfig.schedule] = schedules;
         } else {
           migratedConfig.schedule = schedules;
         }
diff --git a/lib/config/presets.js b/lib/config/presets.js
index 0e76d809c3..2d16653331 100644
--- a/lib/config/presets.js
+++ b/lib/config/presets.js
@@ -113,7 +113,7 @@ function parsePreset(input) {
     presetName = str.slice(1);
   } else if (str[0] === '@') {
     // scoped namespace
-    packageName = str.match(/(@.*?)(:|$)/)[1];
+    [, packageName] = str.match(/(@.*?)(:|$)/);
     str = str.slice(packageName.length);
     if (!packageName.includes('/')) {
       packageName += '/renovate-config';
@@ -125,7 +125,7 @@ function parsePreset(input) {
     }
   } else {
     // non-scoped namespace
-    packageName = str.match(/(.*?)(:|$)/)[1];
+    [, packageName] = str.match(/(.*?)(:|$)/);
     presetName = str.slice(packageName.length + 1);
     if (packageName.indexOf('renovate-config-') !== 0) {
       packageName = `renovate-config-${packageName}`;
@@ -187,7 +187,7 @@ async function getPreset(preset, logger) {
   if (presetKeys.every(key => packageListKeys.includes(key))) {
     delete presetConfig.description;
   }
-  const migratedConfig = migration.migrateConfig(presetConfig).migratedConfig;
+  const { migratedConfig } = migration.migrateConfig(presetConfig);
   return massage.massageConfig(migratedConfig);
 }
 
diff --git a/lib/logger/pretty-stdout.js b/lib/logger/pretty-stdout.js
index a48055940f..f054450849 100644
--- a/lib/logger/pretty-stdout.js
+++ b/lib/logger/pretty-stdout.js
@@ -1,7 +1,7 @@
 // Code derived from https://github.com/hadfieldn/node-bunyan-RenovateStream and heavily edited
 // Neither fork nor original repo appear to be maintained
 
-const Stream = require('stream').Stream;
+const { Stream } = require('stream');
 const util = require('util');
 const chalk = require('chalk');
 const stringify = require('json-stringify-pretty-compact');
diff --git a/lib/workers/branch/status-checks.js b/lib/workers/branch/status-checks.js
index a7a427cf06..2fc4418123 100644
--- a/lib/workers/branch/status-checks.js
+++ b/lib/workers/branch/status-checks.js
@@ -10,7 +10,7 @@ async function setUnpublishable(config) {
       if (typeof unpublishable !== 'undefined') {
         unpublishable = unpublishable && upgrade.unpublishable;
       } else {
-        unpublishable = upgrade.unpublishable;
+        ({ unpublishable } = upgrade);
       }
     }
   }
diff --git a/lib/workers/package-file/index.js b/lib/workers/package-file/index.js
index 0d4f967230..2406209763 100644
--- a/lib/workers/package-file/index.js
+++ b/lib/workers/package-file/index.js
@@ -16,7 +16,7 @@ async function renovatePackageFile(packageFileConfig) {
     npmApi.setNpmrc(config.npmrc);
   }
   let upgrades = [];
-  logger = config.logger;
+  ({ logger } = config);
   logger.info(`Processing package file`);
 
   // Check if config is disabled
@@ -75,7 +75,7 @@ async function renovatePackageFile(packageFileConfig) {
 async function renovateMeteorPackageFile(packageFileConfig) {
   const config = { ...packageFileConfig };
   let upgrades = [];
-  logger = config.logger;
+  ({ logger } = config);
   logger.info(`Processing meteor package file`);
 
   // Check if config is disabled
@@ -95,7 +95,7 @@ async function renovateMeteorPackageFile(packageFileConfig) {
 
 async function renovateDockerfile(packageFileConfig) {
   let upgrades = [];
-  logger = packageFileConfig.logger;
+  ({ logger } = packageFileConfig);
   logger.info(`Processing Dockerfile`);
 
   // Check if config is disabled
diff --git a/lib/workers/package/index.js b/lib/workers/package/index.js
index bedf087580..1aecca9b01 100644
--- a/lib/workers/package/index.js
+++ b/lib/workers/package/index.js
@@ -8,7 +8,7 @@ module.exports = {
 
 // Returns all results for a given dependency config
 async function renovatePackage(config) {
-  const logger = config.logger;
+  const { logger } = config;
   logger.trace(`renovatePackage(${config.depName})`);
   if (config.enabled === false) {
     logger.debug('package is disabled');
diff --git a/lib/workers/package/versions.js b/lib/workers/package/versions.js
index 58a4cf9c82..57e78ee951 100644
--- a/lib/workers/package/versions.js
+++ b/lib/workers/package/versions.js
@@ -18,8 +18,8 @@ function determineUpgrades(npmDep, config) {
   const result = {
     type: 'warning',
   };
-  const currentVersion = config.currentVersion;
-  const versions = npmDep.versions;
+  const { currentVersion } = config;
+  const { versions } = npmDep;
   if (!versions || Object.keys(versions).length === 0) {
     result.message = `No versions returned from registry for this package`;
     logger.warn(result.message);
diff --git a/lib/workers/pr/index.js b/lib/workers/pr/index.js
index 5ab329ea62..082e6edf49 100644
--- a/lib/workers/pr/index.js
+++ b/lib/workers/pr/index.js
@@ -16,9 +16,8 @@ async function ensurePr(prConfig) {
   const { logger } = config;
   logger.trace({ config }, 'ensurePr');
   // If there is a group, it will use the config of the first upgrade in the array
-  const upgrades = config.upgrades;
+  const { branchName, upgrades } = config;
   config.upgrades = [];
-  const branchName = config.branchName;
   const branchStatus = await config.api.getBranchStatus(
     branchName,
     config.requiredStatusChecks
@@ -100,7 +99,7 @@ async function ensurePr(prConfig) {
             commit.shortSha = change.sha.slice(0, 7);
             commit.url = `${logJSON.project.repository}/commit/${change.sha}`;
             if (change.message) {
-              commit.message = change.message.split('\n')[0];
+              [commit.message] = change.message.split('\n');
               if (!config.isGitHub || config.privateRepo === true) {
                 commit.message = commit.message.replace(
                   issueRe,
diff --git a/lib/workers/repository/apis.js b/lib/workers/repository/apis.js
index 44e57c0e87..b4498493b4 100644
--- a/lib/workers/repository/apis.js
+++ b/lib/workers/repository/apis.js
@@ -46,7 +46,7 @@ async function checkMonorepos(input) {
     let workspaces = [];
     for (const packageFile of config.packageFiles) {
       if (packageFile.packageFile === 'package.json') {
-        workspaces = packageFile.content.workspaces;
+        ({ workspaces } = packageFile.content);
       }
     }
     logger.debug({ workspaces }, 'workspaces');
@@ -418,7 +418,7 @@ async function resolvePackageFiles(inputConfig) {
         );
         continue; // eslint-disable-line
       }
-      packageFile.currentFrom = fromMatch[1];
+      [, packageFile.currentFrom] = fromMatch;
       logger.debug('Adding Dockerfile');
     }
 
diff --git a/lib/workers/repository/cleanup.js b/lib/workers/repository/cleanup.js
index f219a5de0b..559aadb7ad 100644
--- a/lib/workers/repository/cleanup.js
+++ b/lib/workers/repository/cleanup.js
@@ -3,7 +3,7 @@ module.exports = {
 };
 
 async function pruneStaleBranches(config, branchList) {
-  const logger = config.logger;
+  const { logger } = config;
   logger.debug('Removing any stale branches');
   logger.trace({ config, branchList }, `pruneStaleBranches`);
   if (config.platform !== 'github') {
diff --git a/package.json b/package.json
index ea5626046f..d52ec8e59c 100644
--- a/package.json
+++ b/package.json
@@ -79,7 +79,7 @@
     "chai": "4.1.2",
     "condition-circle": "1.5.0",
     "eslint": "4.6.1",
-    "eslint-config-airbnb-base": "11.3.2",
+    "eslint-config-airbnb-base": "12.0.0",
     "eslint-config-prettier": "2.4.0",
     "eslint-plugin-import": "2.7.0",
     "eslint-plugin-prettier": "2.2.0",
diff --git a/test/.eslintrc.js b/test/.eslintrc.js
index e0048625ec..b575cb6d3e 100644
--- a/test/.eslintrc.js
+++ b/test/.eslintrc.js
@@ -1,9 +1,10 @@
 module.exports = {
-    'env': {
-      'jest': true,
-    },
-    'rules': {
-      'import/no-extraneous-dependencies': 0,
-      'global-require': 0
-    },
+  env: {
+    jest: true
+  },
+  rules: {
+    "prefer-promise-reject-errors": 0,
+    "import/no-extraneous-dependencies": 0,
+    "global-require": 0
+  }
 };
diff --git a/yarn.lock b/yarn.lock
index 1b58982165..6ee76d95ef 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1402,9 +1402,9 @@ escodegen@^1.6.1:
   optionalDependencies:
     source-map "~0.5.6"
 
-eslint-config-airbnb-base@11.3.2:
-  version "11.3.2"
-  resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.3.2.tgz#8703b11abe3c88ac7ec2b745b7fdf52e00ae680a"
+eslint-config-airbnb-base@12.0.0:
+  version "12.0.0"
+  resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-12.0.0.tgz#99063aaef4b8698083481a00e165cbe15e82d615"
   dependencies:
     eslint-restricted-globals "^0.1.1"
 
-- 
GitLab