Skip to content

Conversation

@nishasy
Copy link
Contributor

@nishasy nishasy commented Oct 28, 2025

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:

  • Adding a linter rule for radio widget save warnings
  • Adding a linter rule for expression widget save warnings
  • Updating the issues panel to handle severe lint rules differently than warnings

Issue: https://khanacademy.atlassian.net/browse/LEMS-3643

Test plan:

pnpm jest packages/perseus-linter/src/rules/radio-widget-error.test.ts
pnpm jest packages/perseus-linter/src/rules/expression-widget-error.test.ts

Storybook

  • Go to /?path=/story/editors-editorpage--demo
  • Add a new radio widget
  • Confirm that the radio save warning shows up
  • Create a new expression widget
  • Confirm there's an error for no answers being present
  • Add 1.1. as an answer and set it to "wrong"
  • Confirm that two messages show up under the expression error - no correct answers and cannot parse
Radio Expression
Screenshot 2025-11-18 at 12 04 03 PM Screenshot 2025-11-18 at 12 03 44 PM

@nishasy nishasy self-assigned this Oct 28, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

Size Change: +523 B (+0.11%)

Total Size: 499 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 97.4 kB +177 B (+0.18%)
packages/perseus-linter/dist/es/index.js 7.56 kB +346 B (+4.8%) 🔍
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.8 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.98 kB
packages/math-input/dist/es/index.js 99.2 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 13.1 kB
packages/perseus-core/dist/es/index.js 22.4 kB
packages/perseus-score/dist/es/index.js 9.2 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 204 kB
packages/perseus/dist/es/strings.js 7.73 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (0c35c02) and published it to npm. You
can install it using the tag PR2992.

Example:

pnpm add @khanacademy/perseus@PR2992

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR2992

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR2992

@nishasy nishasy changed the title Add radio and expression save wanrnings to the perseus linter. Add a callback for issues changed to item-editor.tsx. Add radio and expression save wanrnings to the perseus linter. Oct 29, 2025
@nishasy nishasy changed the title Add radio and expression save wanrnings to the perseus linter. Add radio and expression save warnings to the perseus linter. Oct 29, 2025
@nishasy nishasy marked this pull request as ready for review November 18, 2025 20:08
backgroundColor:
issue.impact === "high"
? semanticColor.core.background.critical.subtle
: semanticColor.core.background.warning.subtle,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these should be using feedback:

    issue.impact === "high"
           ? semanticColor.feedback.critical.subtle.background
           : semanticColor.feedback.warning.subtle.background;


// 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];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Could this be an optional statement?

const widget = context?.widgets?[nodeId];

Copy link
Contributor

@mark-fitzgerald mark-fitzgerald left a comment

Choose a reason for hiding this comment

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

Thanks for expanding on the issues panel and implementing these save warnings.

@github-actions github-actions bot added schema-change Attached to PRs when we detect Perseus Schema changes in it item-splitting-change and removed schema-change Attached to PRs when we detect Perseus Schema changes in it item-splitting-change labels Nov 19, 2025
@nishasy nishasy merged commit fc6273b into main Nov 19, 2025
11 checks passed
@nishasy nishasy deleted the lint-error-1-radio-expression branch November 19, 2025 19:49
nishasy added a commit that referenced this pull request Nov 20, 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/[email protected]

### Minor Changes

- [#3037](#3037)
[`39c890acc5`](39c890a)
Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Allow
zooming on Graphie images


- [#3009](#3009)
[`8d3beb2743`](8d3beb2)
Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (DX) | Remove
ZoomService in favor of WB Modal

### Patch Changes

- [#3044](#3044)
[`78e15ef4e6`](78e15ef)
Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Image
zoom fixes - remove scrolling for portrait images, command click on main
image instead of zoomed image


- [#3043](#3043)
[`98245b0f3a`](98245b0)
Thanks [@ivyolamit](https://github.com/ivyolamit)! - Fix bottom margin
when rendering in mobile

- Updated dependencies
\[[`ceb7a70bfa`](ceb7a70),
[`fc6273b10d`](fc6273b),
[`18261c3294`](18261c3)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#3047](#3047)
[`b84bc99def`](b84bc99)
Thanks [@nishasy](https://github.com/nishasy)! - Add Issues Panel to
Article Editor


- [#2992](#2992)
[`fc6273b10d`](fc6273b)
Thanks [@nishasy](https://github.com/nishasy)! - Add radio and
expression save wanrnings to the perseus linter. Add a callback for
issues changed to item-editor.tsx.


- [#3037](#3037)
[`39c890acc5`](39c890a)
Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Allow
zooming on Graphie images

### Patch Changes

- [#3044](#3044)
[`78e15ef4e6`](78e15ef)
Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (UX) | Image
zoom fixes - remove scrolling for portrait images, command click on main
image instead of zoomed image


- [#3049](#3049)
[`18261c3294`](18261c3)
Thanks [@nishasy](https://github.com/nishasy)! - Add Free Response
widget save warnings to perseus linter

- Updated dependencies
\[[`ceb7a70bfa`](ceb7a70),
[`78e15ef4e6`](78e15ef),
[`fc6273b10d`](fc6273b),
[`39c890acc5`](39c890a),
[`8d3beb2743`](8d3beb2),
[`98245b0f3a`](98245b0),
[`18261c3294`](18261c3)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2992](#2992)
[`fc6273b10d`](fc6273b)
Thanks [@nishasy](https://github.com/nishasy)! - Add radio and
expression save wanrnings to the perseus linter. Add a callback for
issues changed to item-editor.tsx.


- [#3049](#3049)
[`18261c3294`](18261c3)
Thanks [@nishasy](https://github.com/nishasy)! - Add Free Response
widget save warnings to perseus linter

## @khanacademy/[email protected]

### Patch Changes

- [#3054](#3054)
[`ceb7a70bfa`](ceb7a70)
Thanks [@ivyolamit](https://github.com/ivyolamit)! - Add tabs and icon
button package in math-input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants