Канал о программировании и веб-разработке. Мы создаем уникальные туториалы, гайды, составляем дорожные карты для самообучения. Основные темы: Frontend, React, Next.js.
For quite a while I had ESLint rule `@typescript-eslint/no-unused-vars` disabled cause (I thought) it duplicates TypeScript rules noUnusedLocals and noUnusedParams. Few experiments confirmed that belief.
Today I reenabled that ESLint rule on quite a big codebase and, to my surprise ... discovered that `noUnusedLocals` does miss some unused vars!
I didn't notice a *pattern of missing* yet (TS bugs?) but the point is that EsLint may find "unused-var" bugs that TS doesn't.
Both TS rules are disabled in Deno b.t.w and they recommend to use Linter instead. So I decided to follow the same path and recommend it to you.
- Disable `noUnusedLocals` and `noUnusedParams` to have more flexibility while development (it really helps).
- Enable `@typescript-eslint/no-unused-vars` to catch "unused-something" places
The latter will need an extra config like:
```
"@typescript-eslint/no-unused-params": ["error",
{"argsIgnorePattern": "^_", "varsIgnorePattern": "^_"}
],
```