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.
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
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:
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
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:
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
Rules can be configured or even 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:
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.rules: (rulesOptions:PluginRulesOptions<[Rule<{
readonly description:"Reports calling a function with a value typed as `any` as an argument.";
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly preset: "stylistic"; }, MarkdownNodesByName, MarkdownFileServices, "bareUrl", undefined>, ...12 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports bare URLs that should be formatted as autolinks or links."; readonly id: "bareUrls"; readonly preset: "stylistic"; }, MarkdownNodesByName, MarkdownFileServices, "bareUrl", undefined>, ...12 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic">
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.files: Record<"all", FilesValue>
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
Plugin<RuleAbout, "all", [Rule<{ readonly description: "Reports calling a function with a value typed as `any` as an argument."; readonly id: "anyArguments"; readonly preset: "logical"; }, TypeScriptNodesByName, TypeScriptFileServices, "unsafeArgument"|...1 more ...|"unsafeTupleSpread", undefined>, ...63 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical"|"stylistic"|"untyped">
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.