@khanacademy/perseus-linter 0.3.3 → 0.3.5

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.d.ts CHANGED
@@ -1,7 +1,32 @@
1
1
  import Rule from "./rule";
2
+ export { libVersion } from "./version";
2
3
  export { linterContextProps, linterContextDefault } from "./proptypes";
3
4
  export type { LinterContextProps } from "./types";
4
5
  declare const allLintRules: ReadonlyArray<any>;
5
6
  export { Rule, allLintRules as rules };
7
+ /**
8
+ * Run the Perseus linter over the specified markdown parse tree,
9
+ * with the specified context object, and
10
+ * return a (possibly empty) array of lint warning objects. If the
11
+ * highlight argument is true, this function also modifies the parse
12
+ * tree to add "lint" nodes that can be visually rendered,
13
+ * highlighting the problems for the user. The optional rules argument
14
+ * is an array of Rule objects specifying which lint rules should be
15
+ * applied to this parse tree. When omitted, a default set of rules is used.
16
+ *
17
+ * The context object may have additional properties that some lint
18
+ * rules require:
19
+ *
20
+ * context.content is the source content string that was parsed to create
21
+ * the parse tree.
22
+ *
23
+ * context.widgets is the widgets object associated
24
+ * with the content string
25
+ *
26
+ * TODO: to make this even more general, allow the first argument to be
27
+ * a string and run the parser over it in that case? (but ignore highlight
28
+ * in that case). This would allow the one function to be used for both
29
+ * online linting and batch linting.
30
+ */
6
31
  export declare function runLinter(tree: any, context: any, highlight: boolean, rules?: ReadonlyArray<any>): ReadonlyArray<any>;
7
32
  export declare function pushContextStack(context: any, name: string): any;
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var perseusError = require('@khanacademy/perseus-error');
6
+ var perseusCore = require('@khanacademy/perseus-core');
6
7
  var PropTypes = require('prop-types');
7
8
 
8
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -1550,6 +1551,11 @@ class Stack {
1550
1551
  }
1551
1552
  }
1552
1553
 
1554
+ // This file is processed by a Rollup plugin (replace) to inject the production
1555
+ const libName = "@khanacademy/perseus-linter";
1556
+ const libVersion = "0.3.5";
1557
+ perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
1558
+
1553
1559
  // Define the shape of the linter context object that is passed through the
1554
1560
  const linterContextProps = PropTypes__default["default"].shape({
1555
1561
  contentType: PropTypes__default["default"].string,
@@ -1566,30 +1572,30 @@ const linterContextDefault = {
1566
1572
 
1567
1573
  const allLintRules = AllRules.filter(r => r.severity < Rule.Severity.BULK_WARNING);
1568
1574
 
1569
- //
1570
- // Run the Perseus linter over the specified markdown parse tree,
1571
- // with the specified context object, and
1572
- // return a (possibly empty) array of lint warning objects. If the
1573
- // highlight argument is true, this function also modifies the parse
1574
- // tree to add "lint" nodes that can be visually rendered,
1575
- // highlighting the problems for the user. The optional rules argument
1576
- // is an array of Rule objects specifying which lint rules should be
1577
- // applied to this parse tree. When omitted, a default set of rules is used.
1578
- //
1579
- // The context object may have additional properties that some lint
1580
- // rules require:
1581
- //
1582
- // context.content is the source content string that was parsed to create
1583
- // the parse tree.
1584
- //
1585
- // context.widgets is the widgets object associated
1586
- // with the content string
1587
- //
1588
- // TODO: to make this even more general, allow the first argument to be
1589
- // a string and run the parser over it in that case? (but ignore highlight
1590
- // in that case). This would allow the one function to be used for both
1591
- // online linting and batch linting.
1592
- //
1575
+ /**
1576
+ * Run the Perseus linter over the specified markdown parse tree,
1577
+ * with the specified context object, and
1578
+ * return a (possibly empty) array of lint warning objects. If the
1579
+ * highlight argument is true, this function also modifies the parse
1580
+ * tree to add "lint" nodes that can be visually rendered,
1581
+ * highlighting the problems for the user. The optional rules argument
1582
+ * is an array of Rule objects specifying which lint rules should be
1583
+ * applied to this parse tree. When omitted, a default set of rules is used.
1584
+ *
1585
+ * The context object may have additional properties that some lint
1586
+ * rules require:
1587
+ *
1588
+ * context.content is the source content string that was parsed to create
1589
+ * the parse tree.
1590
+ *
1591
+ * context.widgets is the widgets object associated
1592
+ * with the content string
1593
+ *
1594
+ * TODO: to make this even more general, allow the first argument to be
1595
+ * a string and run the parser over it in that case? (but ignore highlight
1596
+ * in that case). This would allow the one function to be used for both
1597
+ * online linting and batch linting.
1598
+ */
1593
1599
  function runLinter(tree, context, highlight) {
1594
1600
  let rules = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : allLintRules;
1595
1601
  const warnings = [];
@@ -1822,6 +1828,7 @@ function pushContextStack(context, name) {
1822
1828
  }
1823
1829
 
1824
1830
  exports.Rule = Rule;
1831
+ exports.libVersion = libVersion;
1825
1832
  exports.linterContextDefault = linterContextDefault;
1826
1833
  exports.linterContextProps = linterContextProps;
1827
1834
  exports.pushContextStack = pushContextStack;