[eslint] Ignore _ prefixed unused variables
Lauren Tan committed
Feb 27, 2023 at 17:12 UTC
e4e1af723697f2efd98765cb2c968568910cd1f9
1 file changed
+11
-4
compiler/forget/.eslintrc.js
+11
-4
@@ -29,10 +29,17 @@ module.exports = {
29
"@typescript-eslint/no-inferrable-types": "off",
30
"@typescript-eslint/explicit-function-return-type": "error",
31
32
- // Unused variables are frequently a bug. Ideally this rule would ignore identifiers
33
- // prefixed with "_", though, so that we don't need suppressions in legit cases.
34
- // TODO: build a custom version of this rule that understands "_" as a prefix.
35
- "@typescript-eslint/no-unused-vars": "error",
32
+ // Unused variables are frequently a bug. Prefix unused variables with an _ to fix, but note
33
+ // that eslint won't warn you that an underscore prefixed variable is used and that the prefix
34
+ // should be dropped.
35
+ "@typescript-eslint/no-unused-vars": [
36
+ "error",
37
+ {
38
+ argsIgnorePattern: "^_",
39
+ varsIgnorePattern: "^_",
40
+ caughtErrorsIgnorePattern: "^_",
41
+ },
42
+ ],
43
44
// Consider enabling for consistency. Ideally violations could be auto-fixed.
45
"@typescript-eslint/consistent-generic-constructors": [