typescript - @typescript-eslint/naming-convention:如何混合错误和警告规则?
问题描述
我正在尝试为我的项目设置命名约定。
我有一些变量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
变量添加警告?
解决方案
推荐阅读
- swift - 将 swift 代码编译为 32 位目标文件
- php - PHP,将选择字段(HTML)中的值与数组中的值进行比较不起作用
- php - 从另一个表的数组中从表中选择 where 子句
- mysql - 使用 MYSQL 查询寻找建议
- ios - 超出缓冲区时触发 AVPlayerItemDidPlayToEndTimeNotification
- c# - (File.Copy) mscorlib.dll 中未处理的“System.IO.IOException”
- assembly - 打开Calc.exe的Shellcode太长太复杂,看不懂!我的第一个漏洞利用程序
- javascript - Pact:用相同的端点编写不同的交互
- java - 从文本文件中读取用户名和密码并将它们与文本字段进行比较是行不通的,即使它们完全相同
- ios - locationManager.location 返回 nil