@khanacademy/perseus-linter 0.0.0-PR3053-20251120010217 → 0.0.0-PR3053-20251121221210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -3,7 +3,7 @@ import { PerseusError, Errors, CoreWidgetRegistry } from '@khanacademy/perseus-c
3
3
  import * as KAS from '@khanacademy/kas';
4
4
  import { parse, traverseContent } from '@khanacademy/pure-markdown';
5
5
 
6
- const libName="@khanacademy/perseus-linter";const libVersion="4.4.7";addLibraryVersionToPerseusDebug(libName,libVersion);
6
+ const libName="@khanacademy/perseus-linter";const libVersion="4.5.0";addLibraryVersionToPerseusDebug(libName,libVersion);
7
7
 
8
8
  const linterContextDefault={contentType:"",highlightLint:false,paths:[],stack:[]};
9
9
 
@@ -79,7 +79,7 @@ var LongParagraph = Rule.makeRule({name:"long-paragraph",severity:Rule.Severity.
79
79
  This paragraph is ${content.length} characters long.
80
80
  Shorten it to 500 characters or fewer.`}});
81
81
 
82
- var MatcherWidgetError = Rule.makeRule({name:"matcher-widget-error",severity:Rule.Severity.ERROR,selector:"widget",lint:function(state,content,nodes,match,context){if(state.currentNode().widgetType!=="matcher"){return}const nodeId=state.currentNode().id;if(!nodeId){return}const widget=context&&context.widgets&&context.widgets[nodeId];if(!widget){return}if(widget.options.left.length!==widget.options.right.length){return "The two halves of the matcher have different numbers of cards."}}});
82
+ var MatcherWidgetError = Rule.makeRule({name:"matcher-widget-error",severity:Rule.Severity.ERROR,selector:"widget",lint:function(state,content,nodes,match,context){if(state.currentNode().widgetType!=="matcher"){return}const nodeId=state.currentNode().id;if(!nodeId){return}const widget=context?.widgets?.[nodeId];if(!widget){return}if(widget.options.left.length!==widget.options.right.length){return "The two halves of the matcher have different numbers of cards."}}});
83
83
 
84
84
  var MathAdjacent = Rule.makeRule({name:"math-adjacent",severity:Rule.Severity.WARNING,selector:"blockMath+blockMath",message:`Adjacent math blocks:
85
85
  combine the blocks between \\begin{align} and \\end{align}`});
@@ -109,7 +109,7 @@ var NestedLists = Rule.makeRule({name:"nested-lists",severity:Rule.Severity.WARN
109
109
  nested lists are hard to read on mobile devices;
110
110
  do not use additional indentation.`});
111
111
 
112
- var NumericInputWidgetError = Rule.makeRule({name:"numeric-input-widget-error",severity:Rule.Severity.ERROR,selector:"widget",lint:function(state,content,nodes,match,context){if(state.currentNode().widgetType!=="numeric-input"){return}const nodeId=state.currentNode().id;if(!nodeId){return}const widget=context&&context.widgets&&context.widgets[nodeId];if(!widget){return}const issues=[];const answers=widget.options.answers;if(answers.some(answer=>answer.value==null)){issues.push("One or more answers is empty");}answers.forEach((answer,i)=>{const formatError=answer.strict&&(!answer.answerForms||answer.answerForms.length===0);if(formatError){issues.push(`Answer ${i+1} requires a format, but no format was selected`);}});const allWarningsString=issues.join("\n\n");return allWarningsString}});
112
+ var NumericInputWidgetError = Rule.makeRule({name:"numeric-input-widget-error",severity:Rule.Severity.ERROR,selector:"widget",lint:function(state,content,nodes,match,context){if(state.currentNode().widgetType!=="numeric-input"){return}const nodeId=state.currentNode().id;if(!nodeId){return}const widget=context?.widgets?.[nodeId];if(!widget){return}const issues=[];const answers=widget.options.answers;if(answers.some(answer=>answer.value==null)){issues.push("One or more answers is empty");}answers.forEach((answer,i)=>{const formatError=answer.strict&&(!answer.answerForms||answer.answerForms.length===0);if(formatError){issues.push(`Answer ${i+1} requires a format, but no format was selected`);}});const allWarningsString=issues.join("\n\n");return allWarningsString}});
113
113
 
114
114
  var RadioWidgetError = Rule.makeRule({name:"radio-widget-error",severity:Rule.Severity.ERROR,selector:"widget",lint:function(state,content,nodes,match,context){if(state.currentNode().widgetType!=="radio"){return}const nodeId=state.currentNode().id;if(!nodeId){return}const widget=context?.widgets?.[nodeId];if(!widget){return}const choices=widget.options.choices;if(!choices.some(choice=>choice.correct)){return "No choice is marked as correct."}}});
115
115