如何为 ESLint 规则设置选项值?

How to set an option value for an ESLint rule?

我想更改我的 ESLint 规则以将 "camelcase" 规则上的选项 "properties" 值设置为 "never"。我已经阅读文档两三遍,但不太了解如何做到这一点。 Camelcase rule docs

这是我现在的 .eslintrc.json:

{
  "env": {
    "es2021": true,
    "node": true
  },
  "extends": ["airbnb-base", "plugin:import/typescript"],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 12,
    "sourceType": "module"
  },
  "plugins": ["@typescript-eslint"],
  "rules": {
    "camelcase": ["error"],
    "linebreak-style": "off",
    "comma-dangle": "off",
    "implicit-arrow-linebreak": "off",
    "import/extensions": [
      "error",
      "ignorePackages",
      {
        "ts": "never"
      }
    ]
  }
}

你可以这样做。

"rules": {
    "camelcase": ["error", {"properties": "never"}],
    ....
}