reactjs - PropTypes defined, but never used (ESLint, babel 6) -
i can't catch place, i'm fault.
my .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 } }
my webpack.config section lint:
preloaders: [ { test: /\.js$/, loaders: ['eslint'], include: [ path.resolve(__dirname, "src"), ], } ],
and component
import react, { proptypes, component } '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 }
i have exception: 1:17 error "proptypes" defined never used no-unused-vars
hmm, i'm doing wrong?
p.s. babel5 - works correctly.
user.proptypes = { name: react.proptypes.string.isrequired }
you're importing react.proptypes
proptypes
, in case, change name: proptypes.string.isrequired
(or remove proptypes import on top)
Comments
Post a Comment