I use ESLint alongside TypeScript. The
no-unused-vars rule provides similar functionality to TypeScripts
noUnusedParameters settings, but has more power and more flexibility. For instance,
no-unused-vars can catch unused error variables; TypeScript's
One thing that I missed when switching to the ESLint option is that, with
noUnusedParameters, you can simply ignore unused variables by prefixing a variable with the
_ character. That's right, sometimes I want to declare a variable that I know I'm not going to use, and I want to do that without getting shouted at by the linter.
It turns out you can get ESLint to respect the TypeScript default of ignoring variables prefixed with
_; it's just not the default configuration for
no-unused-vars. But with a little configuration we can have it. This post is a quick guide to how to implement that configuration.