Skip to content

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.

Terminal window
npm install @flint.fyi/plugin-sorting

Flint’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.

Flint’s sorting plugin provides the following preset:

PresetRecommendedDescription
stylistic✅ AlwaysCommon rules sorting various aspects of code.

Flint recommends using the stylistic preset:

flint.config.ts
import { sorting } from "@flint.fyi/sorting";
import { defineConfig } from "flint";
export default defineConfig({
use: [
{
files: sorting.files.all,
rules: [sorting.presets.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.

flint.config.ts
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 RulePreset
classesstylistic
decoratorsstylistic
exportsstylistic
heritageClausesstylistic
interfacesstylistic
intersectionTypesstylistic
jsdocTagsstylistic
jsonKeysstylistic
jsxPropsstylistic
mapsstylistic
modulesstylistic
objectsstylistic
objectTypesstylistic
packageCollectionsstylistic
regexFlagsstylistic
regexListsstylistic
setsstylistic
switchCasesstylistic
typeConstituentsstylistic
unionTypesstylistic
variableDeclarationsstylistic
yamlKeysstylistic
yamlSequenceValuesstylistic

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.