【发布时间】:2018-10-07 01:21:07
【问题描述】:
我有一个项目,我使用 webpack,eslint。通过 webpack.config 我设置解析 index 和 Index 文件。一切正常,除了 eslint 抛出错误import/no-unresolved 和import/extensions,它不知道,除了index,现在它也应该解析Index 文件(import Index from ./components,其中./components 有文件Index.jsx)。我的设置如下。
// .eslintrc
{
"extends": "airbnb",
"env": { "browser": true },
"rules": {
"no-restricted-syntax": "off",
"no-continue": "off",
"no-plusplus": "off",
"react/prop-types": "off",
"no-underscore-dangle": "off",
"no-param-reassign": "off",
"class-methods-use-this": "off"
}
}
// package.json
// ...
"devDependencies": {
// ...
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
// ...
}
// ...
【问题讨论】:
-
如果答案正确,别忘了将答案标记为正确。
-
"react/prop-types": "off"是个非常糟糕的主意。
标签: javascript reactjs webpack eslint lint