Skip to content

Commit

Permalink
fix(cubejs-cli): linter (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilev-alex authored Jun 10, 2020
1 parent f6e366c commit 53c053f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
18 changes: 9 additions & 9 deletions packages/cubejs-cli/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Config {
async loadConfig() {
const { configFile } = this.configFile();
if (await fs.exists(configFile)) {
return await fs.readJson(configFile);
return fs.readJson(configFile);
}
return {};
}
Expand All @@ -22,7 +22,7 @@ class Config {

configFile() {
const cubeCloudConfigPath = this.cubeCloudConfigPath();
const configFile = path.join(cubeCloudConfigPath, `config.json`);
const configFile = path.join(cubeCloudConfigPath, 'config.json');
return { cubeCloudConfigPath, configFile };
}

Expand All @@ -34,10 +34,10 @@ class Config {
if (process.env.CUBE_CLOUD_DEPLOY_AUTH) {
const payload = jwt.decode(process.env.CUBE_CLOUD_DEPLOY_AUTH);
if (!payload.url) {
throw new Error(`Malformed token in CUBE_CLOUD_DEPLOY_AUTH`);
throw new Error('Malformed token in CUBE_CLOUD_DEPLOY_AUTH');
}
if (url && payload.url !== url) {
throw new Error(`CUBE_CLOUD_DEPLOY_AUTH token doesn't match url in .cubecloud`);
throw new Error('CUBE_CLOUD_DEPLOY_AUTH token doesn\'t match url in .cubecloud');
}
return {
[payload.url]: {
Expand All @@ -64,7 +64,7 @@ class Config {
}
const payload = jwt.decode(authToken);
if (!payload || !payload.url) {
throw `Malformed Cube Cloud token`;
throw new Error('Malformed Cube Cloud token');
}
config.auth = config.auth || {};
config.auth[payload.url] = {
Expand All @@ -85,7 +85,7 @@ class Config {
...deployAuth[dotCubeCloud.url],
url: dotCubeCloud.url,
deploymentId: dotCubeCloud.deploymentId
}
};
}
const auth = await this.deployAuth();
let url = Object.keys(auth)[0];
Expand All @@ -99,7 +99,7 @@ class Config {
}
const authToken = auth[url];
const deployments = await this.cloudReq({
url: () => `build/deploy/deployments`,
url: () => 'build/deploy/deployments',
method: 'GET',
auth: { ...authToken, url }
});
Expand All @@ -118,7 +118,7 @@ class Config {
...authToken,
url,
deploymentId
}
};
}

async loadDeployAuth() {
Expand All @@ -131,7 +131,7 @@ class Config {

async loadDotCubeCloud() {
if (await fs.exists(this.dotCubeCloudFile())) {
return await fs.readJson(this.dotCubeCloudFile());
return fs.readJson(this.dotCubeCloudFile());
}
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-cli/cubejsCli.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ program
.command('authenticate <token>')
.description('Authenticate access to Cube Cloud')
.action(
(token) => new Config().addAuthToken(token)
(currentToken) => new Config().addAuthToken(currentToken)
.catch(e => displayError(e.stack || e))
)
.on('--help', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/cubejs-cli/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const rp = require('request-promise');
const jwt = require('jsonwebtoken');
const fs = require('fs-extra');
const path = require('path');
const cliProgress = require('cli-progress');
Expand Down

0 comments on commit 53c053f

Please sign in to comment.