feat: enforce machine-checkable frontend pattern rules in lint#27409
feat: enforce machine-checkable frontend pattern rules in lint#27409ibetitsmike wants to merge 1 commit into
Conversation
adbeac5 to
7a71e72
Compare
0f8489b to
96d9ed2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adbeac5e0d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
96d9ed2 to
a166ce3
Compare
e890b3f to
df056cb
Compare
a166ce3 to
759a612
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df056cb3ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
759a612 to
0e80cef
Compare
df056cb to
ebbc3f4
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebbc3f4faf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ebbc3f4 to
4cdea6a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4cdea6ac9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4cdea6a to
09590ad
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09590ada56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
09590ad to
101a890
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 101a890e80
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
101a890 to
3fa30c4
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3fa30c4fdb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3fa30c4 to
3f30db9
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f30db9004
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Adds scripts/check-frontend-patterns.mjs, a deterministic checker for the text-detectable subset of the FE rule contract: querySelector in stories (FE10), class-attribute selectors in tests (FE10), re-typed query key literals (FE7), and empty catch blocks (FE7). Existing violations are recorded in a ratchet baseline so only new violations fail; fixes ratchet the baseline down via --update. Wired into pnpm lint as lint:patterns.
3f30db9 to
762d3e5
Compare
|
@codex review |
|
Closing this approach: the deterministic checks will be replaced with proper linting instead of a standalone ratchet script.
|
What
Adds
site/scripts/check-frontend-patterns.mjs, a deterministic checker for the text-detectable subset of the FE rule contract, wired intopnpm lintaslint:patterns(so the existing CI lint job enforces it with no workflow changes):FE10/no-queryselector-in-stories:querySelectorin*.stories.tsx(baseline: 98 occurrences in 22 files)FE10/no-class-substring-selectors:[class*=]-style selectors in stories/tests (baseline: 1)FE7/no-retyped-query-keys: string-literal query keys in stories/tests that re-type a key constant defined inapi/queries/(baseline: 72 in 15 files)FE7/no-empty-catch: empty catch blocks (baseline: 0, fully enforced)Existing violations are recorded in
frontend-patterns-baseline.jsonas a ratchet: new violations fail CI, and fixing violations requiresnode scripts/check-frontend-patterns.mjs --updateso counts only go down.Why
These four patterns are recurring review complaints (the re-typed query key check mirrors feedback on #27385) and are reliably detectable with text matching, so there is no reason to spend reviewer attention on them. The semantic rules stay with the frontend-review skill; this only automates the mechanical subset.
Both ratchet directions are tested: adding a violation fails with
file:lineoutput, and dropping below the baseline prompts a ratchet update.Stacked on #27407 and #27408.