CodeVetter · Repo Unpack · Data flow
typescript-eslint/typescript-eslint
Configuration enters through exported presets and parser options, then determines how source text acquires a TypeScript AST and optional Program. Conversion and scope analysis produce the structures ESLint rules consume. Compiler services translate ESTree nodes back to TypeScript nodes for typed queries. The playground follows a parallel browser path through a virtual filesystem, with URL and local-storage state at its persistence boundary.
- Flat base configuration installs the parser and @typescript-eslint plugin with module sourceType; preset getters additionally record candidate tsconfig roots inferred from the caller’s stack.
- createParseSettings converts input to full text, infers single-run mode, validates an explicit absolute tsconfigRootDir, and resolves the input filename against that root.
- getProgramAndAST tries project-service first, then supplied Programs, then standalone parsing without type information, and finally watched legacy project Programs.
- astConverter rejects the first fundamental parse diagnostic, invokes Converter.convertProgram, optionally strips locations/ranges, and attaches requested token and comment arrays.
- Converter owns bidirectional WeakMaps; createParserServices returns maps even without a Program and, with a Program, translates ESTree nodes into checker calls for types, symbols, signatures, and contextual types.
- analyze creates ScopeManager and Referencer, then visits the AST; Referencer combines library definitions’ type/value flags and defines an implicit type-only const binding.
- Playground files live in a Map seeded with /.eslintrc, /tsconfig.json, and optional /input content; changed writes notify matching debounced watchers, which drive linter.verify and diagnostic events.
- useHashState merges defaults, local preferences, and URL state in that order; updates save preferences and replace the hash with compressed code/configuration, reloading the page when cfg.ts is provided.