add pre commit hook for auto js linting

This commit is contained in:
Felix Hamann 2019-05-25 18:36:31 +02:00
parent 3aa081131f
commit 02b0bf3aef
4 changed files with 1880 additions and 15 deletions

View File

@ -1,3 +1,4 @@
{
"presets": ["@babel/preset-env"]
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}

27
.eslintrc.json Normal file
View File

@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"HttpClient": "readonly",
"UtilRegistry": "readonly",
"HtmlHelpers": "readonly",
"I18n": "readonly",
"flatpickr": "readonly",
"$": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-console": "off",
"no-extra-semi": "off",
"semi": ["error", "always"],
"comma-dangle": ["error", "always-multiline"]
}
}

1836
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,17 +2,34 @@
"name": "uni2work",
"version": "1.0.0",
"description": "",
"scripts": {
"watch": "watch babel static/es",
"babel": "babel static/es -d static/js"
},
"keywords": [],
"author": "",
"license": "ISC",
"scripts": {
"babel": "babel static/es -d static/js",
"babel:watch": "watch 'npm run babel' static/es",
"lint": "eslint static/es"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"static/es/**/*.js": [
"eslint",
"git add"
]
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"watch": "^1.0.2",
"@babel/preset-env": "^7.4.5"
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"husky": "^2.3.0",
"lint-staged": "^8.1.7",
"watch": "^1.0.2"
}
}