Deslop: Oxlint rules for AI-generated TypeScript
Overview
Deslop is a specialized plugin for the Oxlint ecosystem that provides a suite of opinionated rules aimed at identifying and rejecting "AI-slop"—code patterns often generated by LLMs that lack sufficient evidence, rely on unsafe type assertions, or exhibit poor API usage. By enforcing stricter constraints on TypeScript code, Deslop helps developers maintain codebase integrity when integrating AI-assisted feature development.
Core Functionality and Rules
Deslop categorizes its rules into three primary areas: type safety, code quality, and testing standards. The plugin is built upon rules originally developed by the anti-slop project, expanded with additional custom rules under the deslop/* namespace.
Type Safety and Evidence
These rules are designed to prevent common AI tendencies to bypass the TypeScript type system with unsafe assertions. Key rules include:
no-chained-type-assertions: Rejects nestedasor angle-bracket assertions that fabricate type evidence.no-unknown-parametersandno-unknown-returns: Disallows the use ofunknownin function signatures and return contracts, forcing explicit type definitions.require-safety-comment-for-type-assertion: Mandates an invariant justification for non-const assertions, ensuring that developers document why an assertion is necessary.
Code Quality and API Usage
To prevent the generation of overly complex or non-idiomatic code, Deslop targets specific API patterns frequently used by LLMs:
no-reflect-applyandno-reflect-get: Restricts the use of globalReflectmethods, which are often over-utilized by models like Claude.no-array-filter-map: Prevents inefficient adjacent eager array operations, encouraging more performant iterator pipelines.
Testing Standards
Deslop includes rules to improve the reliability of test suites, which are critical when relying on AI-generated code. These include:
no-module-mocking: Rejects the use of Vitest and Jest module mocks to encourage better dependency injection.no-poor-substring-tests: Flags tests that rely on weak substring matching for validation.
Developer Reception and Use Cases
Early adopters of Deslop and similar tools emphasize that aggressive linting is a prerequisite for scaling AI-assisted development. Developers note that without such guardrails, maintaining a codebase with high AI involvement becomes difficult to manage.
"I work on a project where we recently heavily pivoted into AI assisted feature development and without a extremely defensive/aggressive lint config and test coverage near ~80% most of these developments would be quiet impossible." — @SSchick
Users also highlighted the importance of combining Oxlint with other AST-based tools to ensure code quality across different languages and LLM outputs. Projects like ast-grep-essentials are frequently cited as complementary tools for teams building custom validation pipelines for AI-generated code.
Installation and Usage
Deslop is distributed as an npm package and is compatible with any Oxlint JavaScript-plugin runtime, including Bun, Deno, and Node.js. To integrate it, users add the plugin to their oxlint configuration file:
import { defineConfig } from "oxlint";
import { configs as deslopConfigs } from "ai-deslop";
export default defineConfig({
jsPlugins: ["ai-deslop"],
options: deslopConfigs.recommended.options,
rules: deslopConfigs.recommended.rules
});
For teams requiring more granular control, the plugin also offers a set of opt-in rules, such as no-duplicate-types and canonical-class-names for Tailwind CSS v4, which can be enabled based on specific project needs.