Skip to content

Commit edf8786

Browse files
author
Manny Henri
committed
lint fixes for travis tests
1 parent 559afa1 commit edf8786

11 files changed

+29
-22
lines changed

package.json

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
"prefer-template": 2,
4848
"no-use-before-define": 0,
4949
"newline-per-chained-call": 0,
50+
"import/no-dynamic-require": 0,
51+
"prefer-destructuring": ["error", {
52+
"array": false,
53+
"object": true
54+
}, {
55+
"enforceForRenamedProperties": false
56+
}],
5057
"arrow-body-style": [
5158
2,
5259
"as-needed"

src/commands/generate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ program
1212
* Generate string output for a single blueprint
1313
* @param blueprint
1414
*/
15-
const printBlueprint = blueprint => {
15+
const printBlueprint = (blueprint) => {
1616
console.log(` ${chalk.yellow(blueprint.name)} - ${blueprint.description}`);
1717
console.log(` Usage: ${blueprint.usage}`);
1818
console.log('');
1919
};
2020

2121
program.on('--help', () => {
2222
// Get available blueprints from the current mern project
23-
const blueprints = getMernConfig().blueprints;
23+
const { blueprints } = getMernConfig().blueprints;
2424
console.log(chalk.yellow('Available Generators'));
2525
console.log(chalk.yellow('____________________'));
2626
console.log('');

src/commands/main-init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chalk from 'chalk';
33
import elegantSpinner from 'elegant-spinner';
44
import logUpdate from 'log-update';
55
import variants from '../../variants.json';
6+
67
require('shelljs/global');
78

89
const frame = elegantSpinner();
@@ -58,4 +59,3 @@ exec(`git pull ${selectedVariant.git} ${selectedVariant['git-branch']}`, (code)
5859
exec('npm install');
5960
console.log(chalk.green.bold(`Installing dependencies for ${program.args[0]} completed.....You are good to go!`));
6061
});
61-

src/commands/main-list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const variantsTable = new Table({
1111
});
1212

1313
// Make a variants table to show to all the variants
14-
variantsTable.push(...variants.map(v => Object.keys(v).map((k) => v[k]).slice(0, 3)));
14+
variantsTable.push(...variants.map(v => Object.keys(v).map(k => v[k]).slice(0, 3)));
1515

1616
console.log(chalk.yellow('MERN Variants'));
1717
console.log(chalk.yellow('-------------'));

src/commands/main-search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const variantsTable = new Table({
2222
const filteredVariants = variants.filter(variant => variant.name.toLowerCase().search(input.toLowerCase()) !== -1 || variant.description.toLowerCase().search(input.toLowerCase()) !== -1);
2323

2424
// Make a variants table to show to all the variants matched with the given search string
25-
variantsTable.push(...filteredVariants.map(v => Object.keys(v).map((k) => v[k]).slice(0, 3)));
25+
variantsTable.push(...filteredVariants.map(v => Object.keys(v).map(k => v[k]).slice(0, 3)));
2626

2727
console.log(chalk.yellow(`Search results for ${input}`));
2828
console.log(chalk.yellow('-------------'));

src/tasks/generate.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class generate {
1616
* Process the given arguments to render the target path and the target boilerplate
1717
* @param args
1818
*/
19-
processArgs = args => {
19+
processArgs = (args) => {
2020
if (args.length < 2) {
2121
this.ui.writeError('Please pass relevant number of arguments');
2222
process.exit(1);
@@ -53,8 +53,8 @@ class generate {
5353
* Write the generated string to the target path
5454
* @param target
5555
*/
56-
writeTarget = target => {
57-
writeFile(`${process.cwd()}/${target['target-path']}`, target.renderedTemplate, err => {
56+
writeTarget = (target) => {
57+
writeFile(`${process.cwd()}/${target['target-path']}`, target.renderedTemplate, (err) => {
5858
if (err) {
5959
this.ui.writeError(err);
6060
exit(1);

src/tasks/getMernConfig.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import chalk from 'chalk';
55
* @param config
66
* @returns {boolean}
77
*/
8-
const validateMernConfig = config => {
8+
const validateMernConfig = (config) => {
99
let valid = true;
1010
const requiredKeys = ['blueprints'];
1111
const requiredBlueprintKeys = ['name', 'description', 'usage', 'files'];
@@ -15,17 +15,15 @@ const validateMernConfig = config => {
1515
return false;
1616
}
1717

18-
config.blueprints.forEach(b => {
18+
config.blueprints.forEach((b) => {
1919
if (!requiredBlueprintKeys.every(c => c in b)) {
2020
valid = false;
21-
} else {
22-
if (b.files) {
23-
b.files.forEach(file => {
24-
if (!requiredFileKeys.every(c => c in file)) {
25-
valid = false;
26-
}
27-
});
28-
}
21+
} else if (b.files) {
22+
b.files.forEach((file) => {
23+
if (!requiredFileKeys.every(c => c in file)) {
24+
valid = false;
25+
}
26+
});
2927
}
3028
});
3129

src/tasks/renderTargetPath.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ejs from 'ejs';
22
import helpers from '../util/ejsHelpers';
3+
34
require('shelljs/global');
45

56
/**

src/util/fileExists.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import fs from 'fs';
55
* @param path
66
* @returns {boolean}
77
*/
8-
export default path => {
8+
export default (path) => {
99
try {
1010
fs.accessSync(path, fs.F_OK);
1111
return true;

src/util/ui.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import chalk from 'chalk';
2-
const DEFAULT_WRITE_LEVEL = 'INFO';
32
import { EOL } from 'os';
43

4+
const DEFAULT_WRITE_LEVEL = 'INFO';
5+
56
/**
67
* Helper class to write debug output to console
78
*/

tests/main-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import pify from 'pify';
55
const exec = pify(childProcess.exec);
66

77

8-
test('shows help on --help', async t => {
8+
test('shows help on --help', async (t) => {
99
const stdout = await exec('../bin/mern.js --help');
1010
t.is(stdout.trim(), `Usage: mern [options] [command]
1111
@@ -28,7 +28,7 @@ test('shows help on --help', async t => {
2828
});
2929

3030

31-
test('shows help on --h', async t => {
31+
test('shows help on --h', async (t) => {
3232
const stdout = await exec('../bin/mern.js --help');
3333
t.is(stdout.trim(), `Usage: mern [options] [command]
3434

0 commit comments

Comments
 (0)