How to disable warn about some unused params, but keep “@typescript-eslint/no-unused-vars” rule

Only way that I found is to use ignore pattern argsIgnorePattern in rule options. If your variable is unused, just add underscore _ctx and ESLint will ignore it, but no-unused-vars rule will still work for other values. After you will need to use this value, just remove underscore ctx.

 // note you must disable the base rule as it can report incorrect errors
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
  "warn", // or "error"
  { 
    "argsIgnorePattern": "^_",
    "varsIgnorePattern": "^_",
    "caughtErrorsIgnorePattern": "^_"
  }
],

You can change this pattern ^_ as you like using RegExp.

Example:

const _a="unused, no warning"
const b = 'unused, warning'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)