Skip to content

Commit

Permalink
chore: Use prettier (#173)
Browse files Browse the repository at this point in the history
* build: Add webpack lint settings and style code with eslint --fix

We now use the webpack eslint settings that make
sense in the cli. Also use the new --fix of eslint
to automatically beautify the code

* Add additional .eslintrc to /bin to remove unrelated eslint errors

* build: Add jest-cli as dev dependency

* style: fix lintin errors and coding style according to webpack settings

* build: update dependencies and add package-lock to repo

* feat: Require quotes only in property names that require it

* chore: Add again removed settings by merge conflict solving

* tests: Fix failing test

* chore: Use husky instead of pre-commit

pre-commit package stopped working. See observing/pre-commit#113

husky also requires less boilerplate in the package.json
  • Loading branch information
DanielaValero authored and okonet committed Sep 13, 2017
1 parent eab9337 commit b3186a9
Show file tree
Hide file tree
Showing 94 changed files with 11,357 additions and 2,361 deletions.
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

0 comments on commit b3186a9

Please sign in to comment.