Skip to content

Commit

Permalink
fix(eslint/js): allow unused var when leading underscore (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreDemailly authored Jan 5, 2025
1 parent 4232e93 commit a0b0d43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/eslint/src/rules/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ export default {
"no-undefined": "off",

// See: https://eslint.org/docs/rules/no-unused-vars
"no-unused-vars": ["error", { "ignoreRestSiblings": true }]
"no-unused-vars": ["error", {
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}]
};
4 changes: 4 additions & 0 deletions src/eslint/test/fixtures/pass.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
const foo: string = "bar";
console.log(foo);
function _shouldPassEvenIfNotUsedDueToLeading_(_boo: any) {
console.log("bar");
}
const _shadow = "foo";

0 comments on commit a0b0d43

Please sign in to comment.