1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-02 11:30:22 +02:00

add package.json & prettier to commit flow!

This commit is contained in:
Kushagra Gour
2017-07-03 08:45:32 +05:30
parent 5c25d51235
commit 95585c6274
3 changed files with 259 additions and 267 deletions

View File

@@ -6,42 +6,27 @@
"extends": "eslint:recommended",
"rules": {
"accessor-pairs": "error",
"array-bracket-spacing": "off",
"array-callback-return": "error",
"arrow-body-style": "off",
"arrow-parens": "error",
"arrow-spacing": "error",
"block-scoped-var": "error",
"block-spacing": [
"error",
"always"
],
"brace-style": "off",
"callback-return": "error",
"camelcase": "error",
"comma-spacing": "off",
"comma-style": "off",
"complexity": "error",
"computed-property-spacing": [
"error",
"never"
],
"computed-property-spacing": ["error", "never"],
"consistent-return": "error",
"consistent-this": "off",
"curly": "error",
"default-case": "error",
"dot-location": [
"error",
"property"
],
"dot-location": ["error", "property"],
"dot-notation": "error",
"eol-last": "off",
"eqeqeq": "error",
"func-names": "off",
"func-style": [
"error",
"declaration"
],
"func-style": ["error", "declaration"],
"generator-star-spacing": "error",
"global-require": "error",
"guard-for-in": "error",
@@ -52,22 +37,7 @@
"indent": ["error", "tab"],
"init-declarations": "off",
"jsx-quotes": "error",
"key-spacing": [
"error",
{ "afterColon": true }
],
"keyword-spacing": [
"error",
{
"after": true,
"before": true
}
],
"linebreak-style": [
"error",
"unix"
],
"lines-around-comment": "error",
"max-depth": "error",
"max-len": "off",
"max-nested-callbacks": "error",
@@ -101,10 +71,7 @@
"no-implicit-globals": "off",
"no-implied-eval": "error",
"no-inline-comments": "off",
"no-inner-declarations": [
"error",
"functions"
],
"no-inner-declarations": ["error", "functions"],
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
@@ -172,22 +139,13 @@
"no-warning-comments": "off",
"no-whitespace-before-property": "error",
"no-with": "error",
"object-curly-spacing": [
"error",
"always"
],
"object-curly-spacing": ["error", "always"],
"object-property-newline": "off",
"object-shorthand": "off",
"one-var": "off",
"one-var-declaration-per-line": "error",
"operator-assignment": [
"error",
"always"
],
"operator-linebreak": [
"error",
"before"
],
"operator-assignment": ["error", "always"],
"padded-blocks": "off",
"prefer-arrow-callback": "off",
"prefer-const": "error",
@@ -212,33 +170,18 @@
"sort-vars": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-in-parens": [
"error",
"never"
],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": [
"error",
"always"
],
"strict": [
"error",
"never"
],
"spaced-comment": ["error", "always"],
"strict": ["error", "never"],
"template-curly-spacing": "error",
"unicode-bom": [
"error",
"never"
],
"unicode-bom": ["error", "never"],
"valid-jsdoc": "off",
"vars-on-top": "off",
"wrap-regex": "error",
"yield-star-spacing": "error",
"yoda": [
"error",
"never"
]
"yoda": ["error", "never"]
},
"globals": {
"ArrayBuffer": true,

23
git-hooks/pre-commit Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
# RUN PRETTIER
jsjsonfiles=$(git diff --staged --name-only | grep ".*\.\(js\|json\)")
echo "$jsjsonfiles" | xargs ./node_modules/.bin/prettier --single-quote --use-tabs --write
echo "$jsjsonfiles" | xargs git add
# Fetch .js or .json filed from staged files
jsfiles=$(git diff --staged --name-only --diff-filter=ACM | grep '\.js$')
[ -z "$jsfiles" ] && exit 0
# ESLINT CHECK
eslintresult=$(./node_modules/.bin/eslint --color $jsfiles)
if [[ $eslintresult != "" ]]; then
echo "$eslintresult"
exit 1 # reject
fi
echo "\033[32m✔ ESlint passed\033[0m"
exit 0

26
package.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "web-maker",
"version": "2.7.2",
"description": "A blazing fast & offline web playground",
"main": "index.html",
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.1.1",
"eslint-config-prettier": "^2.3.0",
"prettier": "^1.5.2"
},
"scripts": {
"install": "ln -s ../../git-hooks/pre-commit .git/hooks/pre-commit"
},
"repository": {
"type": "git",
"url": "git+https://github.com/chinchang/web-maker.git"
},
"keywords": ["frontend", "playground", "web", "editor"],
"author": "Kushagra Gour",
"license": "MIT",
"bugs": {
"url": "https://github.com/chinchang/web-maker/issues"
},
"homepage": "https://github.com/chinchang/web-maker#readme"
}