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.
npx skills add dmmulroy/anti-slop --skill install-anti-slopThen 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 generic rule, and validates the result. In repositories that depend on Effect, it also enables the opt-in Effect rule group.
To inspect available skills first:
npx skills add dmmulroy/anti-slop --listCopy 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.
Effect-specific rules live in a separate plugin so projects that do not use Effect do not inherit Effect architecture policy. Register the Effect entry point only in repositories that use Effect:
export default defineConfig({
jsPlugins: [
{ name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" },
{
name: "anti-slop-effect",
specifier: "./tools/oxlint/anti-slop/effect/index.ts"
}
],
rules: {
"anti-slop-effect/no-service-constructor-imports": "error"
}
});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.
no-service-constructor-imports— rejects relative project imports of exportedmake<CapabilityName>constructors outside*.test.*and*.spec.*files. Runtime callers should import the owning Layer and yield the contextual service instead. Package imports and static constructors such asWorkspaceName.makeare outside the rule.
Each snippet below is rejected by the named rule.
const user = input as object as User;const options = {
...(timeout !== undefined ? { timeout } : {}),
};const handlers: Record<string, Handler> = {
start: startHandler,
};This discards the known start key. Preserve inference or use satisfies Record<string, Handler> instead.
vi.mock("./user-store");function save(value: object) {}const value = Reflect.apply(operation, owner, args);const value = Reflect.get(owner, key);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.
interface UserShape {
id: string;
}import { makeIssueService } from "./issue-service.ts";Import the owning Layer and yield IssueService instead. Focused *.test.* and *.spec.* files may import the constructor directly.
function handle(input: unknown) {}function loadUser(): unknown {
return input;
}type ExternalValue = unknown;type Metadata = Record<string, unknown>;
type OtherMetadata = { [key: string]: object };const loaded: User = loadUser();
const stored: unknown = loaded;
const user = stored as User;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;pnpm install
pnpm checksrc/ is canonical. After changing production source, run pnpm sync:skill-assets; CI checks that the skill's bundled copy remains identical.
MIT