Skip to content

Commit

Permalink
update lint
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghuiquan committed Jun 4, 2018
1 parent faf9f1b commit 9693c2f
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 353 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
UTF-8
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

这个项目包含 mip 核心代码和 mip-cli 的代码,位于 packages 目录下

## JavaScript 代码规范
## 代码规范

- 使用 ES6 和 ES Module 编写组件
- 全部代码需要通过 eslint 审核才能提交,遵循社区 standard 规范
- 不到万不得已,不许使用 eslint-disable
- Vue 的 template 部分需要遵守 Vue 的编码规范

使用 [eslint](https://eslint.org/) 代码规范检查工具,使用 JavaScript Standard Style [[CN](https://standardjs.com/rules-zhcn.html)/[EN](https://standardjs.com/rules-en.html)] 代码规范。

```sh
# 在项目下运行检查所有文件
# 检查所有文件
$ npm run lint

# or 检查单独文件
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
"mip",
"mip2"
],
"scripts": {
"lint": "npm run lint:mip && npm run lint:cli && npm run lint:validator",
"lint:mip": "eslint packages/mip/src",
"lint:cli": "eslint packages/mip-cli/lib",
"lint:validator": "eslint packages/mip-component-validator/src"
},
"author": "[email protected]",
"license": "MIT",
"bugs": {
Expand Down
3 changes: 2 additions & 1 deletion packages/mip-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"mip2": "bin/mip2"
},
"scripts": {
"test": "NODE_ENV=test && nyc ava --verbose"
"test": "NODE_ENV=test && nyc ava --verbose",
"lint": "eslint lib"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module.exports = {
name: 'component-name',
exec (file, reporter) {
let regex = new RegExp(/^mip-[\w\-]+.vue$/)
let regex = new RegExp(/^mip-[\w-]+.vue$/)
if (!file.name.match(regex)) {
reporter.error(file.path, '组件名称不符合命名规范')
}
Expand Down
20 changes: 0 additions & 20 deletions packages/mip/build/rollup/alias.js

This file was deleted.

97 changes: 0 additions & 97 deletions packages/mip/build/rollup/build.js

This file was deleted.

188 changes: 0 additions & 188 deletions packages/mip/build/rollup/rollup.config.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/mip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"dev": "node examples/server.js",
"build": "node build/build.js",
"lint": "eslint ./src",
"uploadjs": "baidubce bos --put-object dist/mip.js bos://assets/mip/projects/mip.js",
"uploadcss": "baidubce bos --put-object dist/mip.css bos://assets/mip/projects/mip.css"
},
Expand Down
Loading

0 comments on commit 9693c2f

Please sign in to comment.