首页 > 解决方案 > 如何设置 ESLint 规则以接受snake_case?

问题描述

总是出错

  `16:3  error  Property name `type_array` must match one of the following formats: camelCase, UPPER_CASE, PascalCase    @typescript-eslint/naming-convention
  16:3  error  Identifier 'type_array' is not in camel case 
16:3  error  Property name `instument_view_id` must match one of the following formats: camelCase, UPPER_CASE, PascalCase`

我尝试从页面 https://eslint.org/docs/2.0.0/rules/camelcase 添加到 .eslintrc.js 变体中的规则,但对我没有任何作用.. :(

  `rules: {
    camelcase: ['error', {properties: 'always'}],
  },
```
  rules: {
    camelcase: ['error', {allow: ['aa_bb']}],,
  },`

标签: node.jseslint

解决方案


ESLint 不支持snake_case. 如果你想使用snake_case,试试这个ESLint 插件


推荐阅读