Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
MinJie 25d7fc15cb | 7 years ago | |
---|---|---|
.. | ||
README.md | 7 years ago | |
eslintrc.json | 7 years ago |
eslintrc.json: 该文件可以是你项目中有且仅有ESLint的配置文件,包含简要的规则解释。
在package.json
文件中添加如下依赖(如果没有package.son
文件需首先通过npm init
创建package.son
文件):
"devDependencies": {
"babel-core": "^6.5.2",
"babel-eslint": "^4.1.8",
"eslint": "^2.1.0",
"eslint-plugin-promise": "^1.0.8",
"eslint-plugin-standard": "^1.3.2"
}
运行如下命令:
npm install
并将eslintrc.json
重命名为.eslintrc
(或者直接使用文件夹中的.eslintrc
文件)
根据自己项目需要,在配置文件中globals
配置项中添加项目所需全局变量:举个栗子:
"globals": {
"document": true,
"navigator": true,
"window": true,
"angular":true // 添加项目所需没有申明的全局变量
},
修改package.json
文件。在script
配置项中添加如下代码:举个栗子:
"scripts": {
"lint": "eslint app.jsx test" //其中app.jsx test需要替换成你项目需要检测的文件或文件夹
},
命令行运行如下代码:
npm run lint
好了,现在就可以在终端看检测结果了。
web前端规范指南
other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》