@khanacademy/perseus-linter 0.3.12 → 0.4.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 +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -51,9 +51,9 @@ class Selector {
|
|
|
51
51
|
* Instead call the static Selector.parse() method.
|
|
52
52
|
*/
|
|
53
53
|
class Parser {
|
|
54
|
-
// We do lexing with a simple regular expression
|
|
55
|
-
// The array of tokens
|
|
56
|
-
// Which token in the array we're looking at now
|
|
54
|
+
static TOKENS; // We do lexing with a simple regular expression
|
|
55
|
+
tokens; // The array of tokens
|
|
56
|
+
tokenIndex; // Which token in the array we're looking at now
|
|
57
57
|
|
|
58
58
|
constructor(s) {
|
|
59
59
|
// Normalize whitespace:
|
|
@@ -212,6 +212,7 @@ class ParseError extends Error {
|
|
|
212
212
|
* first.
|
|
213
213
|
*/
|
|
214
214
|
class SelectorList extends Selector {
|
|
215
|
+
selectors;
|
|
215
216
|
constructor(selectors) {
|
|
216
217
|
super();
|
|
217
218
|
this.selectors = selectors;
|
|
@@ -254,6 +255,7 @@ class AnyNode extends Selector {
|
|
|
254
255
|
* it matches any node whose `type` property is a specified string
|
|
255
256
|
*/
|
|
256
257
|
class TypeSelector extends Selector {
|
|
258
|
+
type;
|
|
257
259
|
constructor(type) {
|
|
258
260
|
super();
|
|
259
261
|
this.type = type;
|
|
@@ -277,6 +279,8 @@ class TypeSelector extends Selector {
|
|
|
277
279
|
* method.
|
|
278
280
|
*/
|
|
279
281
|
class SelectorCombinator extends Selector {
|
|
282
|
+
left;
|
|
283
|
+
right;
|
|
280
284
|
constructor(left, right) {
|
|
281
285
|
super();
|
|
282
286
|
this.left = left;
|
|
@@ -543,13 +547,14 @@ class SiblingCombinator extends SelectorCombinator {
|
|
|
543
547
|
* this file for detailed description.
|
|
544
548
|
*/
|
|
545
549
|
class Rule {
|
|
546
|
-
// The name of the rule
|
|
547
|
-
// The severity of the rule
|
|
548
|
-
// The specified selector or the DEFAULT_SELECTOR
|
|
549
|
-
// A regular expression if one was specified
|
|
550
|
-
// The lint-testing function or a default
|
|
551
|
-
// Checks to see if we should apply a rule or not
|
|
552
|
-
// The error message for use with the default function
|
|
550
|
+
name; // The name of the rule
|
|
551
|
+
severity; // The severity of the rule
|
|
552
|
+
selector; // The specified selector or the DEFAULT_SELECTOR
|
|
553
|
+
pattern; // A regular expression if one was specified
|
|
554
|
+
lint; // The lint-testing function or a default
|
|
555
|
+
applies; // Checks to see if we should apply a rule or not
|
|
556
|
+
message; // The error message for use with the default function
|
|
557
|
+
static DEFAULT_SELECTOR;
|
|
553
558
|
|
|
554
559
|
// The comment at the top of this file has detailed docs for
|
|
555
560
|
// this constructor and its arguments
|
|
@@ -1277,6 +1282,8 @@ var AllRules = [AbsoluteUrl, BlockquotedMath, BlockquotedWidget, DoubleSpacingAf
|
|
|
1277
1282
|
// This is the TreeTransformer class described in detail at the
|
|
1278
1283
|
// top of this file.
|
|
1279
1284
|
class TreeTransformer {
|
|
1285
|
+
root;
|
|
1286
|
+
|
|
1280
1287
|
// To create a tree transformer, just pass the root node of the tree
|
|
1281
1288
|
constructor(root) {
|
|
1282
1289
|
this.root = root;
|
|
@@ -1424,6 +1431,7 @@ class TreeTransformer {
|
|
|
1424
1431
|
**/
|
|
1425
1432
|
class TraversalState {
|
|
1426
1433
|
// The root node of the tree being traversed
|
|
1434
|
+
root;
|
|
1427
1435
|
|
|
1428
1436
|
// These are internal state properties. Use the accessor methods defined
|
|
1429
1437
|
// below instead of using these properties directly. Note that the
|
|
@@ -1431,6 +1439,11 @@ class TraversalState {
|
|
|
1431
1439
|
// elements, depending on whether we just recursed on an array or on a
|
|
1432
1440
|
// node. This is hard for TypeScript to deal with, so you'll see a number of
|
|
1433
1441
|
// type casts through the any type when working with these two properties.
|
|
1442
|
+
_currentNode;
|
|
1443
|
+
_containers;
|
|
1444
|
+
_indexes;
|
|
1445
|
+
_ancestors;
|
|
1446
|
+
|
|
1434
1447
|
// The constructor just stores the root node and creates empty stacks.
|
|
1435
1448
|
constructor(root) {
|
|
1436
1449
|
this.root = root;
|
|
@@ -1688,6 +1701,7 @@ class TraversalState {
|
|
|
1688
1701
|
* the TraversalState class simpler in a number of places.
|
|
1689
1702
|
*/
|
|
1690
1703
|
class Stack {
|
|
1704
|
+
stack;
|
|
1691
1705
|
constructor(array) {
|
|
1692
1706
|
this.stack = array ? array.slice(0) : [];
|
|
1693
1707
|
}
|
|
@@ -1747,7 +1761,7 @@ class Stack {
|
|
|
1747
1761
|
|
|
1748
1762
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
1749
1763
|
const libName = "@khanacademy/perseus-linter";
|
|
1750
|
-
const libVersion = "0.
|
|
1764
|
+
const libVersion = "0.4.0";
|
|
1751
1765
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
1752
1766
|
|
|
1753
1767
|
// Define the shape of the linter context object that is passed through the
|