From 3ad71d044c9a0b88bf5dfd8fbac8501e760817dd Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Fri, 24 May 2024 17:01:17 -0600 Subject: [PATCH] fix(eslint): fine-tune no-unused-vars --- configs/eslint.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/configs/eslint.js b/configs/eslint.js index 8494162..cd06a54 100644 --- a/configs/eslint.js +++ b/configs/eslint.js @@ -26,7 +26,6 @@ export default [ }, }, rules: { - 'no-unused-vars': 'warn', 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', }, @@ -34,12 +33,21 @@ export default [ // JS and JSX files { - files: ['**/*.js', '**/*.jsx'], + files: ['**/*.js?(x)'], rules: { // most of these rules are useful for JS but not TS because TS handles these better // if it weren't for https://github.com/import-js/eslint-plugin-import/issues/2132 // we could enable this :( // 'import/no-unresolved': 'error', + 'no-unused-vars': [ + 'warn', + { + args: 'after-used', + argsIgnorePattern: '^_', + ignoreRestSiblings: true, + varsIgnorePattern: '^ignored', + }, + ], }, }, @@ -57,6 +65,15 @@ export default [ .default, }, rules: { + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + args: 'after-used', + argsIgnorePattern: '^_', + ignoreRestSiblings: true, + varsIgnorePattern: '^ignored', + }, + ], 'import/consistent-type-specifier-style': ['warn', 'prefer-inline'], '@typescript-eslint/consistent-type-imports': [ 'warn',