According to the FSharpLint documentation, on the command line, you can specify the config file via --lint-config
.
Since the tool comes integrated into Ionide, I was expecting some means of specifying the config file in that extension's settings. However, the only setting that's documented is FSharp.Linter
, which lets you turn the linter on or off.
Is there really no way to configure FSharpLint in Ionide?
Here's a step-by-step example based on Koenig Lear's answer.
I have a codebase where some functions have underscores in the name. This was showing up as a linter issue:
Note that the rule code is FL0049
.
The rule list is here:
https://fsprojects.github.io/FSharpLint/how-tos/rule-configuration.html
If I click on the rule for FL0049, we're taken to the following page:
https://fsprojects.github.io/FSharpLint/how-tos/rules/FL0049.html
We're shown an example of how to configure this rule:
{
"publicValuesNames": {
"enabled": true,
"config": {
"underscores": "AllowPrefix"
}
}
}
I see in the notes that underscores
can be set to AllowAny
.
I create an fsharplint.json
file in my project root directory with the following contents:
{
"conventions": {
"naming": {
"publicValuesNames": {
"enabled": true,
"config": {
"underscores": "AllowAny"
}
}
}
}
}
I close the my F# code file, re-open it, and the squigglies are gone. :-)