azat-io / eslint-plugin-perfectionist

🦄 ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
https://eslint-plugin-perfectionist.azat.io
MIT License
1.66k stars 30 forks source link

Feature: Add zod `z.enum` support to `sort-enums` #82

Open Pyrolistical opened 8 months ago

Pyrolistical commented 8 months ago

What rule do you want to change?

sort-enums

Describe the problem

Zod is a very popular TypeScript schema validation library.

Zod allows you to define an enums using an array of strings z.enum. This array of strings should be sorted by sort-enums

Code example

import {z} from 'zod';
const SomeEnum = z.enum(["B", "C", "A"]); // this array can be sorted
type SomeEnum = z.infer<typeof SomeEnum>;
// 'B' | 'C' | 'A'

Additional comments

No response

Validations