Go Back to projects

eslint-utils

ESlint utilities

📦 Installation

npm install @luxass/eslint-utils

📚 Usage

import { createESLintRuleBuilder, createEslintRule } from "@luxass/eslint-utils";

const createESLintRule = createEslintRuleBuilder("https://github.com/luxass/eslint-plugin-overdrive/blob/main/src/rules/$RULE_NAME.md");

const preferNothing = createESLintRule<[], "preferNothing">({
  name: "preferNothing",
  meta: {
    type: "suggestion",
    docs: {
      description: "Prefer nothing",
      recommended: "error",
    },
    schema: [],
  },
  defaultOptions: [],
  create(context) {
    return {
      Program(node) {
        context.report({
          node,
          messageId: "preferNothing",
        });
      },
    };
  },
  messages: {
    preferNothing: "Prefer nothing",
  },
});
// the rule will now have the following docs url "https://github.com/luxass/eslint-plugin-overdrive/blob/main/src/rules/prefer-nothing.md"

📄 License

Published under MIT License.