Skip to content

Commit 7304d87

Browse files
committed
Feature(lint): add github hook for linting before commit
1 parent 467e33a commit 7304d87

File tree

5 files changed

+579
-331
lines changed

5 files changed

+579
-331
lines changed

.eslintrc.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
module.exports = {
22
root: true,
3-
43
env: {
54
browser: true,
65
node: true,
76
es6: true
87
},
9-
108
parserOptions: {
119
parser: '@typescript-eslint/parser',
1210
sourceType: 'module'
1311
},
14-
1512
plugins: [
1613
'vue'
1714
],
18-
1915
rules: {
2016
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
2117
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
@@ -32,7 +28,6 @@ module.exports = {
3228
'vue/match-component-file-name': 'error',
3329
'vue/object-curly-spacing': 'error'
3430
},
35-
3631
'extends': [
3732
'eslint:recommended',
3833
'plugin:vue/recommended',

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,37 @@ yarn install
3434
### Compiles and hot-reloads for development
3535

3636
```bash
37-
yarn serve
37+
yarn run serve
3838
```
3939

4040
### Compiles and minifies for production
4141

4242
```bash
43-
yarn build
43+
yarn run build
4444
```
4545

4646
### Lints and fixes files
4747

4848
```bash
49-
yarn lint
49+
yarn run lint
5050
```
5151

5252
### Run your unit tests
5353

5454
```bash
55-
yarn test:unit
55+
yarn run test:unit
5656
```
5757

5858
### Run your end-to-end tests
5959

6060
```bash
61-
yarn test:e2e
61+
yarn run test:e2e
6262
```
6363

6464
### Generate all svg components
6565

6666
```bash
67-
yarn svg
68-
# Note: need to run "yarn global add vue-svgicon" first
67+
yarn run svg
6968
```
7069

7170
### Customize Vue configuration

package.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@types/clipboard": "^2.0.1",
1515
"axios": "^0.18.0",
1616
"clipboard": "^2.0.4",
17-
"element-ui": "^2.7.0",
17+
"element-ui": "^2.7.2",
1818
"js-cookie": "^2.2.0",
1919
"mockjs": "^1.0.1-beta3",
2020
"normalize.css": "^8.0.1",
@@ -53,13 +53,23 @@
5353
"eslint": "^5.16.0",
5454
"eslint-plugin-vue": "^5.2.2",
5555
"fibers": "^3.1.1",
56-
"jest": "^24.6.0",
57-
"sass": "^1.17.3",
56+
"jest": "^24.7.1",
57+
"lint-staged": "^8.1.5",
58+
"sass": "^1.17.4",
5859
"sass-loader": "^7.1.0",
5960
"ts-jest": "^24.0.1",
6061
"typescript": "3.4.1",
6162
"vue-cli-plugin-element": "^1.0.1",
6263
"vue-template-compiler": "^2.6.10",
6364
"webpack": "^4.29.6"
65+
},
66+
"gitHooks": {
67+
"pre-commit": "lint-staged"
68+
},
69+
"lint-staged": {
70+
"*.{js,vue}": [
71+
"vue-cli-service lint",
72+
"git add"
73+
]
6474
}
6575
}

vue.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
module.exports = {
22
publicPath: process.env.NODE_ENV === 'production' ? '/vue-typescript-admin-template/' : '/',
3-
43
pwa: {
54
name: 'vue-typescript-admin-template'
65
},
7-
86
lintOnSave: process.env.NODE_ENV !== 'production'
97
}

0 commit comments

Comments
 (0)