是否存在检查文件路径嵌套级别的规则?例如:
此规则的不正确代码示例:
import { notifyDevelopers } from '../../../../../utils/ajax'
此规则的正确代码示例:
import { notifyDevelopers } from './../utils/ajax'
import { notifyDevelopers } from 'utils/ajax'
我只找到了这个包: https://github.com/benmosher/eslint-plugin-import
但似乎该程序包没有这样的规则
答案 0 :(得分:1)
.eslintrc
{
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": ["../../../*"]
}
]
}
}
no-restricted-modules
规则,也支持此规则