YAML Plugin
Rules for linting .yaml/.yml files containing arbitrary data in the Yet Another Markup Language (YAML) format.
This plugin comes packaged with the flint npm package.
Presets
Section titled “Presets”Flint’s YAML plugin provides the following presets:
| Preset | Recommended | Description |
|---|---|---|
logical | ✅ Always | Common rules for finding bugs and enforcing good logical practices in YAML files. |
logicalStrict | ☑️ When Ready | Additional rules for finding bugs and enforcing good logical practices in YAML files. |
stylistic | ✅ Always | Common rules for consistent styling and best stylistic practices in YAML files. |
stylisticStrict | ☑️ When Ready | Additional rules for consistent styling and best stylistic practices in YAML files. |
If you are just getting started with linting, Flint recommends using the logical and stylistic presets:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml } 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.stylistic: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylistic], }, ],});If you are experienced with both YAML and linting, Flint recommends using the logicalStrict and stylisticStrict presets:
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml } 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.logicalStrict: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logicalStrict, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.stylisticStrict: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylisticStrict], }, ],});logical
Section titled “logical”Rules that find bugs and enforce good YAML practices for most-to-all YAML files.
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml } 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.logical: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logical, }, ],});logicalStrict
Section titled “logicalStrict”Additional logical rules that enforce best practices which are not always straightforward to implement. These rules are recommended for projects where a majority of developers are experienced with both YAML and using a linter.
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml } 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.logicalStrict: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
logicalStrict, }, ],});This preset’s rules are a superset of those in logical.
stylistic
Section titled “stylistic”Rules that enforce consistent styling and best stylistic practices for most-to-all YAML files.
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml } 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.stylistic: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylistic, }, ],});stylisticStrict
Section titled “stylisticStrict”Additional stylistic rules that enforce best practices which are not always straightforward to implement. These rules are recommended for projects where a majority of developers are experienced with both YAML and using a linter.
import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig, const yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml } 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 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 yaml: Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "preferBlock", AnyOptionalSchema>, Rule<{ readonly description: "Prefer block style sequences over flow style sequences."; readonly id: "blockSequences"; readonly presets: ["stylistic", "stylisticStrict"];} & { presets?: ("logical" | "logicalStrict" | "stylistic" | "stylisticStrict")[]; url: string;}, object, object, "flowSequence", AnyOptionalSchema>, ... 6 more ..., Rule<...>]>
yaml.Plugin<RuleAbout, "all", [Rule<{ readonly description: "Prefer block-style mappings over flow-style mappings."; readonly id: "blockMappings"; readonly presets: ["stylistic", "stylisticStrict"]; } & { ...; }, object, object, "preferBlock", AnyOptionalSchema>, ... 7 more ..., Rule<...>]>.presets: PluginPresets<RuleAbout, "logical" | "logicalStrict" | "stylistic" | "stylisticStrict">
Preset lists of rules to enable on files.
presets.stylisticStrict: Rule<RuleAbout, object, object, string, AnyOptionalSchema | undefined>[]
stylisticStrict, }, ],});This preset’s rules are a superset of those in stylistic.
Implemented: 9 of 11 (81.8%)
| Flint Rule | Preset |
|---|---|
emptyDocumentsReports empty YAML documents that contain only document markers. | logical |
emptyMappingKeysReports empty mapping keys. | logical |
emptyMappingValuesReports empty mapping values. | logical |
emptySequenceEntriesReports empty sequence entries. | logical |
stringMappingKeysEnforces mapping keys to be strings. | logical (strict) |
blockMappingsPrefer block-style mappings over flow-style mappings. | stylistic |
blockSequencesPrefer block style sequences over flow style sequences. | stylistic |
irregularWhitespace | stylistic |
fileExtensions | stylistic (strict) |
numericTrailingZerosReports trailing zeros in numeric values. | stylistic (strict) |
plainScalarsPrefer plain style scalars over quoted scalars. | stylistic (strict) |
Selectors
Section titled “Selectors”Flint’s YAML plugin provides the following file selector:
all:**/*.{yaml,yml}