We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESLint 可以对你代码进行检查 Prettier 代码格式化工具,能够统一你或者团队的代码风格(酷爱) Pre-commit Hook 在代码进行Git提交的时候进行格式化,如果有错误并终止push
yarn add -D babel-eslint eslint eslint-config-prettier eslint-config-react-app eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-flowtype eslint-plugin-prettier eslint-plugin-react husky lint-staged pretty-quick prettier
.eslintrc
{ "extends": ["react-app", "plugin:prettier/recommended"], "rules": { "no-undef": 0, "no-useless-constructor": 0 } }
具体的rules规则可以根据各自喜好添加
"scripts": { "precommit": "pretty-quick --staged" }
package.json
"prettier": { "singleQuote": true }
你可以执行命令 prettier --write src/**/*.js src对应你的文件夹
prettier --write src/**/*.js
Alt-Shift-Ctrl-P
Preferences | Tools | File Watchers and click + to add a new watcher.
"editor.formatOnSave": true, "javascript.format.enable": false, "prettier.eslintIntegration": true
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ESLint 可以对你代码进行检查
Prettier 代码格式化工具,能够统一你或者团队的代码风格(酷爱)
Pre-commit Hook 在代码进行Git提交的时候进行格式化,如果有错误并终止push
准备开始安装各种包
yarn add -D babel-eslint eslint eslint-config-prettier eslint-config-react-app eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-flowtype eslint-plugin-prettier eslint-plugin-react husky lint-staged pretty-quick prettier
添加
.eslintrc
文件具体的rules规则可以根据各自喜好添加
添加scripts配置命令
在
package.json
中添加Prettier配置根据自己喜好如果你是后面加入的Prettier需要对整个项目.js 文件进行格式化
你可以执行命令
prettier --write src/**/*.js
src对应你的文件夹WebStorm
Alt-Shift-Ctrl-P
具体在设置搜索Prettier可以找到Preferences | Tools | File Watchers and click + to add a new watcher.
然后进行快捷键绑定 传送到官网VSCode
The text was updated successfully, but these errors were encountered: