ESLint plugin rules to sort destructure keys by TypeScript type order.
This rule requires parserServices
to be generated.
You must therefore provide a value for the parserOptions.project
property for @typescript-eslint/parser
.
pnpm add -D eslint-plugin-sort-destructure-keys-typescript
Add to your eslint.config.js
import typescriptEslintParser from "@typescript-eslint/parser";
import sortDestructureKeysConfig from "eslint-plugin-sort-destructure-keys-typescript/config";
export default [
// other settings...
{
// set up typescript-eslint
languageOptions: {
parser: typescriptEslintParser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
sortDestructureKeysConfig(),
];
MIT License © 2024-PRESENT Nir Tamir
- https://github.com/antfu/eslint-plugin-antfu for a starter project
- https://github.com/antfu/eslint-plugin-command for a starter project
- https://github.com/JoshuaKGoldberg/eslint-plugin-package-json for a starter project
- https://github.com/mthadley/eslint-plugin-sort-destructure-keys - for ordering