@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/index.js CHANGED
@@ -27,7 +27,7 @@ function _interopNamespaceCompat(e) {
27
27
 
28
28
  var KAS__namespace = /*#__PURE__*/_interopNamespaceCompat(KAS);
29
29
 
30
- const libName="@khanacademy/perseus-linter";const libVersion="4.4.7";perseusUtils.addLibraryVersionToPerseusDebug(libName,libVersion);
30
+ const libName="@khanacademy/perseus-linter";const libVersion="4.5.0";perseusUtils.addLibraryVersionToPerseusDebug(libName,libVersion);
31
31
 
32
32
  const linterContextDefault={contentType:"",highlightLint:false,paths:[],stack:[]};
33
33
 
@@ -103,7 +103,7 @@ var LongParagraph = Rule.makeRule({name:"long-paragraph",severity:Rule.Severity.
103
103
  This paragraph is ${content.length} characters long.
104
104
  Shorten it to 500 characters or fewer.`}});
105
105
 
106
- 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."}}});
106
+ 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."}}});
107
107
 
108
108
  var MathAdjacent = Rule.makeRule({name:"math-adjacent",severity:Rule.Severity.WARNING,selector:"blockMath+blockMath",message:`Adjacent math blocks:
109
109
  combine the blocks between \\begin{align} and \\end{align}`});
@@ -133,7 +133,7 @@ var NestedLists = Rule.makeRule({name:"nested-lists",severity:Rule.Severity.WARN
133
133
  nested lists are hard to read on mobile devices;
134
134
  do not use additional indentation.`});
135
135
 
136
- 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}});
136
+ 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}});
137
137
 
138
138
  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."}}});
139
139