Oxlint rules that reject low-evidence TypeScript and JavaScript patterns.
Repository: github.com/lomiafrica/anti-slop — standalone lomi. tool. In the lomi. monorepo it is checked out as a submodule at apps/tools/anti-slop. Upstream: dmmulroy/anti-slop.
Oxlint loads this plugin as TypeScript source. Point jsPlugins at index.ts in this repo. Do not treat it as a compiled npm package.
git submodule update --init apps/tools/anti-slopLocal umbrella oxlint.config.ts (gitignored in the monorepo) should keep:
jsPlugins: [
{ name: "anti-slop", specifier: "./apps/tools/anti-slop/index.ts" },
],Then run pnpm anti-slop from the umbrella after a local root pnpm install. Node 22.18+ is required because the plugin is TypeScript.
git clone https://github.com/lomiafrica/anti-slop.git
cd anti-slop
pnpm install
pnpm typecheckIn the consuming repo, install matching oxlint and @oxlint/plugins, then:
import { defineConfig } from "oxlint";
export default defineConfig({
ignorePatterns: ["anti-slop/**"],
jsPlugins: [
{ name: "anti-slop", specifier: "./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", { allowInTypeGuards: true }],
"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",
},
});no-unknown-parameters— do not type params asunknownexceptcauseno-unknown-returns— return a named type, notunknownrequire-safety-comment-for-type-assertion— avoidas Tunless a// SAFETY:comment states the invariantno-chained-type-assertions— neveras unknown as Tno-runtime-typeof—typeofonly inside a type predicate whenallowInTypeGuardsis onno-known-value-widening— do not annotate a known value as a loose dictionaryno-unsafe-dictionary-type— noRecord<string, unknown>no-conditional-empty-object-spread— no{ ...(cond ? { k: v } : {}) }no-object-parameters— noparam: objectno-module-mocking— nojest.mock/vi.mockno-unknown-type-aliases— notype X = unknownno-widen-then-assert— do not widen and then assert backno-reflect-apply/no-reflect-get— noReflect.apply/Reflect.getno-shape-in-symbol-names— no forbidden terms in symbol names
MIT. Rule source is from dmmulroy/anti-slop.