Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lint against static widgets in question stems (#1511)
We have logic in the Perseus renderer that prevents widgets from being static in question stems. This logic was put in place to prevent content creators from accidentally creating exercises that couldn't be answered (because all their widgets were static). However the implementation is pretty hacky (it checks problemNum to know if the renderer is in a question stem), and doesn't work in the exercise editor preview, or in Perseus storybook. The resulting behavior is very surprising: `static` widgets in question stems are non-interactive in the exercise editor but are interactive in the learner experience. Because this is so confusing, we want to remove the special-case logic and let `static` always do what it says on the tin. But we still want to ensure that unanswerable exercises aren't published. To that end, this commit adds a linter that will do that. Issue: LEMS-2251 ## Test plan: Deploy a ZND and edit an exercise. - Add a static widget to a question stem; you should get a linter warning. - Add a static widget to a hint; you should not get a linter warning. - Add a non-static widget to a question; you should not get a linter warning. - Add a static widget to an article; you should not get a linter warning. Note that only Radio widgets can be made static, currently. <img width="805" alt="Screen Shot 2024-08-13 at 2 40 06 PM" src="https://github.com/user-attachments/assets/7a3cf4d1-431c-4b06-aa5f-82981fe69771"> Author: benchristel Reviewers: benchristel, jeremywiebe Required Reviewers: Approved By: jeremywiebe Checks: ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1511
- Loading branch information