navigation

Rule Configuration

Creating a Configuration File

The linter by default looks for a file named fsharplint.json in the current working directory. Typically you would have this file in the root of your project.

At this moment in time the configuration requires every rule to be added to your file, rather than a typical approach where you would override just the rules you want to change from their defaults. This will be addressed in a future version see: Issue #488.

Check out the default configuration that the tool comes with to see all possible settings and their default values.

Global Configuration

In addition to the configuration available for each rule, there are some settings which are defined globally to maintain consistency across multiple rules. These are defind in the globals object in the base of the configuration file. The rule pages below point out any global setting that each rule depends on. The config is as follows, but can be completely omitted to use defaults:

{
  "globals": {
    "numIndentationSpaces": 4 // number of spaces used for indentation
  }
}

Ignoring Files

In the configuration file paths can be used to specify files that should be included, globs are used to match wildcard directories and files. For example the following will match all files with the file name assemblyinfo (the matching is case insensitive) with any extension:

{ "ignoreFiles": ["assemblyinfo.*"] }
  • Directories in the path must be separated using /
  • If the path ends with a / then everything inside of a matching directory shall be excluded.
  • If the path does not end with a / then all matching files are excluded.

Rule List

The following rules can be specified for linting.