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
不建议全局安装
npm i -D eslint
执行 eslint --init
eslint --init
? How would you like to configure ESLint? Answer questions about your style
Use a popular style guide Inspect your JavaScript file(s)
然后选择风格
? Which style guide do you want to follow? (Use arrow keys) Google
Airbnb Standard
? What format do you want your config file to be in? (Use arrow keys)
JavaScript YAML JSON
这里我们使用 airbnb 的。
airbnb
npm install babel-eslint eslint-plugin-flowtype --save-dev
.eslintrc.json 中增加rule,如
.eslintrc.json
"rules": { "linebreak-style": 0 }
更多规则参考 这里
{ "extends": [ "plugin:flowtype/recommended", "airbnb-base" ], "plugins": [ "flowtype" ], "rules": { "linebreak-style": 0 } }
"test": "npm run lint && flow check", "lint": "eslint src"
也可以使用pre钩子让每次编译前检查。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
安装
不建议全局安装
配置
执行
eslint --init
? How would you like to configure ESLint?
Answer questions about your style
然后选择风格
? Which style guide do you want to follow? (Use arrow keys)
Google
? What format do you want your config file to be in? (Use arrow keys)
这里我们使用
airbnb
的。手工安装flow等依赖
自定义规则
.eslintrc.json
中增加rule,如更多规则参考 这里
忽略检查
最终配置文件
.eslintrc.json
增加 npm 脚本
也可以使用pre钩子让每次编译前检查。
The text was updated successfully, but these errors were encountered: