Skip to content

Commit 82e06e6

Browse files
committedApr 3, 2022
Add husky and lint-stage
1 parent 159418e commit 82e06e6

File tree

5 files changed

+377
-16
lines changed

5 files changed

+377
-16
lines changed
 

‎.eslintrc.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ module.exports = {
33
browser: true,
44
es2021: true,
55
},
6-
extends: [
7-
'plugin:vue/essential',
8-
'airbnb-base',
9-
'prettier',
10-
],
6+
extends: ['plugin:vue/essential', 'airbnb-base', 'prettier'],
117
parserOptions: {
128
ecmaVersion: 'latest',
139
sourceType: 'module',
1410
},
15-
plugins: [
16-
'vue',
17-
],
18-
rules: {
19-
},
11+
plugins: ['vue'],
12+
rules: {},
2013
};

‎.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

‎.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
[ -n "$CI" ] && exit 0
3+
. "$(dirname "$0")/_/husky.sh"
4+
5+
npm run lint-staged

‎package.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
{
22
"scripts": {
33
"lint": "eslint 'app/javascript/**/*.{js,vue}' --fix",
4-
"format": "prettier ./**/*.{js,css,scss,md,vue,json} --write"
4+
"format": "prettier ./**/*.{js,css,scss,md,vue,json} --write",
5+
"prepare": "husky install",
6+
"lint-staged": "lint-staged"
57
},
68
"devDependencies": {
79
"eslint": "^8.12.0",
810
"eslint-config-airbnb-base": "^15.0.0",
911
"eslint-config-prettier": "^8.5.0",
1012
"eslint-plugin-import": "^2.25.4",
1113
"eslint-plugin-vue": "^8.5.0",
14+
"husky": "^7.0.4",
15+
"lint-staged": "^12.3.7",
1216
"prettier": "^2.6.2",
1317
"vite": "^2.8.6",
1418
"vite-plugin-ruby": "^3.0.8"
19+
},
20+
"lint-staged": {
21+
"*.{js,vue}": [
22+
"eslint --fix"
23+
],
24+
"*.{js,css,scss,md,vue,json}": "prettier --write"
1525
}
1626
}

‎yarn.lock

+357-5
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.