Agung
Agung

Reputation: 13813

how to configure my eslintrc in cloud function typescript project?

I am trying to use typescript cloud function and use ESlint in it, but I want to make unused variable as a warning only, not marked as an error. I am confused how to configure it in my cloud function project, it always error like this in my .eslintrc , please help

enter image description here

enter image description here

here is my .eslintrc configuration

module.exports = {
  root: true,
  env: {
    es6: true,
    node: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript",
    "google",
  ],
  parser: "@typescript-eslint/parser",
  parserOptions: {
    project: ["tsconfig.json", "tsconfig.dev.json"],
    sourceType: "module",
  },
  ignorePatterns: [
    "/lib/**/*", // Ignore built files.
  ],
  plugins: [
    "@typescript-eslint",
    "import",
  ],
  rules: {
    quotes: ["error", "double"],
    no-unused-vars: ["warn"] <---- this one
  },
};

Upvotes: 1

Views: 851

Answers (1)

hendrixchord
hendrixchord

Reputation: 5434

You need to wrap no-unused-vars in quotes since it contains - in its property name.

Dashes are not legal in javascript variables. A variable name must start with a letter, dollar sign or underscore and can be followed by the same or a number. You can have dashes in strings.

"no-unused-vars": ["warn"],

Upvotes: 2

Related Questions