【发布时间】:2021-04-04 06:27:42
【问题描述】:
我正在尝试为我的项目设置命名约定。
我在snake_case 中有一些变量,我希望 ESLint 警告我,例如:
const { order_id } = req.params;
我删除了typescript-eslint/camelcase,因为它已被弃用,并尝试设置naming-convention,并为布尔值添加了一个新的error 规则。
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
},
],
如何为snake_case 变量添加警告?
【问题讨论】:
标签: typescript eslint