linter
Run code lints, validate syntax, or apply LLM-powered fixes to improve code quality and catch errors in your projects.
Instructions
Run lints, syntax validation, or LLM-assisted lint fixes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Action: run (check only), fix (LLM-powered fixes), validate (syntax check) | |
| files | No | Specific files to process | |
| command | No | Custom lint command (for run action) | |
| autoFix | No | Apply linter auto-fixes without LLM (for run action) | |
| difficulty | No | LLM fix difficulty level (for fix action) | |
| dryRun | No | Preview fixes without applying (for fix action) | |
| maxFixes | No | Maximum fixes to apply (for fix action) | |
| content | No | Content to validate (for validate action, optional) | |
| timeout | No | Timeout in milliseconds |
Implementation Reference
- src/tools/execution.ts:427-464 (handler)The `runLinter` method in `ExecutionTools` class handles the execution of linting commands, supporting auto-detection and custom commands.
async runLinter(options?: { command?: string; files?: string[]; fix?: boolean; timeout?: number; }): Promise<ExecutionResult> { let command = options?.command; if (!command) { command = await this.detectLintCommand(); if (!command) { return { success: false, exitCode: -1, stdout: '', stderr: 'Could not detect linter. Please provide a lint command.', duration: 0, command: '', }; } } // Add fix flag if requested (ESLint style) if (options?.fix && command.includes('eslint')) { command = command.replace('eslint', 'eslint --fix'); } // Append specific files if provided if (options?.files && options.files.length > 0) { command = `${command} ${options.files.join(' ')}`; } return this.executeCommand( command, this.workspaceRoot, options?.timeout ?? this.defaultTimeout ); }