typify-eslint-rules
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

typify-eslint-rules

Why

This package allows you to generate typescript types for any ESLint rules based on their meta schema

Install

Using pnpm:

pnpm install 

Using npm:

npm install 

Usage

import { typify } from 'typify-eslint-rules'

import tsPlugin from '@typescript-eslint/eslint-plugin'

const { rules: tsRules } = tsPlugin

await typify(tsRules, {
  distFolder: 'dist'
})

This will generate types for @typescript-eslint/eslint-plugin and place them in dist/rules folder, which are exported in dist/index.d.ts file under RuleOptions type:

// dist/index.d.ts

import type { AdjacentOverloadSignatures } from './rules/adjacent-overload-signatures'
// ... more imports

export type RuleOptions = {
  'adjacent-overload-signatures': AdjacentOverloadSignatures,
  // ... more rules
}

You can also provide an optional prefix:

// ...

await typify(tsRules, {
  distFolder: 'dist',
  rulesPrefix: 'ts/'
})

That prefix will be added to all rules:

// dist/index.d.ts

import type { AdjacentOverloadSignatures } from './rules/adjacent-overload-signatures'
// ... more imports

export type RuleOptions = {
  'ts/adjacent-overload-signatures': AdjacentOverloadSignatures,
  // ... more rules
}

You can also use compileRule and compileSchema to compile a sole rule or a sole schema.

Readme

Keywords

Package Sidebar

Install

npm i typify-eslint-rules

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

19 kB

Total Files

7

Last publish

Collaborators

  • datismoa