简体   繁体   English

Airbnb样式指南:命名约定的规则不起作用

[英]Airbnb style guide:rules for naming conventions not working

According to the Airbnb doc, this is the best practice for naming objects 根据Airbnb的文档,这是命名对象的最佳做法

// bad
const OBJEcttsssss = {};

// good
const thisIsMyObject = {};

But which rule I need to add to achieve the same 但是我需要添加哪个规则来达到相同的目的

Here is my .eslintrc.json 这是我的.eslintrc.json

{
  "extends": "airbnb",
  "env": {
    "browser": true,
    "node": true
  },
  "rules":{
    "camelcase":true
  }
}

I've added camelcase rule but it didn't work 我添加了camelcase规则,但是没有用

Also, I can't find the rules belong to the following 另外,我找不到属于以下规则

1) Variable naming 2) Function naming 3) Class Naming 1)变量命名2)函数命名3)类命名

You are not defining the rule correctly it need to be an array 您没有正确定义规则,它必须是数组

eg : "camelcase": [2, {"properties": "always"}] 例如: "camelcase": [2, {"properties": "always"}]

More info about the options there : https://eslint.org/docs/2.0.0/rules/camelcase 有关该选项的更多信息: https : //eslint.org/docs/2.0.0/rules/camelcase

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM