Sorting Plugin
Rules that automatically sort any and all possible aspects of code alphabetically, such as imports and properties.
This plugin is provided in a standalone @flint.fyi/plugin-sorting npm package.
npm install @flint.fyi/plugin-sortingbun install @flint.fyi/plugin-sortingdeno install @flint.fyi/plugin-sortingpnpm install @flint.fyi/plugin-sortingyarn install @flint.fyi/plugin-sortingFlint’s sorting plugin includes rules that automatically sort any and all possible aspects of code alphabetically, such as imports and properties.
It comes provided with the flint npm package.
Presets
Section titled “Presets”Flint’s sorting plugin provides the following preset:
| Preset | Recommended | Description |
|---|---|---|
stylistic | ✅ Always | Common rules sorting various aspects of code. |
Flint recommends using the stylistic preset:
import { import sorting
sorting } from "@flint.fyi/sorting";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig } 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: import sorting
sorting.any
files.any
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: [import sorting
sorting.any
presets.any
stylistic], }, ],});stylistic
Section titled “stylistic”Rules that sort code in most-to-all common web files. This will include, tentatively, all files supported by other core Flint plugins: JavaScript/TypeScript, Markdown, and YAML.
import { import sorting
sorting } from "@flint.fyi/sorting";import { function defineConfig(definition: ConfigDefinition): Config
Defines a new linter configuration for a Flint config file.
defineConfig } 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: import sorting
sorting.any
files.any
all, ConfigUseDefinition.rules: AnyLevelDeep<ConfigRuleDefinition>
Any number of rules and/or presets of rules to enable for those files.
rules: import sorting
sorting.any
presets.any
stylistic, }, ],});Implemented: 0 of 23 (0%)
| Flint Rule | Preset |
|---|---|
classes | stylistic |
decorators | stylistic |
exports | stylistic |
heritageClauses | stylistic |
interfaces | stylistic |
intersectionTypes | stylistic |
jsdocTags | stylistic |
jsonKeys | stylistic |
jsxProps | stylistic |
maps | stylistic |
modules | stylistic |
objects | stylistic |
objectTypes | stylistic |
packageCollections | stylistic |
regexFlags | stylistic |
regexLists | stylistic |
sets | stylistic |
switchCases | stylistic |
typeConstituents | stylistic |
unionTypes | stylistic |
variableDeclarations | stylistic |
yamlSequenceValues | stylistic |
yamlKeys | (none) |
Selectors
Section titled “Selectors”Flint’s sorting plugin will tentatively provide the following file selector:
all:**/*.{cjs,js,json,jsx,mjs,md,ts,tsx,yaml,yml}