@khanacademy/perseus-linter 0.4.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/README.md
ADDED
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PerseusError, Errors } from '@khanacademy/perseus-
|
|
2
|
-
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
|
|
1
|
+
import { PerseusError, Errors, addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
|
|
5
4
|
function _extends() {
|
|
@@ -1172,12 +1171,26 @@ nested lists are hard to read on mobile devices;
|
|
|
1172
1171
|
do not use additional indentation.`
|
|
1173
1172
|
});
|
|
1174
1173
|
|
|
1175
|
-
var
|
|
1176
|
-
name: "
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
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
|
+
}
|
|
1181
1194
|
});
|
|
1182
1195
|
|
|
1183
1196
|
var TableMissingCells = Rule.makeRule({
|
|
@@ -1227,7 +1240,7 @@ do not put widgets inside of tables.`
|
|
|
1227
1240
|
});
|
|
1228
1241
|
|
|
1229
1242
|
// TODO(davidflanagan):
|
|
1230
|
-
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,
|
|
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];
|
|
1231
1244
|
|
|
1232
1245
|
/**
|
|
1233
1246
|
* TreeTransformer is a class for traversing and transforming trees. Create a
|
|
@@ -1768,7 +1781,7 @@ class Stack {
|
|
|
1768
1781
|
|
|
1769
1782
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
1770
1783
|
const libName = "@khanacademy/perseus-linter";
|
|
1771
|
-
const libVersion = "
|
|
1784
|
+
const libVersion = "1.1.0";
|
|
1772
1785
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
1773
1786
|
|
|
1774
1787
|
// Define the shape of the linter context object that is passed through the
|