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-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 { sorting } from "@flint.fyi/sorting";import { defineConfig } from "flint";
export default defineConfig({ use: [ { files: sorting.files.all, rules: [sorting.presets.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 { sorting } from "@flint.fyi/sorting";import { defineConfig } from "flint";
export default defineConfig({ use: [ { files: sorting.files.all, rules: sorting.presets.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 |
yamlKeys | stylistic |
yamlSequenceValues | stylistic |
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}
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.