Add Numeric Input widget save warnings to perseus linter#3053
Merged
Conversation
…nter To make sure that save warnings get surfaced, I'm adding them to the Perseus linter. This means that they should also show up as part of the issues panel. In this PR, I'm adding a linter rule for matcher widget save warnings. Issue: https://khanacademy.atlassian.net/browse/LEMS-3643 Test plan: `pnpm jest packages/perseus-linter/src/rules/matcher-widget-error.test.ts` Storybook - Go to `/?path=/story/editors-editorpage--demo` - Add a matcher widget - Type into the blank option in the left or right column - Confirm that the error shows up in the issues panel
…ngs to perseus linter
…o perseus linter To make sure that save warnings get surfaced, I'm adding them to the Perseus linter. This means that they should also show up as part of the issues panel. In this PR, I'm adding a linter rule for numeric input widget save warnings. Issue: https://khanacademy.atlassian.net/browse/LEMS-3643 Test plan: `pnpm jest packages/perseus-linter/src/rules/numeric-input-widget-error.test.ts` Storybook - Go to `/?path=/story/editors-editorpage--demo` - Add a numeric input widget - Confirm that it has an error saying there's a missing answer - Input an answer - Confirm that there is no longer an error saying there's a missing answer - Select "Required" under "Answer formats are:" - Confirm an error shows up saying the answer format is required but one isn't selected - Choose a format under "Possible answer formats" - Confirm there are no errors
…t save warnings to perseus linter
nishasy
commented
Nov 20, 2025
| (!answer.answerForms || answer.answerForms.length === 0); | ||
| if (formatError) { | ||
| issues.push( | ||
| `Answer ${i + 1} requires a format, but no format was selected`, |
Contributor
Author
There was a problem hiding this comment.
I changed the messaging here to make it clearer with Third's help.
Contributor
🗄️ Schema Change: No Changes ✅ |
Contributor
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (2d53d2f) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3053If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3053If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3053 |
Contributor
🛠️ Item Splitting: No Changes ✅ |
Contributor
|
Size Change: +139 B (+0.03%) Total Size: 497 kB
ℹ️ View Unchanged
|
|
|
||
| // If it can't find a definition for the widget it does nothing | ||
| // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions | ||
| const widget = context && context.widgets && context.widgets[nodeId]; |
Contributor
There was a problem hiding this comment.
Would this be easier to read:
const widget = context?.widgets?.[nodeId];
Contributor
Author
There was a problem hiding this comment.
Ohh I see. You may see this in multiple PRs because it's copy-pasted from other code 😅
mark-fitzgerald
approved these changes
Nov 20, 2025
Contributor
mark-fitzgerald
left a comment
There was a problem hiding this comment.
Soooo helpful. Thank you!
Merged
SonicScrewdriver
added a commit
that referenced
this pull request
Nov 24, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/perseus-editor@28.8.0 ### Minor Changes - [#2976](#2976) [`9f9bb23276`](9f9bb23) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Resolving a long-standing Perseus Editor cursor jumping bug by removing the debounce on changes in the Editor and moving it upstream. ### Patch Changes - [#3053](#3053) [`c9066e6ac0`](c9066e6) Thanks [@nishasy](https://github.com/nishasy)! - Add Numeric Input widget save warnings to perseus linter - [#3060](#3060) [`bae4cfa6f1`](bae4cfa) Thanks [@nishasy](https://github.com/nishasy)! - Add Label Image widget save warnings to perseus linter - [#3052](#3052) [`5f01d377f4`](5f01d37) Thanks [@nishasy](https://github.com/nishasy)! - Add Matcher widget save warnings to perseus linter - [#3066](#3066) [`2baef997c0`](2baef99) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Sync Dependencies and Hashes - [#3058](#3058) [`58f942cb9c`](58f942c) Thanks [@nishasy](https://github.com/nishasy)! - Add Python Program widget save warnings to perseus linter - [#3061](#3061) [`022624f6f6`](022624f) Thanks [@nishasy](https://github.com/nishasy)! - Add Interactive Graph widget save warnings to perseus linter - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - [#3057](#3057) [`723d2101e7`](723d210) Thanks [@nishasy](https://github.com/nishasy)! - Add Phet Simulation widget save warnings to perseus linter - Updated dependencies \[[`c9066e6ac0`](c9066e6), [`bae4cfa6f1`](bae4cfa), [`5f01d377f4`](5f01d37), [`2baef997c0`](2baef99), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210), [`d697b6439b`](d697b64)]: - @khanacademy/perseus-linter@4.6.0 - @khanacademy/perseus@72.2.1 - @khanacademy/perseus-core@20.2.1 - @khanacademy/math-input@26.2.21 - @khanacademy/kas@2.1.5 - @khanacademy/keypad-context@3.2.18 - @khanacademy/kmath@2.2.18 - @khanacademy/perseus-score@8.0.7 - @khanacademy/perseus-utils@2.1.3 ## @khanacademy/perseus-linter@4.6.0 ### Minor Changes - [#3053](#3053) [`c9066e6ac0`](c9066e6) Thanks [@nishasy](https://github.com/nishasy)! - Add Numeric Input widget save warnings to perseus linter - [#3060](#3060) [`bae4cfa6f1`](bae4cfa) Thanks [@nishasy](https://github.com/nishasy)! - Add Label Image widget save warnings to perseus linter - [#3052](#3052) [`5f01d377f4`](5f01d37) Thanks [@nishasy](https://github.com/nishasy)! - Add Matcher widget save warnings to perseus linter - [#3058](#3058) [`58f942cb9c`](58f942c) Thanks [@nishasy](https://github.com/nishasy)! - Add Python Program widget save warnings to perseus linter - [#3061](#3061) [`022624f6f6`](022624f) Thanks [@nishasy](https://github.com/nishasy)! - Add Interactive Graph widget save warnings to perseus linter - [#3057](#3057) [`723d2101e7`](723d210) Thanks [@nishasy](https://github.com/nishasy)! - Add Phet Simulation widget save warnings to perseus linter ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`bae4cfa6f1`](bae4cfa), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210)]: - @khanacademy/perseus-core@20.2.1 - @khanacademy/kas@2.1.5 - @khanacademy/kmath@2.2.18 - @khanacademy/perseus-utils@2.1.3 ## @khanacademy/kas@2.1.5 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`01d273fcfb`](01d273f)]: - @khanacademy/perseus-utils@2.1.3 ## @khanacademy/keypad-context@3.2.18 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`bae4cfa6f1`](bae4cfa), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210)]: - @khanacademy/perseus-core@20.2.1 ## @khanacademy/kmath@2.2.18 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`bae4cfa6f1`](bae4cfa), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210)]: - @khanacademy/perseus-core@20.2.1 - @khanacademy/perseus-utils@2.1.3 ## @khanacademy/math-input@26.2.21 ### Patch Changes - [#3066](#3066) [`2baef997c0`](2baef99) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Sync Dependencies and Hashes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`bae4cfa6f1`](bae4cfa), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210)]: - @khanacademy/perseus-core@20.2.1 - @khanacademy/keypad-context@3.2.18 - @khanacademy/perseus-utils@2.1.3 ## @khanacademy/perseus@72.2.1 ### Patch Changes - [#3060](#3060) [`bae4cfa6f1`](bae4cfa) Thanks [@nishasy](https://github.com/nishasy)! - Add Label Image widget save warnings to perseus linter - [#3066](#3066) [`2baef997c0`](2baef99) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Sync Dependencies and Hashes - [#3058](#3058) [`58f942cb9c`](58f942c) Thanks [@nishasy](https://github.com/nishasy)! - Add Python Program widget save warnings to perseus linter - [#3061](#3061) [`022624f6f6`](022624f) Thanks [@nishasy](https://github.com/nishasy)! - Add Interactive Graph widget save warnings to perseus linter - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - [#3057](#3057) [`723d2101e7`](723d210) Thanks [@nishasy](https://github.com/nishasy)! - Add Phet Simulation widget save warnings to perseus linter - [#3038](#3038) [`d697b6439b`](d697b64) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - Updates css to reference new radio data widget name - Updated dependencies \[[`c9066e6ac0`](c9066e6), [`bae4cfa6f1`](bae4cfa), [`5f01d377f4`](5f01d37), [`2baef997c0`](2baef99), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210)]: - @khanacademy/perseus-linter@4.6.0 - @khanacademy/perseus-core@20.2.1 - @khanacademy/math-input@26.2.21 - @khanacademy/kas@2.1.5 - @khanacademy/keypad-context@3.2.18 - @khanacademy/kmath@2.2.18 - @khanacademy/perseus-score@8.0.7 - @khanacademy/perseus-utils@2.1.3 - @khanacademy/pure-markdown@2.2.3 - @khanacademy/simple-markdown@2.1.3 ## @khanacademy/perseus-core@20.2.1 ### Patch Changes - [#3060](#3060) [`bae4cfa6f1`](bae4cfa) Thanks [@nishasy](https://github.com/nishasy)! - Add Label Image widget save warnings to perseus linter - [#3058](#3058) [`58f942cb9c`](58f942c) Thanks [@nishasy](https://github.com/nishasy)! - Add Python Program widget save warnings to perseus linter - [#3061](#3061) [`022624f6f6`](022624f) Thanks [@nishasy](https://github.com/nishasy)! - Add Interactive Graph widget save warnings to perseus linter - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - [#3057](#3057) [`723d2101e7`](723d210) Thanks [@nishasy](https://github.com/nishasy)! - Add Phet Simulation widget save warnings to perseus linter - Updated dependencies \[[`01d273fcfb`](01d273f)]: - @khanacademy/kas@2.1.5 - @khanacademy/perseus-utils@2.1.3 - @khanacademy/pure-markdown@2.2.3 ## @khanacademy/perseus-score@8.0.7 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`bae4cfa6f1`](bae4cfa), [`58f942cb9c`](58f942c), [`022624f6f6`](022624f), [`01d273fcfb`](01d273f), [`723d2101e7`](723d210)]: - @khanacademy/perseus-core@20.2.1 - @khanacademy/kas@2.1.5 - @khanacademy/kmath@2.2.18 - @khanacademy/perseus-utils@2.1.3 ## @khanacademy/perseus-utils@2.1.3 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking ## @khanacademy/pure-markdown@2.2.3 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`01d273fcfb`](01d273f)]: - @khanacademy/perseus-utils@2.1.3 - @khanacademy/simple-markdown@2.1.3 ## @khanacademy/simple-markdown@2.1.3 ### Patch Changes - [#3006](#3006) [`01d273fcfb`](01d273f) Thanks [@Myranae](https://github.com/Myranae)! - Add catalog hash system for dependency tracking - Updated dependencies \[[`01d273fcfb`](01d273f)]: - @khanacademy/perseus-utils@2.1.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
To make sure that save warnings get surfaced, I'm adding them to the Perseus linter. This means that they should also show up as part of the issues panel.
In this PR, I'm adding a linter rule for numeric input widget save warnings.
Issue: https://khanacademy.atlassian.net/browse/LEMS-3643
Test plan:
pnpm jest packages/perseus-linter/src/rules/numeric-input-widget-error.test.tsStorybook
/?path=/story/editors-editorpage--demo