Verify API mode support for compilerOptions overrides implementation #199
+189
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR verifies and documents the existing implementation of API mode support for
compilerOptions
overrides in rslint. The feature allows API consumers to dynamically override TypeScript compiler settings without modifying tsconfig.json files.Implementation Status
The implementation was already complete and fully functional. This PR confirms that all components are working correctly:
Core Features Verified
1. Enhanced API Request Structure
LintRequest
struct ininternal/api/api.go
includesCompilerOptions
fieldmap[string]interface{}
to support various TypeScript compiler option types2. Program Creation with Overrides
CreateProgramWithOverrides
function ininternal/utils/create_program.go
handles override logicCreateProgram
function3. API Handler Integration
HandleLint
function incmd/rslint/api.go
properly uses overridesreq.CompilerOptions
to the program creation function4. Comprehensive Test Coverage
internal/utils/create_program_test.go
validates override functionalityUsage Example
Technical Implementation
The implementation leverages TypeScript-go's existing merging infrastructure:
compilerOptions
are parsed into acore.CompilerOptions
structexistingOptions
toGetParsedCommandLineOfConfigFile
mergeCompilerOptions
ensures API options override config file optionsBenefits
Testing
✅ All existing tests pass
✅ New comprehensive test validates override functionality
✅ End-to-end verification confirms overrides work as expected
✅ Build system and type checking successful
This enhancement makes the API mode more flexible and powerful for programmatic usage while maintaining full backward compatibility.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.