Skip to content

docs(develop): Add frontend linting and lint incubator guides - #20919

Open
natemoo-re wants to merge 5 commits into
masterfrom
docs/add-lint-incubator-docs
Open

natemoo-re wants to merge 5 commits into
masterfrom
docs/add-lint-incubator-docs

Conversation

@natemoo-re

@natemoo-re natemoo-re commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Frontend linting conventions and the getsentry/sentry lint incubator lacked contributor documentation on develop.sentry.dev.

Adds a new Linting section under Frontend (develop-docs/frontend/linting/):

  • develop-docs/frontend/linting/index.mdx: Covers our mechanical-enforcement philosophy (especially why deterministic lint feedback matters for coding agents), principles for writing actionable rules, and the frontend linting stack (oxlint, oxfmt, stylelint, knip, and workspace dependency linting).
  • develop-docs/frontend/linting/lint-incubator.mdx: Explains how per-workspace oxlint-suppressions.json budgets work, how contributors and rule authors resolve failures or enroll/prune/graduate rules, and how CI enforces and maintains the ratchet.

Fixes DE-1723

IS YOUR CHANGE URGENT?

  • Urgent deadline (GA date, etc.): YYYY-MM-DD
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

Document how getsentry/sentry rolls out new Oxlint rules incrementally using per-workspace oxlint-suppressions.json budgets, local lint:suppressions maintenance commands, and CI ratchet workflows.

Fixes DE-1723
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
develop-docs Ready Ready Preview Nov 25, 2026 1:55am UTC
sentry-docs Ready Ready Preview Nov 25, 2026 1:55am UTC

Request Review

@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

DE-1723

@github-actions github-actions Bot added the Priority: Normal Docs review has no urgent deadline label Nov 19, 2026
…uide

Add a parent Linting page under Frontend covering mechanical enforcement in the agentic era, rule design principles, and the frontend linting stack, and condense the Lint Incubator guide around its operational model.

Refs DE-1723
@natemoo-re natemoo-re changed the title docs(develop): Add lint incubator contributor guide docs(develop): Add frontend linting and lint incubator guides Nov 23, 2026
Document Knip checks for unused files/exports, production dead code, and circular module imports on the frontend linting page.

Refs DE-1723
@natemoo-re
natemoo-re requested a review from a team November 24, 2026 20:43
@natemoo-re natemoo-re self-assigned this Nov 24, 2026
@cursor

cursor Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Getting ready to monitor this change · Rollout details

Status Service Environment
⏳ Getting ready to monitor this change

@coolguyzone coolguyzone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for adding!

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! 🔥


When adding or updating a lint rule, optimize for fast comprehension and low false positives:

- **Enforce as errors, never permanent warnings**: Warnings get ignored by both humans and agents. Every active rule fails the build. When pre-existing violations prevent turning a rule on all at once, enroll it in the [Lint Incubator](/frontend/linting/lint-incubator/) instead of leaving it at `warn`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] I don't think "Every active rule fails the build" is true today: oxlint.base.ts still has four 'warn' rules (jest/no-commented-out-tests, testing-library/no-debugging-utils, regexp/confusing-quantifier, regexp/no-empty-alternative), and nothing passes --deny-warnings/--max-warnings. prek even runs oxlint with --quiet, which hides warnings entirely.

You might consider rephrasing this as guidance for new rules ("New rules should be errors…"), or flipping those four in a follow-up. My preference would be to make the four warn rules error though, so this becomes fully correct. 🧹


## Frontend Linting Stack

Frontend checks in `getsentry/sentry` split responsibility across five tools:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Docs] Small mismatch: the overview in frontend/index.mdx lists four tools (Oxlint, Oxfmt, Stylelint, Knip), while this says five. The fifth (dependency linting) also doesn't name sherif, which might help folks who see it in CI output.

Comment on lines +44 to +45
- **`New incubator violations`**: Your change added a violation in a clean file or pushed a file above its `master` budget. Because budgets track counts per file rather than line numbers, the error output lists every current violation of that rule in the file. Fix one or more of them to bring the count back within budget. Do not manually raise `count` in `oxlint-suppressions.json`; CI compares against `master` and rejects budget increases. If a specific line genuinely requires an exception, add an inline disable comment (`// oxlint-disable-next-line <rule>`) explaining why, then prune if the file also had a recorded budget.
- **`Suppression budgets are stale`**: Your changes lowered the violation count in one or more files (either directly, or indirectly by updating a shared TypeScript type), leaving the committed budget higher than live debt. `pnpm run fix:oxlint` lowers budgets automatically when autofixing root files; otherwise run `pnpm run lint:suppressions --prune` and commit the updated `oxlint-suppressions.json` files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question] These headings are messages from lint:suppressions: New incubator violations comes from --ci/--check/--enroll/--prune, and Suppression budgets are stale only from --ci. A local pnpm run lint:js or prek failure just shows plain oxlint diagnostics, e.g.:

static/app/example.tsx:2:22: error @sentry/scraps(prefer-primitives): Use Flex from '@sentry/scraps/layout'. ...

Would it help to note where each message comes from, so readers don't look for these headings in local output?


### Enrolling, Updating, and Graduating Rules

- **Enroll a new rule (or broaden an existing rule)**: Add the rule with `'error'` severity to `incubator` in `oxlint.config.ts` (use `incubator.overrides` for file exclusions or test-only rules, and also enable the rule in `oxlint.base.ts` if standalone workspace packages with their own `oxlint.config.ts` should run it). Then generate baseline budgets against `master`:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question] For the "also enable the rule in oxlint.base.ts" path: createPackageConfig spreads base.rules without the incubator's warn-in-editor switch (that only lives in oxlint.config.ts). So I think in scraps/icons/search-syntax, editors would show the rule as an error rather than the warning "How Budgets Work" describes. Might be worth a caveat?


Three GitHub Actions workflows enforce the ratchet and keep `oxlint-suppressions.json` files up to date:

- **Ratchet verification (`frontend.yml`)**: Checks that no `(file, rule)` count exceeds `master` and that committed `oxlint-suppressions.json` budgets match live violations. If concurrent merges on `master` leave behind stale budgets that your pull request did not touch or cause, CI logs a warning instead of failing your pull request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Docs] It might help to name the command here: this step runs pnpm run lint:suppressions --ci --base HEAD^1 on PRs, and --ci isn't in the Command Reference table either. That'd make it easier to map CI logs back to these docs.

"count": 2
},
"@sentry/scraps/prefer-primitives": {
"count": 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] Totally optional since it's illustrative: the real static/app/oxlint-suppressions.json uses compact {"count": 2} entries, and featureDisabled.tsx currently has prefer-primitives: 2.

This branch was successfully deployed

2 active deployments
Preview – sentry-docs — da4e96f9 Deployed Nov 25, 2026 by vercel[bot]
Preview – develop-docs — da4e96f9 Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants