Skip to content

Commit

Permalink
update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghuiquan committed Jun 1, 2018
1 parent c4b99be commit b60733d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["standard"]
}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# MIP 2

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

## JavaScript 代码规范

使用 [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 检查单独文件
$ npx eslint filename.js
```

> **注意**:这里 `eslint-config-standard` 作为 eslint 的规范配置引入,在 `.eslintrc.json` 的 extends 配置项中使用,不需要安装 standard 工具,编辑器也不需要安装 standard 插件,只需要安装 eslint 的代码检查插件即可。
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
},
"homepage": "https://github.com/mipengine/mip2#readme",
"devDependencies": {
"babel-eslint": "^8.2.3",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint": "^5.0.0-alpha",
"eslint-config-standard": "^12.0.0-alpha",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
Expand Down
1 change: 1 addition & 0 deletions packages/mip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"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
8 changes: 3 additions & 5 deletions packages/mip/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,14 @@ let viewer = {
* @return {Object} messageData
*/
_getMipLinkData () {
let messageData = {}

// compatible with MIP1
let parentNode = this.parentNode

return {
click: this.getAttribute('data-click') || parentNode.getAttribute('data-click'),
title: this.getAttribute('data-title')
|| parentNode.getAttribute('title')
|| this.innerText.trim().split('\n')[0]
title: this.getAttribute('data-title') ||
parentNode.getAttribute('title') ||
this.innerText.trim().split('\n')[0]
}
}
}
Expand Down

0 comments on commit b60733d

Please sign in to comment.