Skip to content

Commit b86e461

Browse files
committed
💅 Linter happiness
1 parent 05a380b commit b86e461

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": ["airbnb-base", "plugin:node/recommended"],
33
"rules": {
44
"no-console": off,
5+
"comma-dangle": [error, always-multiline, {functions: never}]
56
}
67
}

src/auth/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const utils = require('../utils');
1111
*/
1212
function getToken(user = undefined, jsonPath = '') {
1313
let auth = {};
14+
let ghData;
1415
const authPath = jsonPath || settings.authPath;
1516
const authFile = utils.resolvePath(authPath);
1617

@@ -20,12 +21,14 @@ function getToken(user = undefined, jsonPath = '') {
2021
throw error;
2122
}
2223

23-
let { token } = auth.github[0];
24-
2524
if (user) {
26-
token = auth.github.filter(obj => obj.user === user)[0].token;
25+
[ghData] = auth.github.filter(obj => obj.user === user);
26+
} else {
27+
[ghData] = auth.github;
2728
}
2829

30+
const { token } = ghData;
31+
2932
if (!token) {
3033
throw new Error('Token missing');
3134
}

src/utils/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function normalizeName(filepath) {
4545
*/
4646
function copyDirRecursive(currentPath = './', destPath = '../new') {
4747
let dest = resolvePath(destPath);
48-
let current = resolvePath(currentPath);
48+
const current = resolvePath(currentPath);
4949

5050
// Create the dest folder
5151
if (!fs.existsSync(dest)) {
@@ -54,7 +54,8 @@ function copyDirRecursive(currentPath = './', destPath = '../new') {
5454
}
5555

5656
// Read files in folder
57-
let files = fs.readdirSync(current);
57+
const files = fs.readdirSync(current);
58+
5859
for(file of files) {
5960
src = resolvePath(path.join(current, file));
6061
dest = resolvePath(path.join(destPath, file));
@@ -72,6 +73,7 @@ function copyDirRecursive(currentPath = './', destPath = '../new') {
7273

7374
function deleteDirRecursive(folderPath) {
7475
const dirPath = resolvePath(folderPath);
76+
7577
if (fs.existsSync(dirPath)) {
7678
fs.readdirSync(dirPath).forEach((file) => {
7779
const curPath = resolvePath(path.join(dirPath, file));

0 commit comments

Comments
 (0)