GitHub - LBognanni/slopocop: eradicating slop from your typescript codebase

GitHub

4 min read Original article ↗

A standalone CLI that polices slop signals in TypeScript code. Requires Node 22+.

slopocop embeds ESLint as a library and runs only its own rules with a config it fully controls. It ignores any eslint.config.* / .eslintrc* in the target repo, so that findings never depend on a specific ESLint setup, and it works in repos with no ESLint at all. It only lints TypeScript and tsx files; everything else is skipped.

Setup

Slopocop is published to npm. You can install it globally with npm install -g slopocop or simply run it with npx slopocop.

I recommend cloning the repo locally, so you can edit the code and add your own rules. Then run

This installs dependencies, builds the CLI, and npm links it, making slopocop available globally on your machine. Rebuilding (npm run build) after future changes takes effect immediately since it's a symlink.

Usage

slopocop [options] [files/dirs...]

With no arguments it lints the current directory. All rules are on by default — there's no config file to write; tweak behavior with flags.

Top tip

Instruct your agent to run slopocop on the changed files before committing, in addition to linting and running tests.

Options

Flag Notes
--rule <name> Restrict to this rule (repeatable)
--ignore-pattern <glob> Add a glob to the default ignores (repeatable)
--type-aware Enable the TypeScript type checker
--project <path> tsconfig path to use with --type-aware
--format <name> Output formatter (default: stylish)
--llm Compact output for an AI agent, grouped by file/rule (overrides --format)
--fix Automatically fix problems
--quiet Report errors only
--help Show the help message
--version Show the installed version

Rules are syntax-only by default and need no type checker. --type-aware is an opt-in for rules that do need type information; it has no effect on rules that don't use it.

--llm output format

A summary line (file/rule/problem counts), then each triggered rule listed once as a markdown ### <rule> (<severity>) heading followed by its explanation, then per file a <rule>: <line>, <line>, ... line listing the comma-separated line numbers it fired on — no column numbers, no repeated line per violation. The summary line repeats at the end, so an agent that only reads the tail of the output still gets the counts.

Rules

Rule Description
no-long-comment-lines Disallow comment lines that exceed a maximum length
no-single-caller-function Disallow functions that have exactly one caller which itself invokes no other local function
no-huge-comment-blocks Disallow comment blocks that span more lines than a maximum
no-likely-slop-language Disallow comments containing phrasing characteristic of LLM-generated text
no-import-then-export Disallow re-exporting a binding that comes from another module, whether imported then exported or re-exported directly (export ... from, export *); exempts barrel files whose entire body is re-exports
max-file-lines-warn Warn when a file exceeds 500 lines (doesn't fail the run)
max-file-lines-error Error when a file exceeds 750 lines
no-unused-vars Disallow unused variables, functions, and imports (@typescript-eslint's TS-aware version, reused as-is)

Default ignores

**/node_modules/**
**/dist/**
**/lib/**
**/build/**
**/*.d.ts

Add more with --ignore-pattern.

FAQ

Why didn't you just make this an ESLint plugin?

Some of my projects use eslint 8, some use 9, some use Deno, some use no ESLint at all.

Life is too short to configure a plugin in 47 different ways. I just want to tell my agent "run slopocop on the changed files before committing" and have it work everywhere.

Slopocop is missing $rule!

When you clone this repo, make it yours. Any coding agent will pretty much one-shot any rule you can describe. The src/rules/index.ts file is the single source of truth for the rule set; add your rule there and it will be picked up by the CLI.

How do I contribute a new rule?

By all means open an issue. I'll add the rule if I think it's valuable, but I don't want to maintain a plugin with 47 rules.

btw

Not affiliated with slopcop the npm package, which is a different project.