Configuration
Linting with Flint must be configured by at least one flint.config.* configuration file, in the root of a repository to be linted.
That file may be any extension recognized by your version of Node.js.
Flint configs must default-export the result of calling the defineConfig function imported from the flint package.
flint also exports a globs object for common file globs, as well as objects for each of the core plugins.
defineConfig
Section titled “defineConfig”Defines a new configuration for linting.
It takes in an object with one required property, use:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, ],});ignore
Section titled “ignore”A list of glob patterns to ignore from linting.
This can be a string, any level deep array of strings, or an object containing exclude and include.
ignore by default includes all patterns defined in a .gitignore file, if it exists.
This ignore directive ignores all files under src/legacy/:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.ignore?: string[]
A list of glob patterns to ignore from linting.
ignore by default includes all patterns defined in a .gitignore file, if it exists.
ignore: ["src/legacy/**/*"], ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, ],});The only required object property to pass to defineConfig is use, an array of definitions containing two properties:
files: glob pattern(s) describing which file(s) to lintrules: any number of rules to enable for those files
Any number of glob pattern(s) describing file(s) to lint.
This can be a string, any level deep array of strings, or an object containing exclude and include.
For example, this files selector matches all TypeScript test files by extension and in a directory:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: ["src/**/*.test.*.ts", "test/**/*.ts"], ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, ],});See the Node.js file system glob documentation for details on glob patterns.
exclude and include
Section titled “exclude and include”In addition to plain strings, files selectors can also be objects with two properties:
exclude: glob pattern(s) to not include in the files groupinclude: glob pattern(s) to include in the files group
For example, this files selector matches all TypeScript source files that don’t have a *.test.* extension:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: { FilesGlobObject.exclude: AnyLevelDeep<FilesValue>
Any number of glob(s) for files to exclude from the include definition.
exclude: "**/*.test.*", FilesGlobObject.include: AnyLevelDeep<FilesValue>
Any number of glob(s) for files to add to what the config selects.
include: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, }, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, ],});Any number of rule(s) to enable on the corresponding files.
These may be arrays of rules, such as from presets exported by plugins, and/or calls to plugin rules themselves.
For example, this rules entry enables all the recommended logical and stylistic TypeScript rules:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.stylistic: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylistic], }, ],});Configuring Rules
Section titled “Configuring Rules”Rules can be configured or disabled by calling to the rules method of their plugin.
That method takes in an object where the keys are rule names and values are what to do with the rule:
true: enable it (if it wasn’t already)false: disable it (if it was previously enabled)- Object containing options: enable it with those options
For example, this rules entry disables one rule and reconfigures another:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [ const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "stylistic" | "stylisticStrict" | "logical" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.stylistic: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylistic, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.rules: (rulesOptions: PluginRulesOptions<[Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>) => [...]
Defines rules to configure or disable on files in a config.
rules({ debuggerStatements?: boolean | Record<string, unknown> | undefined
debuggerStatements: false, namespaceDeclarations?: boolean | { allowDeclarations?: boolean | undefined; allowDefinitionFiles?: boolean | undefined;} | undefined
namespaceDeclarations: { allowDeclarations?: boolean | undefined
allowDeclarations: true, }, }), ], }, ],});A helper object containing file selectors with dynamic computed values.
Currently it contains only one selector, all.
Includes all files previously selected by the configuration.
For example, this config enables the spelling plugin on all files that are being linted, which includes multiple languages:
import { const spelling: Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Runs the CSpell spell checker on any source code file."; readonly id: "cspell"; readonly presets: ["logical"];} & { presets?: "logical"[]; url: string;}, object, object, "issue" | "issueWithReplacement", AnyOptionalSchema>]>
spelling } from "@flint.fyi/spelling";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const globs: { all: FilesComputer;}
globs, const md: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "bareUrl", AnyOptionalSchema>, Rule<{ readonly description: "Reports definitions with empty URLs or only empty fragments."; readonly id: "definitionContents"; readonly presets: ["logical"];} & { ...;}, object, object, "emptyDefinition", AnyOptionalSchema>, ... 13 more ..., Rule<...>]>
md, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts } from "flint";
export default function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig({ ConfigDefinition.use: ConfigUseDefinition[]
Specifies the files to be linted alongside the rules and settings to lint with.
use: [ { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const md: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "bareUrl", AnyOptionalSchema>, Rule<{ readonly description: "Reports definitions with empty URLs or only empty fragments."; readonly id: "definitionContents"; readonly presets: ["logical"];} & { ...;}, object, object, "emptyDefinition", AnyOptionalSchema>, ... 13 more ..., Rule<...>]>
md.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "bareUrl", AnyOptionalSchema>, ... 14 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const md: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "bareUrl", AnyOptionalSchema>, Rule<{ readonly description: "Reports definitions with empty URLs or only empty fragments."; readonly id: "definitionContents"; readonly presets: ["logical"];} & { ...;}, object, object, "emptyDefinition", AnyOptionalSchema>, ... 13 more ..., Rule<...>]>
md.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "bareUrl", AnyOptionalSchema>, ... 14 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "stylistic" | "stylisticStrict" | "logicalStrict">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Selectors of files this plugin suggests applying its rules to.
files.all: FilesValue
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "stylistic" | "stylisticStrict" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, const ts: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict" | "untyped")[]; url: string;}, object, object, "notGrouped", AnyOptionalSchema>, Rule<{ readonly description: "Reports mismatched types between getter and setter accessor pairs."; readonly id: "accessorPairTypes"; readonly presets: ["logical", "logicalStrict"];} & { ...;}, object, object, "mismatchedTypes", AnyOptionalSchema>, ... 284 more ..., Rule<...>]>
ts.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports getter and setter accessors for the same property that are not adjacent."; readonly id: "accessorPairGroups"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "notGrouped", AnyOptionalSchema>, ... 285 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "stylistic" | "stylisticStrict" | "logicalStrict" | "untyped">
Preset lists of rules to enable on files.
presets.stylistic: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylistic], }, { ConfigUseDefinition.files: AnyLevelDeep<FilesValue>
A list of glob patterns describing which file(s) to lint.
files: const globs: { all: FilesComputer;}
globs.all: FilesComputer
Selects all files included (and not excluded) by past config definitions.
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: const spelling: Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Runs the CSpell spell checker on any source code file."; readonly id: "cspell"; readonly presets: ["logical"];} & { presets?: "logical"[]; url: string;}, object, object, "issue" | "issueWithReplacement", AnyOptionalSchema>]>
spelling.Plugin<RuleAbout, string | undefined, [Rule<{ readonly description: "Runs the CSpell spell checker on any source code file."; readonly id: "cspell"; readonly presets: ["logical"]; } & { ...; }, object, object, "issue" | "issueWithReplacement", AnyOptionalSchema>]>.presets: PluginPresets<RuleAbout, "logical">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, ],});Inline Directives
Section titled “Inline Directives”You can also disable specific rules inline in your code using comment directives. This is useful when you need to suppress a rule for a specific line, block, or file.