anti-slop
Opinionated Oxlint rules that reject low-evidence and low-signal TypeScript and JavaScript patterns.
This project is meant to be vendored, not treated as a fixed npm dependency. Copy the rules into your repository, read them, and change them to match your team's standards. The bundled agent skill handles the initial copy and configuration; after that, the vendored files are yours to maintain and make your own.
Install with an agent skill
npx skills add dmmulroy/anti-slop --skill install-anti-slop
Then ask your coding agent to install or configure anti-slop in the current repository. The skill copies the plugin, installs current Oxlint dependencies, merges the plugin into the existing lint configuration, enables every rule, and validates the result.
To inspect available skills first:
npx skills add dmmulroy/anti-slop --list
Manual local installation
Copy src/ into the target repository, for example at tools/oxlint/anti-slop/, and install matching current versions of oxlint and @oxlint/plugins.
Register the copied entry point in oxlint.config.ts:
import { defineConfig } from "oxlint";
export default defineConfig({
ignorePatterns: [
".agent/**",
".agents/**",
".claude/**",
".codex/**",
".continue/**",
".cursor/**",
".gemini/**",
".opencode/**",
".pi/**",
".roo/**",
".windsurf/**",
"tools/oxlint/anti-slop/**",
],
jsPlugins: [
{ name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" },
],
rules: {
"anti-slop/no-chained-type-assertions": "error",
"anti-slop/no-conditional-empty-object-spread": "error",
"anti-slop/no-known-value-widening": "error",
"anti-slop/no-module-mocking": "error",
"anti-slop/no-object-parameters": "error",
"anti-slop/no-reflect-apply": "error",
"anti-slop/no-reflect-get": "error",
"anti-slop/no-runtime-typeof": "error",
"anti-slop/no-shape-in-symbol-names": "error",
"anti-slop/no-unknown-parameters": "error",
"anti-slop/no-unknown-returns": "error",
"anti-slop/no-unknown-type-aliases": "error",
"anti-slop/no-unsafe-dictionary-type": "error",
"anti-slop/no-widen-then-assert": "error",
"anti-slop/require-safety-comment-for-type-assertion": "error"
}
});
The same ignorePatterns, jsPlugins, and rules work under lint in a Vite+ config. Merge the ignore patterns into Vite+'s fmt.ignorePatterns as well so vp check does not reformat installed agent assets or the vendored plugin. Preserve existing ignores and add any other project-local agent tooling directories detected in the repository; do not broadly ignore every dot-directory.
Rules
no-chained-type-assertions— rejects nested type assertions that fabricate evidence.no-conditional-empty-object-spread— rejects conditional spreads that use{}to omit fields.no-known-value-widening— rejects explicit broad target types that discard known value evidence.no-module-mocking— rejects Vitest and Jest module mocks in favor of real dependency seams.no-object-parameters— rejects the broadobjecttype on function inputs.no-reflect-apply— rejectsReflect.applyin favor of typed function calls.no-reflect-get— rejectsReflect.getin favor of typed property access or boundary parsing.no-runtime-typeof— requires boundary parsing instead of ad hoctypeofnarrowing.no-shape-in-symbol-names— rejectsshapein symbol names.no-unknown-parameters— rejectsunknowninputs except the explicitcauseconvention.no-unknown-returns— rejects function contracts that returnunknownorPromise<unknown>.no-unknown-type-aliases— rejects aliases that merely concealunknown.no-unsafe-dictionary-type— rejects dictionary value contracts based onunknown,any,object,{}, and semantic equivalents.no-widen-then-assert— rejects local flows that widen known values and later assert them back.require-safety-comment-for-type-assertion— requires each non-const assertion to document its checked invariant.
Violation examples
Each snippet below is rejected by the named rule.
no-chained-type-assertions
const user = input as object as User;
no-conditional-empty-object-spread
const options = {
...(timeout !== undefined ? { timeout } : {}),
};
no-known-value-widening
const handlers: Record<string, Handler> = {
start: startHandler,
};
This discards the known start key. Preserve inference or use satisfies Record<string, Handler> instead.
no-module-mocking
vi.mock("./user-store");
no-object-parameters
function save(value: object) {}
no-reflect-apply
const value = Reflect.apply(operation, owner, args);
no-reflect-get
const value = Reflect.get(owner, key);
no-runtime-typeof
if (typeof input === "string") {
useName(input);
}
Schema-free projects can permit typeof checks directly inside type predicate and
assertion functions while continuing to reject ad hoc checks elsewhere:
{
"anti-slop/no-runtime-typeof": [
"error",
{ "allowInTypeGuards": true }
]
}
The option defaults to false.
no-shape-in-symbol-names
interface UserShape {
id: string;
}
no-unknown-parameters
function handle(input: unknown) {}
no-unknown-returns
function loadUser(): unknown {
return input;
}
no-unknown-type-aliases
type ExternalValue = unknown;
no-unsafe-dictionary-type
type Metadata = Record<string, unknown>;
type OtherMetadata = { [key: string]: object };
no-widen-then-assert
const loaded: User = loadUser();
const stored: unknown = loaded;
const user = stored as User;
require-safety-comment-for-type-assertion
const userId = value as UserId;
Add a specific justification immediately before a necessary assertion:
// SAFETY: parseUserId validated the identifier before branding it.
const userId = value as UserId;
Development
pnpm install
pnpm check
src/ is canonical. After changing production source, run pnpm sync:skill-assets; CI checks that the skill's bundled copy remains identical.
License
MIT
No comments yet
Be the first to share your take.