代码之家  ›  专栏  ›  技术社区  ›  user989988

Disable npm“Warning-tslint:error no string literal:不允许通过string literals访问对象”

  •  1
  • user989988  · 技术社区  · 6 年前

    2 回复  |  直到 6 年前
        1
  •  1
  •   Sidman Raj    6 年前

    添加以下行 “无字符串文字”:false 在tslint.json中

    {
        "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
        "linterOptions": {
            "exclude": [
                "config/**/*.js",
                "node_modules/**/*.ts",
                "coverage/lcov-report/*.js"
            ]
        },
        "rules": {
            "no-console": false,
            "jsx-no-lambda": false,
            "no-string-literal": false    
        }
    }
    
        2
  •  0
  •   Greg Wozniak    6 年前

    rules ,设置 "no-string-literal" false 所以它变成: "no-string-literal": false

    https://palantir.github.io/tslint/rules/no-string-literal/