mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-02 19:37:29 +02:00
add package.json & prettier to commit flow!
This commit is contained in:
@@ -6,42 +6,27 @@
|
|||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"rules": {
|
"rules": {
|
||||||
"accessor-pairs": "error",
|
"accessor-pairs": "error",
|
||||||
"array-bracket-spacing": "off",
|
|
||||||
"array-callback-return": "error",
|
"array-callback-return": "error",
|
||||||
"arrow-body-style": "off",
|
|
||||||
"arrow-parens": "error",
|
|
||||||
"arrow-spacing": "error",
|
|
||||||
"block-scoped-var": "error",
|
"block-scoped-var": "error",
|
||||||
"block-spacing": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"brace-style": "off",
|
|
||||||
"callback-return": "error",
|
"callback-return": "error",
|
||||||
"camelcase": "error",
|
"camelcase": "error",
|
||||||
"comma-spacing": "off",
|
"comma-spacing": "off",
|
||||||
"comma-style": "off",
|
"comma-style": "off",
|
||||||
"complexity": "error",
|
"complexity": "error",
|
||||||
"computed-property-spacing": [
|
"computed-property-spacing": ["error", "never"],
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"consistent-return": "error",
|
"consistent-return": "error",
|
||||||
"consistent-this": "off",
|
"consistent-this": "off",
|
||||||
"curly": "error",
|
"curly": "error",
|
||||||
"default-case": "error",
|
"default-case": "error",
|
||||||
"dot-location": [
|
"dot-location": ["error", "property"],
|
||||||
"error",
|
|
||||||
"property"
|
|
||||||
],
|
|
||||||
"dot-notation": "error",
|
"dot-notation": "error",
|
||||||
"eol-last": "off",
|
"eol-last": "off",
|
||||||
"eqeqeq": "error",
|
"eqeqeq": "error",
|
||||||
"func-names": "off",
|
"func-names": "off",
|
||||||
"func-style": [
|
"func-style": ["error", "declaration"],
|
||||||
"error",
|
|
||||||
"declaration"
|
|
||||||
],
|
|
||||||
"generator-star-spacing": "error",
|
"generator-star-spacing": "error",
|
||||||
"global-require": "error",
|
"global-require": "error",
|
||||||
"guard-for-in": "error",
|
"guard-for-in": "error",
|
||||||
@@ -49,25 +34,10 @@
|
|||||||
"id-blacklist": "error",
|
"id-blacklist": "error",
|
||||||
"id-length": "off",
|
"id-length": "off",
|
||||||
"id-match": "error",
|
"id-match": "error",
|
||||||
"indent": [ "error", "tab" ],
|
"indent": ["error", "tab"],
|
||||||
"init-declarations": "off",
|
"init-declarations": "off",
|
||||||
"jsx-quotes": "error",
|
"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-depth": "error",
|
||||||
"max-len": "off",
|
"max-len": "off",
|
||||||
"max-nested-callbacks": "error",
|
"max-nested-callbacks": "error",
|
||||||
@@ -101,10 +71,7 @@
|
|||||||
"no-implicit-globals": "off",
|
"no-implicit-globals": "off",
|
||||||
"no-implied-eval": "error",
|
"no-implied-eval": "error",
|
||||||
"no-inline-comments": "off",
|
"no-inline-comments": "off",
|
||||||
"no-inner-declarations": [
|
"no-inner-declarations": ["error", "functions"],
|
||||||
"error",
|
|
||||||
"functions"
|
|
||||||
],
|
|
||||||
"no-invalid-this": "error",
|
"no-invalid-this": "error",
|
||||||
"no-iterator": "error",
|
"no-iterator": "error",
|
||||||
"no-label-var": "error",
|
"no-label-var": "error",
|
||||||
@@ -172,22 +139,13 @@
|
|||||||
"no-warning-comments": "off",
|
"no-warning-comments": "off",
|
||||||
"no-whitespace-before-property": "error",
|
"no-whitespace-before-property": "error",
|
||||||
"no-with": "error",
|
"no-with": "error",
|
||||||
"object-curly-spacing": [
|
"object-curly-spacing": ["error", "always"],
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"object-property-newline": "off",
|
"object-property-newline": "off",
|
||||||
"object-shorthand": "off",
|
"object-shorthand": "off",
|
||||||
"one-var": "off",
|
"one-var": "off",
|
||||||
"one-var-declaration-per-line": "error",
|
"one-var-declaration-per-line": "error",
|
||||||
"operator-assignment": [
|
"operator-assignment": ["error", "always"],
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"operator-linebreak": [
|
|
||||||
"error",
|
|
||||||
"before"
|
|
||||||
],
|
|
||||||
"padded-blocks": "off",
|
"padded-blocks": "off",
|
||||||
"prefer-arrow-callback": "off",
|
"prefer-arrow-callback": "off",
|
||||||
"prefer-const": "error",
|
"prefer-const": "error",
|
||||||
@@ -212,33 +170,18 @@
|
|||||||
"sort-vars": "off",
|
"sort-vars": "off",
|
||||||
"space-before-blocks": "off",
|
"space-before-blocks": "off",
|
||||||
"space-before-function-paren": "off",
|
"space-before-function-paren": "off",
|
||||||
"space-in-parens": [
|
"space-in-parens": ["error", "never"],
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"space-infix-ops": "error",
|
"space-infix-ops": "error",
|
||||||
"space-unary-ops": "error",
|
"space-unary-ops": "error",
|
||||||
"spaced-comment": [
|
"spaced-comment": ["error", "always"],
|
||||||
"error",
|
"strict": ["error", "never"],
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"strict": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"template-curly-spacing": "error",
|
"template-curly-spacing": "error",
|
||||||
"unicode-bom": [
|
"unicode-bom": ["error", "never"],
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"valid-jsdoc": "off",
|
"valid-jsdoc": "off",
|
||||||
"vars-on-top": "off",
|
"vars-on-top": "off",
|
||||||
"wrap-regex": "error",
|
"wrap-regex": "error",
|
||||||
"yield-star-spacing": "error",
|
"yield-star-spacing": "error",
|
||||||
"yoda": [
|
"yoda": ["error", "never"]
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"ArrayBuffer": true,
|
"ArrayBuffer": true,
|
||||||
|
23
git-hooks/pre-commit
Executable file
23
git-hooks/pre-commit
Executable 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
26
package.json
Normal 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"
|
||||||
|
}
|
Reference in New Issue
Block a user