说我导入了一个组件:
const MyComponent = require('./components/MyComponent');
然后在JSX块中使用它:
const App = props => (<MyComponent/>)
我在WebStorm中收到Eslint的错误:
'MyComponent' is assigned a value but never used (no-unused-vars)
如何让WebStorm了解我使用此变量?
答案 0 :(得分:3)
不是WebStorm,而是ESLint无法识别您的JSX变量。你有eslint-plugin-react安装吗?我猜你错过了jsx-uses-vars
规则。有关提示,请参阅https://github.com/eslint/eslint/issues/2156,https://github.com/hyperapp/hyperapp/issues/557