denoland / deno_lint

Blazing fast linter for JavaScript and TypeScript written in Rust
https://lint.deno.land/
MIT License
1.51k stars 163 forks source link

refactor: `Context` needs to be split up #1217

Closed bartlomieju closed 6 months ago

bartlomieju commented 6 months ago

Currently Linter::lint_program does too much - it is meant to lint a single file. However it also creates Context, filters the diagnostics and returns them.

Instead this method should take a &mut FileContext , run any necessary rules and return. FileContext should contain Arc<Mutex<LintContext>> and have relevant method that would add diagnostics to the LintContext. Then filtering should be done in by the caller.

This is a prerequisite for a plugin system.