From b1594d013c77c20f48838873e9403a94a1541e9f Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 9 Apr 2024 13:17:29 +0200 Subject: [PATCH] fix(eslint-config): improve `no-unused-vars` options --- .../src/flat/configs/typescript.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/eslint-config/src/flat/configs/typescript.ts b/packages/eslint-config/src/flat/configs/typescript.ts index 0c0c6b05..287504bb 100644 --- a/packages/eslint-config/src/flat/configs/typescript.ts +++ b/packages/eslint-config/src/flat/configs/typescript.ts @@ -58,19 +58,20 @@ export default function typescript(options: NuxtESLintConfigOptions): FlatConfig 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply 'valid-typeof': 'off', // ts(2367) + 'no-unused-vars': 'off', // ts takes care of this '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false, prefer: 'type-imports' }], - }, - }, - { - name: 'nuxt/typescript/disables', - files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '**/*.vue'], - rules: { - // The core 'no-unused-vars' rules (in the eslint:recommended ruleset) - // does not work with type definitions. - 'no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/consistent-type-imports': ['error', { + disallowTypeAnnotations: false, + prefer: 'type-imports', + }], + '@typescript-eslint/no-unused-vars': ['error', { + args: 'after-used', + argsIgnorePattern: '^_', + ignoreRestSiblings: true, + vars: 'all', + varsIgnorePattern: '^_', + }], }, }, ]