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
export default {
files: ["**/*.?([cm])tsx", "**/*.?([cm])ts"],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"sort-destructure-keys-typescript": sortDestructureKeysPlugin,
},
rules: {
"sort-destructure-keys-typescript/sort-destructure-keys-by-type": "error",
},
};
MIT License © 2024-PRESENT Nir Tamir
- https://github.com/antfu/eslint-plugin-antfu for starter project
- https://github.com/mthadley/eslint-plugin-sort-destructure-keys - for ordering