Skip to content

Commit

Permalink
feat(transformer): 同一文件定义多个类在 cli 直接报错
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Apr 4, 2019
1 parent d16e45a commit eea66cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/taro-transformer-wx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"babel-traverse": "^6.26.0",
"babel-types": "^6.26.0",
"eslint": "^4.15.0",
"eslint-plugin-react": "7.10.0",
"eslint-plugin-taro": "1.2.22",
"html": "^1.0.0",
"lodash": "^4.17.5",
Expand Down
6 changes: 5 additions & 1 deletion packages/taro-transformer-wx/src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const cli = new CLIEngine({
baseConfig: {
extends: ['plugin:taro/transformer']
},
rules: {
'react/no-multi-comp': [2, { ignoreStateless: false }]
},
plugins: ['react'],
useEslintrc: false,
parser: 'babel-eslint',
parserOptions: {
Expand Down Expand Up @@ -39,7 +43,7 @@ export const eslintValidation: () => {
}
}, msg.message)
// tslint:disable-next-line
console.warn('\n' + `ESLint(${msg.ruleId}) 错误:` + err.message + '\n')
console.warn('\n' + `ESLint(${msg.ruleId}) 错误:` + err.message.replace('Declare only one React component per file', '一个文件只能定义一个 Taro 类或 Taro 函数式组件') + '\n')
}
}
}
Expand Down

0 comments on commit eea66cf

Please sign in to comment.