About
Flint’s YML plugin supports linting .yaml
/.yml
source code.
It comes provided with the flint
npm package.
Presets
Section titled “Presets”Flint’s YML plugin provides the following presets:
Preset | Recommended | Description |
---|---|---|
logical | ✅ Always | Common rules for finding bugs and enforcing good logical practices in YML files. |
logicalStrict | ☑️ When Ready | Additional rules for finding bugs and enforcing good logical practices in YML files. |
stylistic | ✅ Always | Common rules for consistent styling and best stylistic practices in YML files. |
stylisticStrict | ☑️ When Ready | Additional rules for consistent styling and best stylistic practices in YML files. |
If you are just getting started with linting, Flint recommends using the logical
and stylistic
presets:
import { defineConfig, yml } from "flint";
export default defineConfig({ use: [ { files: yml.files.all, rules: [yml.presets.logical, yml.presets.stylistic], }, ],});
If you are experienced with both YML and linting, Flint recommends using the logicalStrict
and stylisticStrict
presets:
import { defineConfig, yml } from "flint";
export default defineConfig({ use: [ { files: yml.files.all, rules: [yml.presets.logicalStrict, yml.presets.stylisticStrict], }, ],});
logical
Section titled “logical”Rules that find bugs and enforce good YML practices for most-to-all YML files.
import { defineConfig, yml } from "flint";
export default defineConfig({ use: [ { files: yml.files.all, rules: yml.presets.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 YML and using a linter.
import { defineConfig, yml } from "flint";
export default defineConfig({ use: [ { files: yml.files.all, rules: yml.presets.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 YML files.
import { defineConfig, yml } from "flint";
export default defineConfig({ use: [ { files: yml.files.all, rules: yml.presets.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 YML and using a linter.
import { defineConfig, yml } from "flint";
export default defineConfig({ use: [ { files: yml.files.all, rules: yml.presets.stylisticStrict, }, ],});
This preset’s rules are a superset of those in stylistic
.
Implemented: 1 of 11 (9%)
Flint Name | Preset | Biome Rule(s) | Deno Lint Rule(s) | ESLint Rule(s) | Oxlint Rule(s) |
---|---|---|---|---|---|
emptyDocuments | Logical | yml/no-empty-document | |||
emptyMappingKeys | Logical | yml/no-empty-key | |||
emptyMappingValues | Logical | yml/no-empty-mapping-value | |||
emptySequenceEntries | Logical | yml/no-empty-sequence-entry | |||
stringMappingKeys | Logical (Strict) | yml/require-string-key | |||
blockMappings | Stylistic | yml/block-mapping | |||
blockSequences | Stylistic | yml/block-sequence | |||
irregularWhitespace | Stylistic | yml/no-irregular-whitespace | |||
fileExtensions | Stylistic (Strict) | yml/file-extension | |||
numericTrailingZeros | Stylistic (Strict) | yml/no-trailing-zeros | |||
plainScalars | Stylistic (Strict) | yml/plain-scalar |
Selectors
Section titled “Selectors”Flint’s YAML plugin provides the following file selector:
all
:**/*.{yaml,yml}