で検証することはできませんプロップは、私は以下の持っているeslint
'バー' は小道具の検証に欠けている
太い矢印がJSXを返すように見えても、eslintは失敗したようです。
私はthis
にbar
を割り当てることによって、これを回避することができます
const Foo = (props) => {
this.bar = props.bar; //eslint sees this properly
const myFunc =() => (
<div>
{ this.bar }
</div>
);
が、これはこのことについてに行くための最善の方法ですか?なぜこうなった?私は何が起こっているかを想像
.eslintrc
// .eslint.json
{
"extends": "airbnb",
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"es6": true,
"jest": true
},
"plugins": [
"react",
"import",
"jsx-a11y"
],
"rules": {
"react/jsx-filename-extension": 0,
"func-names": 0,
"strict": 0,
"quotes": [1, "single"],
"no-confusing-arrow": 0,
"react/prefer-es6-class": 0,
"babel/generator-star-spacing": 0,
"no-underscore-dangle": 0,
"linebreak-style": ["error", "windows"],
"no-named-as-default": 0,
}
}
あなたの '.eslintrc'を共有できますか? –
説明のために、「 'bar'が小道具の検証に欠落しています」というのはpropTypes宣言に関連したエラーだと聞こえます。 をどこにでもインスタンス化していなくても、eslintはエラーになりますか? –