1. 首页
  2. 考试认证
  3. 其它
  4. camel case强制驼峰命名但允许在属性名称中使用下划线的ESLint规则

camel case强制驼峰命名但允许在属性名称中使用下划线的ESLint规则

上传者: 2024-12-09 09:35:25上传 ZIP文件 5.08KB 热度 16次

camel_case: 强制 camelCase 命名但允许在属性名称中使用下划线的 ESLint 规则相关:

我将自己的自定义 eslint 规则集合放入,我们想在变量名中使用驼峰命名,但仍然希望在 JSON 对象中允许使用下划线:


var goodObject = { property_name: 1, another_property: 2 };

有驼峰规则,强制每一个变量名是驼峰格式。


jshint index.js: line 2, col 0, Identifier 'property_name' is not in camel case.

index.js: line 3, col 0, Identifier 'another_property' is not in camel case.

手动解决方法:使用 // jshint ignore 注释。

下载地址
用户评论