Skip to content

feat(rules): demote 19 low-signal rules to opt-in#644

Merged
aidenybai merged 2 commits into
mainfrom
chore/opt-out-low-value-default-rules
Jun 4, 2026
Merged

feat(rules): demote 19 low-signal rules to opt-in#644
aidenybai merged 2 commits into
mainfrom
chore/opt-out-low-value-default-rules

Conversation

@aidenybai

@aidenybai aidenybai commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

Move 19 low-signal rules out of the default recommended preset via defaultEnabled: false, so a default scan focuses on correctness, performance, accessibility, and security instead of subjective style. Every demoted rule still ships in the plugin and can be re-enabled with a one-line severityControls / config entry.

Demoted to opt-in

  • Subjective design / house-style (13): no-gradient-text, no-dark-mode-glow, no-pure-black-background, no-side-tab-border, no-wide-letter-spacing, no-justified-text, no-z-index-9999, design-no-em-dash-in-jsx-text, design-no-three-period-ellipsis, design-no-vague-button-label, design-no-redundant-padding-axes, design-no-redundant-size-axes, design-no-space-on-flex-children
  • Naming-convention preferences (2): no-generic-handler-names, jsx-pascal-case
  • Legacy class / PropTypes (3): prefer-es6-class, no-default-props, no-prop-types — don't fire in a modern function-component + TypeScript codebase
  • Dedupe (1): no-array-index-key — double-reported with the canonical no-array-index-as-key (Bugs category, friendlier message). The port's only unique coverage is React.cloneElement; opt back in if you need it.

Notes

  • Each demoted rule carries a short comment explaining why it's off by default.
  • collectRuleHits (regression helper) now force-enables the rule under test, so default-disabled rules still produce hits in their own tests. Severity is irrelevant there — callers assert on file path + message.
  • Changeset: minor bump (changes the default-enabled rule set), which fans out to the three fixed published packages.

Test plan

  • pnpm typecheck — clean
  • pnpm lint — clean (only pre-existing fixture warnings)
  • Registry regen (pnpm gen) — no diff (the flag flows through the rule spread)
  • react-19-migration-rules, react-ui-rules, rules-command, terminal-visuals — pass
  • Core metadata tests (build-rule-docs-url, has-published-fix-recipe, dead-code-may-surface) — pass
  • CI green

Note: one pre-existing no-array-index-key rule-tester case (key={1 + index}) fails on clean main as well — unrelated to this change.


Note

Medium Risk
Upgrading changes which diagnostics appear without config (preset behavior), though every rule remains one-line re-enableable and no runtime app logic changes.

Overview
Nineteen react-doctor rules are opt-in by default (defaultEnabled: false), so the built-in recommended preset runs fewer warnings out of the box and emphasizes correctness, performance, accessibility, and security over style and legacy patterns.

The demoted set covers subjective design / copy / Tailwind house style (e.g. gradient text, pure black backgrounds, em dashes, redundant px/py), naming tastes (jsx-pascal-case, no-generic-handler-names), legacy React 19 migration nags (defaultProps, propTypes, prefer-es6-class), and no-array-index-key to avoid double-reporting with no-array-index-as-key (still available for React.cloneElement if opted in). Each rule file documents why it is off by default; a minor changeset records the preset change for oxlint-plugin-react-doctor.

Tests: collectRuleHits always enables the rule under test via userConfig, and inspect surface-filter tests opt a few design rules back in so design-tag filtering still has real diagnostics to assert on.

Reviewed by Cursor Bugbot for commit 5ffbc9f. Bugbot is set up for automated code reviews on this repo. Configure here.

Move subjective design/house-style rules, naming-convention preferences,
legacy class/PropTypes rules, and the duplicate `no-array-index-key` out
of the default recommended preset via `defaultEnabled: false`. The
recommended set now focuses on correctness, performance, accessibility,
and security; every demoted rule still ships and can be re-enabled via
config.

Also force-enable the rule under test in the `collectRuleHits` regression
helper so default-disabled rules still produce hits in their tests.
@pkg-pr-new

pkg-pr-new Bot commented Jun 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@644
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@644
npm i https://pkg.pr.new/react-doctor@644

commit: 5ffbc9f

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

React Doctor

React Doctor found 22 files changed in this pull request, but none matched the files covered by its enabled checks.

Scope: 22 files changed on chore/opt-out-low-value-default-rules vs. main.

View workflow run

Generated by React Doctor. Questions? Contact founders@million.dev.

The `inspect-surface-filter` tests rely on `design`-tagged diagnostics
being produced by a default scan. Now that the design rules ship
`defaultEnabled: false`, enable a few inline-style design rules via
`configOverride` so the surface filter has real design-tagged
diagnostics to strip / demote.
@aidenybai aidenybai merged commit eba20ae into main Jun 4, 2026
18 checks passed
@aidenybai aidenybai deleted the chore/opt-out-low-value-default-rules branch June 4, 2026 09:50
gcharang added a commit to gcharang/react-doctor that referenced this pull request Jun 4, 2026
Sync upstream (PR #2): brings millionco#658 "Add to CI" handoff + default CI setup,
millionco#644 rule demotions, millionco#677 retire rn-animate-layout-property, millionco#678/millionco#679/millionco#676,
millionco#646 version-packages, and the sync-upstream workflow onto the hardened fork.

Conflicts resolved keeping fork identity (FORK_* constants, github:gcharang/
react-doctor#pinned spec, local score, no phone-home) while taking upstream
behavior:
- core/constants.ts: keep FORK_* block; new CI_URL points at the fork, not
  react.doctor/ci.
- build-handoff-payload / install-doctor-script / install-git-hook-file /
  install-react-doctor / render-diagnostics: take upstream's refactors
  (async install, namespace fs/path imports, extracted workflow module,
  renderer rework), re-applying the fork npx spec on top.
- tests + terminal-visuals snapshot: upstream layout/asserts with the fork
  spec.

Silent (non-conflict) fork patches:
- install-github-workflow.ts / open-workflow-pull-request.ts: repoint the
  generated CI workflow + PR body to gcharang/react-doctor@pinned and the
  fork repo (upstream shipped millionco/react-doctor@v1 + react.doctor/ci).
- root package.json: deslop-js ^0.0.17 -> ^0.0.19 to match millionco#679 and the
  per-package manifests (auto-merge kept the stale root pin).
- CI_TRUST_COMPANIES: drop the named-company endorsement for neutral wording.

Regenerated and re-staged into this merge: prebuilt dist/ (cli.js + engine,
no source maps), vendored prompts/ (328 recipes, unchanged rule set), and
the config schema. Grep gate clean across shipped surfaces.

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

1 participant