Skip to content

Commit

Permalink
feat: 单独抽离小程序配置
Browse files Browse the repository at this point in the history
  • Loading branch information
elvinn committed Jul 15, 2019
1 parent b3ad18c commit 2a0a4de
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ IMWeb团队eslint配置规则。
# 安装
安装依赖:

npm i --save-dev eslint babel-eslint eslint-config-imweb
npm i --save-dev eslint@5 babel-eslint eslint-config-imweb

配置`.eslintrc`:
配置 `.eslintrc` :

{
"extends": "eslint-config-imweb"
}
- 小程序项目:

{
"extends": "eslint-config-imweb/weapp"
}

- 非小程序项目

{
"extends": "eslint-config-imweb"
}

配置`package.json`的scripts:
配置 `package.json` 的scripts:

"scripts": {
"lint": "eslint *.js lib test xxx",
Expand Down
22 changes: 16 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@
1. 安装依赖:

``` sh
npm i --save-dev eslint babel-eslint eslint-config-imweb
npm i --save-dev eslint@5 babel-eslint eslint-config-imweb
```

2. 配置 `.eslintrc`:

``` json
{
"extends": "eslint-config-imweb"
}
```
- 小程序项目:

``` json
{
"extends": "eslint-config-imweb/weapp"
}
```

- 非小程序项目

``` json
{
"extends": "eslint-config-imweb"
}
```

3. 配置`package.json`的scripts:

Expand Down
11 changes: 0 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ module.exports = {
'react',
'babel',
],
// 小程序全局变量
globals: {
wx: false,
App: false,
Page: false,
getApp: false,
Component: false,
Behavior: false,
requirePlugin: false,
getCurrentPages: false,
},
rules: {
'arrow-parens': 0,
'function-paren-newline': [
Expand Down
14 changes: 14 additions & 0 deletions weapp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const config = require('./index');

config.globals = {
wx: false,
App: false,
Page: false,
getApp: false,
Component: false,
Behavior: false,
requirePlugin: false,
getCurrentPages: false,
};

module.exports = config;

0 comments on commit 2a0a4de

Please sign in to comment.