Skip to content
Snippets Groups Projects
Commit 2039c6f3 authored by Éloïs's avatar Éloïs
Browse files

[style] add Husky to automatically lint and format things with Prettier

parent fac23701
No related branches found
No related tags found
No related merge requests found
{ {
"parserOptions": { "parserOptions": {
"ecmaVersion": 8 "ecmaVersion": 8,
"sourceType": "module"
}, },
"plugins": [ "plugins": [
"mocha" "mocha"
...@@ -58,4 +59,4 @@ ...@@ -58,4 +59,4 @@
"describe": true, "describe": true,
"it": true "it": true
} }
} }
\ No newline at end of file
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
"test": "nyc --reporter html mocha", "test": "nyc --reporter html mocha",
"start": "node bin/duniter start", "start": "node bin/duniter start",
"build": "tsc && cd \"node_modules/duniter-ui\" && npm install && npm run build", "build": "tsc && cd \"node_modules/duniter-ui\" && npm install && npm run build",
"lint": "lint-staged",
"prettier": "prettier --write app/**/*/*.ts",
"reformat": "eslint --cache --fix app/**/*/*.ts",
"format:check": "prettier --list-different \"app/**/*.{ts,json}\"",
"format:all": "prettier --write \"app/**/*.{ts,json}\"",
"test-travis": "nyc --reporter lcovonly mocha test/" "test-travis": "nyc --reporter lcovonly mocha test/"
}, },
"nyc": { "nyc": {
...@@ -89,6 +94,7 @@ ...@@ -89,6 +94,7 @@
"node-pre-gyp": "0.6.34", "node-pre-gyp": "0.6.34",
"node-uuid": "1.4.8", "node-uuid": "1.4.8",
"optimist": "0.6.1", "optimist": "0.6.1",
"prettier": "^2.0.4",
"q-io": "^1.13.5", "q-io": "^1.13.5",
"querablep": "^0.1.0", "querablep": "^0.1.0",
"request": "2.81.0", "request": "2.81.0",
...@@ -115,6 +121,8 @@ ...@@ -115,6 +121,8 @@
"coveralls": "2.11.4", "coveralls": "2.11.4",
"eslint": "4.18.2", "eslint": "4.18.2",
"eslint-plugin-mocha": "4.8.0", "eslint-plugin-mocha": "4.8.0",
"husky": ">=4",
"lint-staged": ">=10",
"mocha": "^3.4.2", "mocha": "^3.4.2",
"mocha-eslint": "0.1.7", "mocha-eslint": "0.1.7",
"nyc": "^11.0.3", "nyc": "^11.0.3",
...@@ -129,5 +137,15 @@ ...@@ -129,5 +137,15 @@
"peerDependencies": {}, "peerDependencies": {},
"bin": { "bin": {
"duniter": "./bin/duniter" "duniter": "./bin/duniter"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"app/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [
"prettier --write"
]
} }
} }
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment