FloEdelmann / vue-ts-types

Lightweight TypeScript-first Vue prop type definitions
MIT License
7 stars 3 forks source link

Create ESLint plugin #322

Open FloEdelmann opened 1 year ago

FloEdelmann commented 1 year ago

Package name: eslint-plugin-vue-ts-types

Possible rules:

vue-ts-types/no-any-prop

Reports use of anyProp.

vue-ts-types/prefer-array-prop

Reports objectProp<User[]> and suggests arrayProp<User> instead.

vue-ts-types/prefer-one-of-prop

Reports stringProp<'a' | 'b'> and numberProp<1 | 2> and suggests oneOfProp(['a', 'b'] as const) etc. instead.

vue-ts-types/require-one-of-prop-as-const

Reports use of oneOfProp([…]) without as const.

vue-ts-types/require-type-parameter

Reports use of prop functions without type parameter (by default only for arrayProp, objectProp, functionProp and oneOfTypesProp, but others can be configured).

vue-ts-types/require-vue-ts-types

Reports where vue-ts-types is not used (but should); autofix would be very helpful.

FloEdelmann commented 1 year ago

Possibly helpful references:

jhoermann commented 1 year ago

@FloEdelmann Better create a sub-package in the same monorepo. Maybe even scoped like @vue-ts-types/eslint-plugin.