use*_*927 5 javascript eslint eslintrc
我希望no-restricted-imports
在我的代码库中强制执行特定导入的规则。但是,我需要为某些路径抛出错误并为其他路径抛出警告。看起来我不能只做:
'no-restricted-imports': [
'warn',
{
paths: [
{
name: 'd3',
message: 'd3 would be deprecated soon, please consider moving away from it'
}
]
},
'error',
{
paths: [
{
name: 'moment',
message: 'Use of moment is not allowed',
},
]
]
Run Code Online (Sandbox Code Playgroud)
实现这种行为的最佳方法是什么?
我已经尝试过no-restricted-imports
两次定义规则,一次用于错误,一次用于警告,但由于它是一个对象,因此被覆盖。
归档时间: |
|
查看次数: |
441 次 |
最近记录: |