@khanacademy/perseus-linter 1.0.0 → 1.1.0
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 +24 -2
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/rules/static-widget-in-question-stem.d.ts +3 -0
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -1171,6 +1171,28 @@ nested lists are hard to read on mobile devices;
|
|
|
1171
1171
|
do not use additional indentation.`
|
|
1172
1172
|
});
|
|
1173
1173
|
|
|
1174
|
+
var StaticWidgetInQuestionStem = Rule.makeRule({
|
|
1175
|
+
name: "static-widget-in-question-stem",
|
|
1176
|
+
severity: Rule.Severity.WARNING,
|
|
1177
|
+
selector: "widget",
|
|
1178
|
+
lint: (state, content, nodes, match, context) => {
|
|
1179
|
+
var _context$widgets;
|
|
1180
|
+
if (context.contentType !== "exercise") {
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
if (context.stack.includes("hint")) {
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
const widget = context == null || (_context$widgets = context.widgets) == null ? void 0 : _context$widgets[state.currentNode().id];
|
|
1187
|
+
if (!widget) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
if (widget.static) {
|
|
1191
|
+
return `Widget in question stem is static (non-interactive).`;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1174
1196
|
var TableMissingCells = Rule.makeRule({
|
|
1175
1197
|
name: "table-missing-cells",
|
|
1176
1198
|
severity: Rule.Severity.WARNING,
|
|
@@ -1218,7 +1240,7 @@ do not put widgets inside of tables.`
|
|
|
1218
1240
|
});
|
|
1219
1241
|
|
|
1220
1242
|
// TODO(davidflanagan):
|
|
1221
|
-
var AllRules = [AbsoluteUrl, BlockquotedMath, BlockquotedWidget, DoubleSpacingAfterTerminal, ExtraContentSpacing, HeadingLevel1, HeadingLevelSkip, HeadingSentenceCase, HeadingTitleCase, ImageAltText, ImageInTable, LinkClickHere, LongParagraph, MathAdjacent, MathAlignExtraBreak, MathAlignLinebreaks, MathEmpty, MathFontSize, MathFrac, MathNested, MathStartsWithSpace, MathTextEmpty, NestedLists, TableMissingCells, UnescapedDollar, WidgetInTable, MathWithoutDollars, UnbalancedCodeDelimiters, ImageSpacesAroundUrls, ImageWidget];
|
|
1243
|
+
var AllRules = [AbsoluteUrl, BlockquotedMath, BlockquotedWidget, DoubleSpacingAfterTerminal, ExtraContentSpacing, HeadingLevel1, HeadingLevelSkip, HeadingSentenceCase, HeadingTitleCase, ImageAltText, ImageInTable, LinkClickHere, LongParagraph, MathAdjacent, MathAlignExtraBreak, MathAlignLinebreaks, MathEmpty, MathFontSize, MathFrac, MathNested, MathStartsWithSpace, MathTextEmpty, NestedLists, StaticWidgetInQuestionStem, TableMissingCells, UnescapedDollar, WidgetInTable, MathWithoutDollars, UnbalancedCodeDelimiters, ImageSpacesAroundUrls, ImageWidget];
|
|
1222
1244
|
|
|
1223
1245
|
/**
|
|
1224
1246
|
* TreeTransformer is a class for traversing and transforming trees. Create a
|
|
@@ -1759,7 +1781,7 @@ class Stack {
|
|
|
1759
1781
|
|
|
1760
1782
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
1761
1783
|
const libName = "@khanacademy/perseus-linter";
|
|
1762
|
-
const libVersion = "1.
|
|
1784
|
+
const libVersion = "1.1.0";
|
|
1763
1785
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
1764
1786
|
|
|
1765
1787
|
// Define the shape of the linter context object that is passed through the
|