Slopocop: ESLint for TypeScript Slop

lorisdev1 pts1 comments

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

/" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

LBognanni

slopocop

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>25 Commits<br>25 Commits

src

src

tests

tests

.gitignore

.gitignore

CLAUDE.md

CLAUDE.md

LICENSE.md

LICENSE.md

README.md

README.md

package-lock.json

package-lock.json

package.json

package.json

setup.sh

setup.sh

tsconfig.json

tsconfig.json

View all files

Repository files navigation

🤖🚔️ slopocop

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<br>config it fully controls. It ignores any eslint.config.* / .eslintrc*<br>in the target repo, so that findings never depend on a specific ESLint setup,<br>and it works in repos with no ESLint at all. It only lints TypeScript<br>and tsx files; everything else is skipped.

From a local clone

Slopocop is not published to npm. To use it, clone this repo and run:

./setup.sh

This installs dependencies, builds the CLI, and npm links it, making<br>slopocop available globally on your machine. Rebuilding (npm run build)<br>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<br>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<br>Notes

--rule<br>Restrict to this rule (repeatable)

--ignore-pattern<br>Add a glob to the default ignores (repeatable)

--type-aware<br>Enable the TypeScript type checker

--project<br>tsconfig path to use with --type-aware

--format<br>Output formatter (default: stylish)

--llm<br>Compact output for an AI agent, grouped by file/rule (overrides --format)

--fix<br>Automatically fix problems

--quiet<br>Report errors only

--help<br>Show the help message

--version<br>Show the installed version

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

--llm output format

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

Rules

Rule<br>Description

no-long-comment-lines<br>Disallow comment lines that exceed a maximum length

no-single-caller-function<br>Disallow functions that have exactly one caller which itself invokes no other local function

no-huge-comment-blocks<br>Disallow comment blocks that span more lines than a maximum

no-likely-slop-language<br>Disallow comments containing phrasing characteristic of LLM-generated text

no-import-then-export<br>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<br>Warn when a file exceeds 500 lines (doesn't fail the run)

max-file-lines-error<br>Error when a file exceeds 750 lines

no-unused-vars<br>Disallow unused variables, functions, and imports (@typescript-eslint's TS-aware version, reused as-is)

Default ignores

**/node_modules/**<br>**/dist/**<br>**/lib/**<br>**/build/**<br>**/*.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.<br>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.

About<br>eradicating slop from your...

rule slopocop file eslint files rules

Related Articles