如何避免 eslint-plugin-import "unresolved path to module 'electron'" 错误
How to avoid the eslint-plugin-import "unresolved path to module 'electron'" error
好的,所以这被记录得一清二楚,但我可能在做一些愚蠢的事情,无法让它发挥作用...
我在 Electron 应用程序上使用 eslint-plugin-import,我收到 Unable to resolve path to module 'electron'
.
的 lint 错误
在文档中,它说我需要 A.) 使用共享的 Electron 配置 B.) 将带有 electron
的数组传入 "import/core-modules" 设置。
对于 A,我试过这个:
{
"extends": [
"airbnb",
"plugin:import/electron"
]
}
当我 lint 时,我得到了这个:
对于 B,我试过:
{
"extends": [
"airbnb"
],
"plugins": [
"import"
],
"rules": {
"import/core-modules": [
"electron"
]
}
}
得到这个:
我也试过:
{
"extends": [
"airbnb"
],
"plugins": [
"import"
],
"settings": {
"import/core-modules": [
"electron"
]
}
}
我刚收到“未解析的模块路径”错误。
这可能真的很愚蠢,但我做错了什么?理想情况下,我只想使用共享配置。
好的,在 Github 仓库上发布这个问题后,发现与 Electron 相关的更改还没有发布到 npm。它们将在下一个版本中,但截至目前,它们仅在主版本中。
https://github.com/benmosher/eslint-plugin-import/issues/393#issuecomment-227821876
好的,所以这被记录得一清二楚,但我可能在做一些愚蠢的事情,无法让它发挥作用...
我在 Electron 应用程序上使用 eslint-plugin-import,我收到 Unable to resolve path to module 'electron'
.
在文档中,它说我需要 A.) 使用共享的 Electron 配置 B.) 将带有 electron
的数组传入 "import/core-modules" 设置。
对于 A,我试过这个:
{
"extends": [
"airbnb",
"plugin:import/electron"
]
}
当我 lint 时,我得到了这个:
对于 B,我试过:
{
"extends": [
"airbnb"
],
"plugins": [
"import"
],
"rules": {
"import/core-modules": [
"electron"
]
}
}
得到这个:
我也试过:
{
"extends": [
"airbnb"
],
"plugins": [
"import"
],
"settings": {
"import/core-modules": [
"electron"
]
}
}
我刚收到“未解析的模块路径”错误。
这可能真的很愚蠢,但我做错了什么?理想情况下,我只想使用共享配置。
好的,在 Github 仓库上发布这个问题后,发现与 Electron 相关的更改还没有发布到 npm。它们将在下一个版本中,但截至目前,它们仅在主版本中。
https://github.com/benmosher/eslint-plugin-import/issues/393#issuecomment-227821876