Mac
antd-mobile: 0.9.4
ESLint: 2.10.1
babel-eslint: 6.0.4
在 react-native 中使用
引入模块
import { Popup } from 'antd-mobile'
ESLint parse 使用的是 babel-eslint
ESLint 不报错
Unable to resolve path to module 'antd-mobile' import/no-unresolved
仔细对照看文档。
感谢回复,在提这个 issue 之前我已经搜索过相关问题,没有 eslint 相关的。
麻烦再看一下我的问题,谢谢。
你意思是使用
"import/no-unresolved": 0
这个规则吗?
如果是这样的话,并不认为是好的解决方案
欢迎你提供更好的方案建议~
把默认的 main 设为 lib/index.js 或 lib/index.web.js。
@afc163 额,没懂你说的 main 指的是什么
我是和 @warmhug 说的。
有什么进展吗
目前暂时在引入 antd 的地方使用 eslint-disable-line
@xwartz
.eslintrc 中可以这样设置
"rules": {
"import/extensions": [2, "never", { "web.js": "never", "json": "never" }],
"import/no-extraneous-dependencies": [2, { "devDependencies": true }],
"import/no-unresolved": [2, { "ignore": ["antd-mobile"] }]
}
"import/no-extraneous-dependencies" 和 "import/extensions" 的设置和本问题无关,只是现在的我们的项目里 "import/no-unresolved" 和 "import/no-extraneous-dependencies" 都设置为 0 不妥当
@yoniji 谢谢,你的方式比我的好多了
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.
Most helpful comment
@xwartz
.eslintrc 中可以这样设置
"import/no-extraneous-dependencies" 和 "import/extensions" 的设置和本问题无关,只是现在的我们的项目里 "import/no-unresolved" 和 "import/no-extraneous-dependencies" 都设置为 0 不妥当