Skip to main content

A collection of ESLint utilities

Works with
This package works with Bun
This package works with Node.js
This package works with Deno
JSR Score
100%
Published
2 months ago (0.0.5)

eslint-utils

npm version npm downloads

A small utility to create ESLint rules

📦 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.

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @luxass/eslint-utils

Import symbol

import * as mod from "@luxass/eslint-utils";

Add Package

npx jsr add @luxass/eslint-utils

Import symbol

import * as mod from "@luxass/eslint-utils";

Add Package

yarn dlx jsr add @luxass/eslint-utils

Import symbol

import * as mod from "@luxass/eslint-utils";

Add Package

pnpm dlx jsr add @luxass/eslint-utils

Import symbol

import * as mod from "@luxass/eslint-utils";

Add Package

bunx jsr add @luxass/eslint-utils

Import symbol

import * as mod from "@luxass/eslint-utils";