@khanacademy/perseus-linter 0.1.0 → 0.2.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/CHANGELOG.md +7 -0
- package/dist/es/index.js +2 -2
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/matcher_test.js +1 -1
- package/src/__tests__/rule_test.js +1 -1
- package/src/__tests__/selector-parser_test.js +1 -1
- package/src/__tests__/tree-transformer_test.js +1 -1
- package/src/index.js +1 -1
- package/src/rule.js +3 -3
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import * as PureMarkdown from "@khanacademy/pure-markdown";
|
|
|
8
8
|
import Selector from "../selector.js";
|
|
9
9
|
import TreeTransformer from "../tree-transformer.js";
|
|
10
10
|
|
|
11
|
-
describe("
|
|
11
|
+
describe("PerseusLinter selector matching:", () => {
|
|
12
12
|
const markdown = `
|
|
13
13
|
### A
|
|
14
14
|
|
|
@@ -4,7 +4,7 @@ import * as PureMarkdown from "@khanacademy/pure-markdown";
|
|
|
4
4
|
import Rule from "../rule.js";
|
|
5
5
|
import TreeTransformer from "../tree-transformer.js";
|
|
6
6
|
|
|
7
|
-
describe("
|
|
7
|
+
describe("PerseusLinter lint Rules class", () => {
|
|
8
8
|
const markdown = `
|
|
9
9
|
## This Heading is in Title Case
|
|
10
10
|
|
package/src/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const allLintRules: $ReadOnlyArray<$FlowFixMe> = AllRules.filter(
|
|
|
13
13
|
export {Rule, allLintRules as rules};
|
|
14
14
|
|
|
15
15
|
//
|
|
16
|
-
// Run the
|
|
16
|
+
// Run the Perseus linter over the specified markdown parse tree,
|
|
17
17
|
// with the specified context object, and
|
|
18
18
|
// return a (possibly empty) array of lint warning objects. If the
|
|
19
19
|
// highlight argument is true, this function also modifies the parse
|
package/src/rule.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
/**
|
|
3
|
-
* The Rule class represents a
|
|
3
|
+
* The Rule class represents a Perseus lint rule. A Rule instance has a check()
|
|
4
4
|
* method that takes the same (node, state, content) arguments that a
|
|
5
5
|
* TreeTransformer traversal callback function does. Call the check() method
|
|
6
6
|
* during a tree traversal to determine whether the current node of the tree
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* an error message, and the start and end positions within the node's content
|
|
10
10
|
* string of the lint.
|
|
11
11
|
*
|
|
12
|
-
* A
|
|
12
|
+
* A Perseus lint rule consists of a name, a severity, a selector, a pattern
|
|
13
13
|
* (RegExp) and two functions. The check() method uses the selector, pattern,
|
|
14
14
|
* and functions as follows:
|
|
15
15
|
*
|
|
@@ -178,7 +178,7 @@ export type LintTester = (
|
|
|
178
178
|
export type AppliesTester = (context: LintRuleContextObject) => boolean;
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
* A Rule object describes a
|
|
181
|
+
* A Rule object describes a Perseus lint rule. See the comment at the top of
|
|
182
182
|
* this file for detailed description.
|
|
183
183
|
*/
|
|
184
184
|
export default class Rule {
|