Skip to content

Commit ff22ac8

Browse files
committed
调整pre-commit
1 parent 2ccdb05 commit ff22ac8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = {
1414
"react/no-array-index-key": "off",
1515
"react/jsx-props-no-spreading": "off",
1616
"no-console": "off",
17+
semi: ["error", "always"],
1718
quotes: ["error", "single"],
1819
},
1920
env: {

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
44

55
In the project directory, you can run:
66

7-
87
### `npm install`
98

109
安装依赖
1110

1211
### `npm start`
1312

14-
启动项目(http://localhost:3000) .<br>
13+
启动项目(<http://localhost:3000>) .<br>
1514

15+
### tip
1616

17+
该项目解决 eslint 和 prettier 的方式为,vscode 自动保存时使用 eslint 规则,然后在 pre-commit 里先走 prettier 的规则,再走 eslint --fix。
18+
考虑的点在于:如果在自动保存的时候,同时启用两个规则,有些规则会导致冲突。eslint 主要是为了处理某些 js 规范,prettier 是为了代码简洁,美观。如果先走 eslint 再走 prettier,会导致某些冲突。反之则不会,对于开发来讲 eslint 的优先级是大于 prettier 的

0 commit comments

Comments
 (0)