5
我找不到一個地方,我錯了。已定義PropType,但從未使用(ESLint,babel 6)
preLoaders: [
{
test: /\.js$/,
loaders: ['eslint'],
include: [
path.resolve(__dirname, "src"),
],
}
],
而且我的組件
import React, { PropTypes, Component } from 'react'
export default class User extends Component {
render() {
const { name } = this.props
return <div>
<p>Hello, {name}!</p>
</div>
}
}
User.propTypes = {
name: React.PropTypes.string.isRequired
}
我有例外: 1:17錯誤「PropTypes
我.eslintrc
{
"extends": "eslint:recommended",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"
],
"rules": {
"no-console": 0,
"new-cap": 0,
"strict": 0,
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"eol-last": 0,
"quotes": [2, "single"],
"jsx-quotes": 1,
"react/jsx-no-undef": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1
}
}
我對皮棉webpack.config節「已定義,但從未使用過沒有未使用過的變種
嗯,我做錯了什麼?
P.S.隨着babel5 - 所有工作正常。
謝謝,這是推動我瘋了 –