CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-typescript-eslint--types

Type definitions for the TypeScript-ESTree AST specification, including parser options and AST node types

Pending
Overview
Eval results
Files

parser-configuration.mddocs/

Parser Configuration

Comprehensive configuration interfaces for the TypeScript parser, enabling precise control over parsing behavior, ECMAScript features, TypeScript project integration, and debugging options.

Capabilities

ParserOptions Interface

Complete configuration interface for the TypeScript-ESTree parser.

interface ParserOptions {
  [additionalProperties: string]: unknown;
  
  // Cache configuration
  cacheLifetime?: {
    glob?: CacheDurationSeconds;
  };

  // Core parsing options
  debugLevel?: DebugLevel;
  ecmaFeatures?: {
    [key: string]: unknown;
    globalReturn?: boolean | undefined;
    jsx?: boolean | undefined;
  } | undefined;
  ecmaVersion?: EcmaVersion;
  sourceType?: SourceType | undefined;

  // TypeScript-specific options
  emitDecoratorMetadata?: boolean;
  errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
  errorOnUnknownASTType?: boolean;
  experimentalDecorators?: boolean;
  extraFileExtensions?: string[];
  filePath?: string;
  isolatedDeclarations?: boolean;
  
  // JSDoc and JSX configuration
  jsDocParsingMode?: JSDocParsingMode;
  jsxFragmentName?: string | null;
  jsxPragma?: string | null;
  
  // Library and program configuration
  lib?: Lib[];
  programs?: Program[] | null;
  
  // Project configuration
  project?: boolean | string | string[] | null;
  projectFolderIgnoreList?: string[];
  projectService?: boolean | ProjectServiceOptions;
  
  // Token and range options
  range?: boolean;
  tokens?: boolean;
  tsconfigRootDir?: string;
  
  // Warnings
  warnOnUnsupportedTypeScriptVersion?: boolean;
}

Core Configuration Types

Type definitions for parser configuration values.

/**
 * Debug level configuration for parser output
 */
type DebugLevel = 
  | boolean 
  | ('eslint' | 'typescript' | 'typescript-eslint')[];

/**
 * Cache duration specification in seconds
 */
type CacheDurationSeconds = number | 'Infinity';

/**
 * ECMAScript version specification
 */
type EcmaVersion =
  | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17
  | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026
  | 'latest'
  | undefined;

/**
 * Source type specification for module resolution
 */
type SourceType = 'commonjs' | SourceTypeClassic;
type SourceTypeClassic = 'module' | 'script';

/**
 * JSDoc parsing mode configuration
 */
type JSDocParsingMode = 'all' | 'none' | 'type-info';

Project Service Configuration

Options for configuring the TypeScript project service.

/**
 * Granular options to configure the project service
 */
interface ProjectServiceOptions {
  /**
   * Globs of files to allow running with the default project compiler options
   * despite not being matched by the project service
   */
  allowDefaultProject?: string[];

  /**
   * Path to a TSConfig to use instead of TypeScript's default project configuration
   * @default 'tsconfig.json'
   */
  defaultProject?: string;

  /**
   * Whether to allow TypeScript plugins as configured in the TSConfig
   */
  loadTypeScriptPlugins?: boolean;

  /**
   * The maximum number of files allowDefaultProject may match.
   * Each file match slows down linting, so if you do need to use this, please
   * file an informative issue on typescript-eslint explaining why - so we can
   * help you avoid using it!
   * @default 8
   */
  maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING?: number;
}

Usage Examples:

import { ParserOptions, DebugLevel, EcmaVersion } from "@typescript-eslint/types";

// Basic parser configuration
const basicConfig: ParserOptions = {
  ecmaVersion: 2022,
  sourceType: "module",
  project: "./tsconfig.json"
};

// Advanced configuration with TypeScript features
const advancedConfig: ParserOptions = {
  ecmaVersion: "latest",
  sourceType: "module",
  project: ["./tsconfig.json", "./packages/*/tsconfig.json"],
  tsconfigRootDir: __dirname,
  
  // TypeScript features
  experimentalDecorators: true,
  emitDecoratorMetadata: true,
  isolatedDeclarations: false,
  
  // JSX configuration
  ecmaFeatures: {
    jsx: true
  },
  jsxPragma: "React",
  jsxFragmentName: "Fragment",
  
  // Library targets
  lib: ["es2022", "dom", "dom.iterable"],
  
  // Debug and error handling
  debugLevel: ["typescript-eslint"],
  errorOnUnknownASTType: true,
  warnOnUnsupportedTypeScriptVersion: false,
  
  // Performance options
  cacheLifetime: {
    glob: 3600 // 1 hour
  }
};

// Project service configuration
const projectServiceConfig: ParserOptions = {
  projectService: {
    allowDefaultProject: ["*.js", "scripts/*.js"],
    defaultProject: "tsconfig.base.json",
    loadTypeScriptPlugins: true,
    maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 16
  },
  tsconfigRootDir: process.cwd()
};

// Multi-project monorepo configuration
const monorepoConfig: ParserOptions = {
  project: [
    "./packages/*/tsconfig.json",
    "./apps/*/tsconfig.json"
  ],
  projectFolderIgnoreList: [
    "**/node_modules/**",
    "**/dist/**",
    "**/build/**"
  ],
  tsconfigRootDir: __dirname
};

Configuration Categories

ECMAScript Configuration

Control which ECMAScript features are available:

  • ecmaVersion: Target ECMAScript version (3, 5, 6-17, 2015-2026, 'latest')
  • sourceType: Module system ('module', 'script', 'commonjs')
  • ecmaFeatures: Additional language features (jsx, globalReturn)

TypeScript Integration

Configure TypeScript-specific parsing behavior:

  • project: TypeScript project configuration files
  • projectService: Advanced project service options
  • tsconfigRootDir: Root directory for tsconfig resolution
  • lib: TypeScript library targets
  • experimentalDecorators: Enable experimental decorator support
  • emitDecoratorMetadata: Include decorator metadata
  • isolatedDeclarations: Enable isolated declarations mode

JSX and React Configuration

Settings for JSX parsing and React integration:

  • jsxPragma: JSX factory function name (default: "React")
  • jsxFragmentName: JSX fragment name (default: "Fragment")
  • ecmaFeatures.jsx: Enable JSX parsing

Debug and Error Handling

Control parser output and error behavior:

  • debugLevel: Enable debug output for specific components
  • errorOnUnknownASTType: Throw errors for unknown AST node types
  • errorOnTypeScriptSyntacticAndSemanticIssues: Handle TypeScript errors
  • warnOnUnsupportedTypeScriptVersion: Version compatibility warnings

Performance and Caching

Options to optimize parser performance:

  • cacheLifetime: Configure glob pattern caching
  • range: Include source range information
  • tokens: Include token information
  • programs: Reuse existing TypeScript programs

Common Configuration Patterns:

// Strict TypeScript project
const strictConfig: ParserOptions = {
  project: true, // Use nearest tsconfig.json
  errorOnTypeScriptSyntacticAndSemanticIssues: true,
  warnOnUnsupportedTypeScriptVersion: true
};

// Legacy JavaScript with some TypeScript features
const legacyConfig: ParserOptions = {
  ecmaVersion: 5,
  sourceType: "script",
  experimentalDecorators: true // Allow decorators in legacy code
};

// Modern full-stack application
const fullStackConfig: ParserOptions = {
  ecmaVersion: "latest",
  sourceType: "module",
  project: ["./src/tsconfig.json", "./server/tsconfig.json"],
  lib: ["es2023", "dom", "node"],
  ecmaFeatures: { jsx: true },
  jsxPragma: "React",
  extraFileExtensions: [".vue", ".svelte"]
};

Install with Tessl CLI

npx tessl i tessl/npm-typescript-eslint--types

docs

ast-node-types.md

index.md

parser-configuration.md

token-types.md

typescript-estree.md

typescript-libraries.md

tile.json