cletusw / eslint-plugin-local-rules

A plugin for ESLint that allows you to use project-specific rules
MIT License
158 stars 9 forks source link

Typescript example #19

Closed RobinTail closed 1 year ago

RobinTail commented 1 year ago

Please add an example for Typescript developers to Readme.

Originally posted by @RobinTail in https://github.com/cletusw/eslint-plugin-local-rules/issues/13#issuecomment-1612216315

// eslint-local-rules/index.js
require("ts-node").register({ transpileOnly: true });
module.exports = require("./rules").default;
// eslint-local-rules/rules.ts
import { Rule } from "eslint";

export default {
  "my-rule": {
    meta: {
      // ...
    },
    create: (context) => ({
      // ...
    }),
  },
} satisfies Record<string, Rule.RuleModule>;