Visitar URL original
feat: add antislop option by antfubot · Pull Request #861 · antfu/eslint-config · GitHub
Skip to content

feat: add antislop option - #861

Merged
antfu merged 6 commits into
antfu:mainfrom
antfubot:feat/anti-slop
Sep 2, 2026
Merged

antfu merged 6 commits into
antfu:mainfrom
antfubot:feat/anti-slop

Conversation

@antfubot

@antfubot antfubot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds an opt-in, experimental antislop factory option to guard against low-value code patterns commonly introduced by AI agents, inspired by this writeup on keeping AI-authored code clean.

  • Enables all rules from eslint-plugin-slop v0.1.1 (including the new no-jargon and prefer-jsdoc; the plugin ships no preset, so the set is maintained here).
  • Enables an in-house maintained subset of eslint-plugin-sonarjs focused on redundant and duplicated code (e.g. no-identical-functions, no-duplicated-branches, no-commented-code, cognitive-complexity), deliberately excluding security/AWS/test/regex rules that overlap with existing configs, and type-aware rules so it works without tsconfigPath.
  • Turns ts/no-explicit-any on (error) when TypeScript is enabled; the antislop config is composed after the TypeScript config so the override takes effect.
  • The option accepts an object to toggle each plugin: sonarjs?: boolean and slop?: boolean | OptionsSlop — passing an object enables eslint-plugin-slop and is forwarded to it via settings.slop (e.g. inspection mode).
  • Marked @experimental: the enabled rule set is maintained in-house and may change in any release without following semver.
  • Both plugins are optional peer dependencies, installed on demand via the usual ensurePackages prompt.
  • Supports antislop: { overrides: {...} } like other integrations.
  • README documents the option and recommends pairing it with jscpd and knip, since linters only see one file at a time.

Note: 7 factory snapshots were already stale on main (from the earlier pnpm blank-lines feature) and got regenerated together with the new antfu/antislop/rules entries.


This PR was created with the help of an agent.

Comment thread README.md Resolved
@antfu antfu changed the title feat: add antiSlop option feat: add antislop option Sep 2, 2026
@antfu
antfu merged commit f6906f6 into antfu:main Sep 2, 2026
7 checks passed
antfu added a commit to antfu/pulls.review that referenced this pull request Sep 18, 2026
Reruns scripts/capture-fixtures.ts against the current normalizer/
rule-based adapter (flattened DiffsPayload shape) and the script's own
current target list - antfu/eslint-config#861, vuejs/core#12349, and a
new devframes/devframe#387 - regenerating test/fixtures/real/*.json
under their owner-repo-number names and every glob-driven snapshot that
reads them. Removes the now-superseded small.json/large.json fixtures
and their orphaned snapshot files, and repoints DiffsPage.stories.ts's
"RealPullRequest" story at the renamed fixture.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants