mcpField
T
typescript-eslint

typescript-eslint

github.com/claude-dev-suiteTesting & quality4685 installsUpdated 2d ago
Repository

About typescript-eslint

A reference skill for configuring typescript-eslint in TypeScript projects. It covers ESLint setup, type-aware rules, and migration from TSLint, with configuration examples and troubleshooting guidance.

Key features

  1. 01ESLint configuration for TypeScript
  2. 02Type-aware linting presets
  3. 03Common rule examples
  4. 04File-specific rule configuration
  5. 05Troubleshooting guidance

Use cases

  1. 01Setting up ESLint in a TypeScript project
  2. 02Enabling type-aware checks
  3. 03Migrating from TSLint

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill typescript-eslint

After installing, type/typescript-eslintin Claude Code to confirm it loaded.

Details

From the project README

typescript-eslint - Quick Reference

When to Use This Skill

  • Configure ESLint for TypeScript projects
  • Type-aware rules for TypeScript
  • Migration from TSLint

When NOT to Use This Skill

  • Full ESLint 9 setup - Use eslint-biome skill for complete configuration
  • Biome linter - Use eslint-biome skill for Biome setup
  • Code quality principles - Use quality-common for SOLID/Clean Code
  • Java/Kotlin - Use sonarqube skill for JVM languages

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: typescript-eslint for comprehensive documentation.

Basic Setup

npm install -D eslint typescript-eslint

Flat Config (ESLint 9+)

eslint.config.mjs
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommended,
);
Type-Aware Linting
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommendedTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
);
Strict Configuration
export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.strictTypeChecked,
  ...tseslint.configs.stylisticTypeChecked,
);

Common Rules

{
  rules: {
    // Prevent unused variables
    '@typescript-eslint/no-unused-vars': ['error', {
      argsIgnorePattern: '^_'
    }],

    // Require explicit return types
    '@typescript-eslint/explicit-function-return-type': 'warn',

    // Prevent any usage
    '@typescript-eslint/no-explicit-any': 'error',

    // Require await in async functions
    '@typescript-eslint/require-await': 'error',

    // Prevent floating promises
    '@typescript-eslint/no-floating-promises': 'error',

    // Consistent type imports
    '@typescript-eslint/consistent-type-imports': 'error',
  }
}

File-Specific Rules

export default tseslint.config(
  // ... base config
  {
    files: ['**/*.test.ts', '**/*.spec.ts'],
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
    },
  },
  {
    files: ['**/*.js'],
    ...tseslint.configs.disableTypeChecked,
  },
);

Anti-Patterns

Anti-PatternWhy It's BadCorrect Approach
Not using type-aware rulesMisses Promise, async issuesUse recommendedTypeChecked
Allowing any everywhereDefeats TypeScript purposeSet no-explicit-any: error
No require-await ruleUnnecessary async keywordsEnable type-aware async rules
Type checking JS filesJS has no typesUse disableTypeChecked for .js
Disabling rules in test filesTests need quality tooOnly disable no-explicit-any if needed
Ignoring unused variablesCode smell, unused importsUse no-unused-vars with ignore pattern

Quick Troubleshooting

IssueLikely CauseSolution
Type-aware rules not workingMissing projectService: trueAdd to languageOptions.parserOptions
Linting very slowType checking all filesLimit type rules to **/*.ts only
"Unsafe" errors everywhereStrict type checkingUse strictTypeChecked or disable specific rules
Promise errors not caughtMissing no-floating-promisesEnable in recommendedTypeChecked preset
Unused imports not detectedWrong rule configurationUse @typescript-eslint/no-unused-vars
Rules conflict with PrettierBoth formatting codeAdd eslint-config-prettier last

Comments

Markdown supported