fsprojects / FSharpLint

Lint tool for F#
https://fsprojects.github.io/FSharpLint/
MIT License
300 stars 73 forks source link

Add LintFile method to API layer #663

Open MrLuje opened 6 months ago

MrLuje commented 6 months ago

Branched from #637, so it should be merged first

See https://github.com/mrluje/FSharpLint/compare/9635b9a27a8915d82a94e8eeb7931e9931e1f2b3...MrLuje:FSharpLint:lint_layer diff for relevant changes

WIP on #627:

For reminder, the purpose of the API layer is to abstract away all FCS types so the caller can have a different FCS version than FSharpLint.

I duplicated types from https://github.com/fsprojects/FSharpLint/blob/master/src/FSharpLint.Core/Framework/Suggestion.fs to FSharpLint.Client and prefixed them with Client (eg: SuggestedFix => ClientSuggestedFix) to tell them apart. (I created ClientRange from scratch to avoid the FCS dependency) but that's open to discussion.

type LintFileRequest =
    {
        FilePath: string
        LintConfigPath: string option
    }

For now, the LintFileRequest takes the path to the file to lint and an optional LintConfigPath to a fsharplint.json file but I'm wondering about other scenario :