Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/prettify and lint #173

Merged
merged 10 commits into from
Sep 13, 2017
73 changes: 73 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
module.exports = {
"root": true,
"plugins": ["node"],
"extends": ["eslint:recommended", "plugin:node/recommended"],
"env": {
"node": true,
"es6": true,
"jest": true
},
"parserOptions": { "ecmaVersion": 2017 },
"rules": {
"quote-props": ["error", "as-needed"],
"no-dupe-keys": "error",
"quotes": ["error", "double"],
"no-undef": "error",
"no-extra-semi": "error",
"semi": "error",
"no-template-curly-in-string": "error",
"no-caller": "error",
"yoda": "error",
"eqeqeq": "error",
"global-require": "off",
"brace-style": "error",
"key-spacing": "error",
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"indent": ["error", "tab", { "SwitchCase": 1 }],
"no-extra-bind": "warn",
"no-empty": "off",
"no-multiple-empty-lines": "error",
"no-multi-spaces": "error",
"no-process-exit": "off",
"no-trailing-spaces": "error",
"no-use-before-define": "off",
"no-unused-vars": ["error", { "args": "none" }],
"no-unsafe-negation": "error",
"no-loop-func": "warn",
"space-before-function-paren": ["error", "never"],
"space-before-blocks": "error",
"object-curly-spacing": ["error", "always"],
"object-curly-newline": ["error", { "consistent": true }],
"keyword-spacing": ["error", {
"after": true,
"overrides": {
"const": { "after": true },
"try": { "after": true },
"throw": { "after": true },
"case": { "after": true },
"return": { "after": true },
"finally": { "after": true },
"do": { "after": true }
}
}],
"no-console": "off",
"valid-jsdoc": "error",
"node/no-unsupported-features": ["error", { "version": 4 }],
"node/no-deprecated-api": "error",
"node/no-missing-import": "error",
"node/no-missing-require": [
"error",
{
"allowModules": [
"webpack"
]
}
],
"node/no-unpublished-bin": "error",
"node/no-unpublished-require": "error",
"eol-last": ["error", "always"],
"newline-per-chained-call": "off",
"node/process-exit-as-throw": "error"
}
};
55 changes: 0 additions & 55 deletions .eslintrc.json

This file was deleted.

25 changes: 0 additions & 25 deletions .jsbeautifyrc

This file was deleted.

10 changes: 6 additions & 4 deletions __mocks__/creator/validate-options.mock.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
const fs = require('fs');
const path = require('path');
"use strict";

const fs = require("fs");
const path = require("path");

function getPath(part) {
return path.join(process.cwd(), part);
}

function validateOptions(opts) {
return Object.keys(opts).forEach( (location) => {
return Object.keys(opts).forEach(location => {
let part = getPath(opts[location]);
try {
fs.readFileSync(part);
} catch (err) {
throw new Error('Did not find the file');
throw new Error("Did not find the file");
}
});
}
Expand Down
27 changes: 17 additions & 10 deletions __mocks__/inquirer/resolve.mock.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
'use strict';
const path = require('path');
"use strict";

const path = require("path");

function mockPromise(value) {
return (value || {}).then ? value : {
then: function (callback) {
const isValueAPromise = (value || {}).then;
const mockedPromise = {
then: function(callback) {
return mockPromise(callback(value));
}
};

return isValueAPromise ? value : mockedPromise;
}
function spawnChild(pkg) {
return pkg;
}

function getLoc(option) {
let packageModule = [];
option.filter( (pkg) => {
mockPromise(spawnChild(pkg)).then( () => {
option.filter(pkg => {
mockPromise(spawnChild(pkg)).then(() => {
try {
let loc = path.join('..', '..', 'node_modules', pkg);
let loc = path.join("..", "..", "node_modules", pkg);
packageModule.push(loc);
} catch(err) {
throw new Error('Package wasn\'t validated correctly..' +
'Submit an issue for', pkg, 'if this persists');
} catch (err) {
throw new Error(
"Package wasn't validated correctly.." + "Submit an issue for",
pkg,
"if this persists"
);
}
});
return packageModule;
Expand Down
5 changes: 5 additions & 0 deletions bin/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"node/no-missing-require": 0
}
}
Loading