Skip to content

Package

eslint-plugin v0.5.1

Changelog

seedcordseedcord

The whole Discord bot, typed end to end

Website · Guide · Reference · Discord

npm node bun license

About

@seedcord/eslint-plugin has the ESLint rules for seedcord bots. Each one catches a seedcord mistake that still compiles, like a handler with no route decorator, which never registers. Its seedcord preset also turns on eslint-plugin-discordjs's recommended rules.

Install it in a seedcord bot that has its own ESLint config. A bot on @seedcord/eslint-config already has it, through registerSeedcordPlugin.

seedcord is pre-1.0, so a minor version can break your lint setup. Each release's changelog says what changed and how to update.

Installation

pnpm add -D @seedcord/eslint-plugin

Usage

// eslint.config.js
import { defineConfig } from 'eslint/config';
import seedcord from '@seedcord/eslint-plugin';
import tseslint from 'typescript-eslint';

export default defineConfig(
    // ...your existing config
    {
        files: ['**/*.ts'],
        extends: [seedcord.configs.seedcord],
        languageOptions: {
            parser: tseslint.parser,
            parserOptions: {
                projectService: true,
                tsconfigRootDir: import.meta.dirname
            }
        }
    }
);

The rules read types, so they need typed linting (projectService). If your config already sets it up, leave out the languageOptions block.

Rules

Every rule runs at error in the preset.

Rule Catches
command-builder-missing-register-command a command builder without @RegisterCommand, which never deploys
interaction-handler-missing-route an interaction handler without its route decorator, which never runs
event-handler-missing-register-event an event handler without @RegisterEvent, which never runs
middleware-missing-register-decorator a middleware without its register decorator, or with the other kind's
subscriber-missing-decorators a subscriber without @Subscribe, or a webhook log without @WebhookUrl
no-djs-builder-import a component builder imported from discord.js. Import it from @discordjs/builders
no-raw-client-events a client.on() listener for a gateway event, which skips @RegisterEvent and its middleware
no-raw-interaction-acks this.event.reply() and the other discord.js replies inside a handler, which skip seedcord's reply tracking
use-custom-id-codec a hand-written string in setCustomId
use-paint-in-logs chalk inside a logger call