@khanacademy/perseus-linter 0.2.5 → 0.3.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/.eslintrc.js +1 -0
- package/CHANGELOG.md +11 -0
- package/dist/es/index.js +277 -407
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +281 -398
- package/dist/index.js.flow +18 -2
- package/dist/index.js.map +1 -1
- package/dist/proptypes.d.ts +9 -0
- package/dist/proptypes.js.flow +17 -0
- package/dist/rule.d.ts +170 -0
- package/dist/rule.js.flow +86 -0
- package/dist/rules/absolute-url.d.ts +3 -0
- package/dist/rules/absolute-url.js.flow +9 -0
- package/dist/rules/all-rules.d.ts +2 -0
- package/dist/rules/all-rules.js.flow +9 -0
- package/dist/rules/blockquoted-math.d.ts +3 -0
- package/dist/rules/blockquoted-math.js.flow +9 -0
- package/dist/rules/blockquoted-widget.d.ts +3 -0
- package/dist/rules/blockquoted-widget.js.flow +9 -0
- package/dist/rules/double-spacing-after-terminal.d.ts +3 -0
- package/dist/rules/double-spacing-after-terminal.js.flow +9 -0
- package/dist/rules/extra-content-spacing.d.ts +3 -0
- package/dist/rules/extra-content-spacing.js.flow +9 -0
- package/dist/rules/heading-level-1.d.ts +3 -0
- package/dist/rules/heading-level-1.js.flow +9 -0
- package/dist/rules/heading-level-skip.d.ts +3 -0
- package/dist/rules/heading-level-skip.js.flow +9 -0
- package/dist/rules/heading-sentence-case.d.ts +3 -0
- package/dist/rules/heading-sentence-case.js.flow +9 -0
- package/dist/rules/heading-title-case.d.ts +3 -0
- package/dist/rules/heading-title-case.js.flow +9 -0
- package/dist/rules/image-alt-text.d.ts +3 -0
- package/dist/rules/image-alt-text.js.flow +9 -0
- package/dist/rules/image-in-table.d.ts +3 -0
- package/dist/rules/image-in-table.js.flow +9 -0
- package/dist/rules/image-spaces-around-urls.d.ts +3 -0
- package/dist/rules/image-spaces-around-urls.js.flow +9 -0
- package/dist/rules/image-widget.d.ts +3 -0
- package/dist/rules/image-widget.js.flow +9 -0
- package/dist/rules/link-click-here.d.ts +3 -0
- package/dist/rules/link-click-here.js.flow +9 -0
- package/dist/rules/lint-utils.d.ts +2 -0
- package/dist/rules/lint-utils.js.flow +8 -0
- package/dist/rules/long-paragraph.d.ts +3 -0
- package/dist/rules/long-paragraph.js.flow +9 -0
- package/dist/rules/math-adjacent.d.ts +3 -0
- package/dist/rules/math-adjacent.js.flow +9 -0
- package/dist/rules/math-align-extra-break.d.ts +3 -0
- package/dist/rules/math-align-extra-break.js.flow +9 -0
- package/dist/rules/math-align-linebreaks.d.ts +3 -0
- package/dist/rules/math-align-linebreaks.js.flow +9 -0
- package/dist/rules/math-empty.d.ts +3 -0
- package/dist/rules/math-empty.js.flow +9 -0
- package/dist/rules/math-font-size.d.ts +3 -0
- package/dist/rules/math-font-size.js.flow +9 -0
- package/dist/rules/math-frac.d.ts +3 -0
- package/dist/rules/math-frac.js.flow +9 -0
- package/dist/rules/math-nested.d.ts +3 -0
- package/dist/rules/math-nested.js.flow +9 -0
- package/dist/rules/math-starts-with-space.d.ts +3 -0
- package/dist/rules/math-starts-with-space.js.flow +9 -0
- package/dist/rules/math-text-empty.d.ts +3 -0
- package/dist/rules/math-text-empty.js.flow +9 -0
- package/dist/rules/math-without-dollars.d.ts +3 -0
- package/dist/rules/math-without-dollars.js.flow +9 -0
- package/dist/rules/nested-lists.d.ts +3 -0
- package/dist/rules/nested-lists.js.flow +9 -0
- package/dist/rules/profanity.d.ts +3 -0
- package/dist/rules/profanity.js.flow +9 -0
- package/dist/rules/table-missing-cells.d.ts +3 -0
- package/dist/rules/table-missing-cells.js.flow +9 -0
- package/dist/rules/unbalanced-code-delimiters.d.ts +3 -0
- package/dist/rules/unbalanced-code-delimiters.js.flow +9 -0
- package/dist/rules/unescaped-dollar.d.ts +3 -0
- package/dist/rules/unescaped-dollar.js.flow +9 -0
- package/dist/rules/widget-in-table.d.ts +3 -0
- package/dist/rules/widget-in-table.js.flow +9 -0
- package/dist/selector.d.ts +108 -0
- package/dist/selector.js.flow +31 -0
- package/dist/tree-transformer.d.ts +205 -0
- package/dist/tree-transformer.js.flow +253 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js.flow +12 -0
- package/package.json +4 -4
- package/src/__tests__/{matcher_test.js → matcher.test.ts} +60 -60
- package/src/__tests__/{rule_test.js → rule.test.ts} +13 -5
- package/src/__tests__/{rules_test.js → rules.test.ts} +99 -39
- package/src/__tests__/{selector-parser_test.js → selector-parser.test.ts} +1 -2
- package/src/__tests__/{tree-transformer_test.js → tree-transformer.test.ts} +39 -41
- package/src/{index.js → index.ts} +21 -23
- package/src/{proptypes.js → proptypes.ts} +4 -14
- package/src/{rule.js → rule.ts} +45 -38
- package/src/rules/{absolute-url.js → absolute-url.ts} +4 -5
- package/src/rules/all-rules.ts +71 -0
- package/src/rules/{blockquoted-math.js → blockquoted-math.ts} +3 -4
- package/src/rules/{blockquoted-widget.js → blockquoted-widget.ts} +3 -4
- package/src/rules/{double-spacing-after-terminal.js → double-spacing-after-terminal.ts} +3 -4
- package/src/rules/{extra-content-spacing.js → extra-content-spacing.ts} +3 -4
- package/src/rules/{heading-level-1.js → heading-level-1.ts} +3 -4
- package/src/rules/{heading-level-skip.js → heading-level-skip.ts} +3 -4
- package/src/rules/{heading-sentence-case.js → heading-sentence-case.ts} +3 -4
- package/src/rules/{heading-title-case.js → heading-title-case.ts} +11 -6
- package/src/rules/{image-alt-text.js → image-alt-text.ts} +3 -4
- package/src/rules/{image-in-table.js → image-in-table.ts} +3 -4
- package/src/rules/{image-spaces-around-urls.js → image-spaces-around-urls.ts} +3 -4
- package/src/rules/{image-widget.js → image-widget.ts} +3 -4
- package/src/rules/{link-click-here.js → link-click-here.ts} +3 -4
- package/src/rules/{lint-utils.js → lint-utils.ts} +1 -2
- package/src/rules/{long-paragraph.js → long-paragraph.ts} +3 -4
- package/src/rules/{math-adjacent.js → math-adjacent.ts} +3 -4
- package/src/rules/{math-align-extra-break.js → math-align-extra-break.ts} +3 -4
- package/src/rules/{math-align-linebreaks.js → math-align-linebreaks.ts} +3 -4
- package/src/rules/{math-empty.js → math-empty.ts} +3 -4
- package/src/rules/{math-font-size.js → math-font-size.ts} +3 -4
- package/src/rules/{math-frac.js → math-frac.ts} +3 -4
- package/src/rules/{math-nested.js → math-nested.ts} +3 -4
- package/src/rules/{math-starts-with-space.js → math-starts-with-space.ts} +3 -4
- package/src/rules/{math-text-empty.js → math-text-empty.ts} +3 -4
- package/src/rules/{math-without-dollars.js → math-without-dollars.ts} +3 -4
- package/src/rules/{nested-lists.js → nested-lists.ts} +3 -4
- package/src/rules/{profanity.js → profanity.ts} +3 -4
- package/src/rules/{table-missing-cells.js → table-missing-cells.ts} +3 -4
- package/src/rules/{unbalanced-code-delimiters.js → unbalanced-code-delimiters.ts} +3 -4
- package/src/rules/{unescaped-dollar.js → unescaped-dollar.ts} +3 -4
- package/src/rules/{widget-in-table.js → widget-in-table.ts} +3 -4
- package/src/{selector.js → selector.ts} +12 -13
- package/src/{tree-transformer.js → tree-transformer.ts} +24 -24
- package/src/types.ts +7 -0
- package/tsconfig.json +12 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/src/rules/all-rules.js +0 -72
- package/src/types.js +0 -10
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import type { LinterContextProps } from "./types";
|
|
3
|
+
export declare const linterContextProps: PropTypes.Requireable<PropTypes.InferProps<{
|
|
4
|
+
contentType: PropTypes.Requireable<string>;
|
|
5
|
+
highlightLint: PropTypes.Requireable<boolean>;
|
|
6
|
+
paths: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
7
|
+
stack: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
8
|
+
}>>;
|
|
9
|
+
export declare const linterContextDefault: LinterContextProps;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from "prop-types";
|
|
8
|
+
import type { LinterContextProps } from "./types";
|
|
9
|
+
declare export var linterContextProps: PropTypes.Requireable<
|
|
10
|
+
PropTypes.InferProps<{|
|
|
11
|
+
contentType: PropTypes.Requireable<string>,
|
|
12
|
+
highlightLint: PropTypes.Requireable<boolean>,
|
|
13
|
+
paths: PropTypes.Requireable<(string | null | void)[]>,
|
|
14
|
+
stack: PropTypes.Requireable<(string | null | void)[]>,
|
|
15
|
+
|}>
|
|
16
|
+
>;
|
|
17
|
+
declare export var linterContextDefault: LinterContextProps;
|
package/dist/rule.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Rule class represents a Perseus lint rule. A Rule instance has a check()
|
|
3
|
+
* method that takes the same (node, state, content) arguments that a
|
|
4
|
+
* TreeTransformer traversal callback function does. Call the check() method
|
|
5
|
+
* during a tree traversal to determine whether the current node of the tree
|
|
6
|
+
* violates the rule. If there is no violation, then check() returns
|
|
7
|
+
* null. Otherwise, it returns an object that includes the name of the rule,
|
|
8
|
+
* an error message, and the start and end positions within the node's content
|
|
9
|
+
* string of the lint.
|
|
10
|
+
*
|
|
11
|
+
* A Perseus lint rule consists of a name, a severity, a selector, a pattern
|
|
12
|
+
* (RegExp) and two functions. The check() method uses the selector, pattern,
|
|
13
|
+
* and functions as follows:
|
|
14
|
+
*
|
|
15
|
+
* - First, when determining which rules to apply to a particular piece of
|
|
16
|
+
* content, each rule can specify an optional function provided in the fifth
|
|
17
|
+
* parameter to evaluate whether or not we should be applying this rule.
|
|
18
|
+
* If the function returns false, we don't use the rule on this content.
|
|
19
|
+
*
|
|
20
|
+
* - Next, check() tests whether the node currently being traversed matches
|
|
21
|
+
* the selector. If it does not, then the rule does not apply at this node
|
|
22
|
+
* and there is no lint and check() returns null.
|
|
23
|
+
*
|
|
24
|
+
* - If the selector matched, then check() tests the text content of the node
|
|
25
|
+
* (and its children) against the pattern. If the pattern does not match,
|
|
26
|
+
* then there is no lint, and check() returns null.
|
|
27
|
+
*
|
|
28
|
+
* - If both the selector and pattern match, then check() calls the function
|
|
29
|
+
* passing the TraversalState object, the content string for the node, the
|
|
30
|
+
* array of nodes returned by the selector match, and the array of strings
|
|
31
|
+
* returned by the pattern match. This function can use these arguments to
|
|
32
|
+
* implement any kind of lint detection logic it wants. If it determines
|
|
33
|
+
* that there is no lint, then it should return null. Otherwise, it should
|
|
34
|
+
* return an error message as a string, or an object with `message`, `start`
|
|
35
|
+
* and `end` properties. The start and end properties are numbers that mark
|
|
36
|
+
* the beginning and end of the problematic content. Note that these numbers
|
|
37
|
+
* are relative to the content string passed to the traversal callback, not
|
|
38
|
+
* to the entire string that was used to generate the parse tree in the
|
|
39
|
+
* first place. TODO(davidflanagan): modify the simple-markdown library to
|
|
40
|
+
* have an option to add the text offset of each node to the parse
|
|
41
|
+
* tree. This will allows us to pinpoint lint errors within a long string
|
|
42
|
+
* of markdown text.
|
|
43
|
+
*
|
|
44
|
+
* - If the function returns null, then check() returns null. Otherwise,
|
|
45
|
+
* check() returns an object with `rule`, `message`, `start` and `end`
|
|
46
|
+
* properties. The value of the `rule` property is the name of the rule,
|
|
47
|
+
* which is useful for error reporting purposes.
|
|
48
|
+
*
|
|
49
|
+
* The name, severity, selector, pattern and function arguments to the Rule()
|
|
50
|
+
* constructor are optional, but you may not omit both the selector and the
|
|
51
|
+
* pattern. If you do not specify a selector, a default selector that matches
|
|
52
|
+
* any node of type "text" will be used. If you do not specify a pattern, then
|
|
53
|
+
* any node that matches the selector will be assumed to match the pattern as
|
|
54
|
+
* well. If you don't pass a function as the fourth argument to the Rule()
|
|
55
|
+
* constructor, then you must pass an error message string instead. If you do
|
|
56
|
+
* this, you'll get a default function that unconditionally returns an object
|
|
57
|
+
* that includes the error message and the start and end indexes of the
|
|
58
|
+
* portion of the content string that matched the pattern. If you don't pass a
|
|
59
|
+
* function in the fifth parameter, the rule will be applied in any context.
|
|
60
|
+
*
|
|
61
|
+
* One of the design goals of this Rule class is to allow simple lint rules to
|
|
62
|
+
* be described in JSON files without any JavaScript code. So in addition to
|
|
63
|
+
* the Rule() constructor, the class also defines a Rule.makeRule() factory
|
|
64
|
+
* method. This method takes a single object as its argument and expects the
|
|
65
|
+
* object to have four string properties. The `name` property is passed as the
|
|
66
|
+
* first argument to the Rule() construtctor. The optional `selector`
|
|
67
|
+
* property, if specified, is passed to Selector.parse() and the resulting
|
|
68
|
+
* Selector object is used as the second argument to Rule(). The optional
|
|
69
|
+
* `pattern` property is converted to a RegExp before being passed as the
|
|
70
|
+
* third argument to Rule(). (See Rule.makePattern() for details on the string
|
|
71
|
+
* to RegExp conversion). Finally, the `message` property specifies an error
|
|
72
|
+
* message that is passed as the final argument to Rule(). You can also use a
|
|
73
|
+
* real RegExp as the value of the `pattern` property or define a custom lint
|
|
74
|
+
* function on the `lint` property instead of setting the `message`
|
|
75
|
+
* property. Doing either of these things means that your rule description can
|
|
76
|
+
* no longer be saved in a JSON file, however.
|
|
77
|
+
*
|
|
78
|
+
* For example, here are two lint rules defined with Rule.makeRule():
|
|
79
|
+
*
|
|
80
|
+
* let nestedLists = Rule.makeRule({
|
|
81
|
+
* name: "nested-lists",
|
|
82
|
+
* selector: "list list",
|
|
83
|
+
* message: `Nested lists:
|
|
84
|
+
* nested lists are hard to read on mobile devices;
|
|
85
|
+
* do not use additional indentation.`,
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* let longParagraph = Rule.makeRule({
|
|
89
|
+
* name: "long-paragraph",
|
|
90
|
+
* selector: "paragraph",
|
|
91
|
+
* pattern: /^.{501,}/,
|
|
92
|
+
* lint: function(state, content, nodes, match) {
|
|
93
|
+
* return `Paragraph too long:
|
|
94
|
+
* This paragraph is ${content.length} characters long.
|
|
95
|
+
* Shorten it to 500 characters or fewer.`;
|
|
96
|
+
* },
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* Certain advanced lint rules need additional information about the content
|
|
100
|
+
* being linted in order to detect lint. For example, a rule to check for
|
|
101
|
+
* whitespace at the start and end of the URL for an image can't use the
|
|
102
|
+
* information in the node or content arguments because the markdown parser
|
|
103
|
+
* strips leading and trailing whitespace when parsing. (Nevertheless, these
|
|
104
|
+
* spaces have been a practical problem for our content translation process so
|
|
105
|
+
* in order to check for them, a lint rule needs access to the original
|
|
106
|
+
* unparsed source text. Similarly, there are various lint rules that check
|
|
107
|
+
* widget usage. For example, it is easy to write a lint rule to ensure that
|
|
108
|
+
* images have alt text for images encoded in markdown. But when images are
|
|
109
|
+
* added to our content via an image widget we also want to be able to check
|
|
110
|
+
* for alt text. In order to do this, the lint rule needs to be able to look
|
|
111
|
+
* widgets up by name in the widgets object associated with the parse tree.
|
|
112
|
+
*
|
|
113
|
+
* In order to support advanced linting rules like these, the check() method
|
|
114
|
+
* takes a context object as its optional fourth argument, and passes this
|
|
115
|
+
* object on to the lint function of each rule. Rules that require extra
|
|
116
|
+
* context should not assume that they will always get it, and should verify
|
|
117
|
+
* that the necessary context has been supplied before using it. Currently the
|
|
118
|
+
* "content" property of the context object is the unparsed source text if
|
|
119
|
+
* available, and the "widgets" property of the context object is the widget
|
|
120
|
+
* object associated with that content string in the JSON object that defines
|
|
121
|
+
* the Perseus article or exercise that is being linted.
|
|
122
|
+
*/
|
|
123
|
+
import Selector from "./selector";
|
|
124
|
+
import type { TraversalState, TreeNode } from "./tree-transformer";
|
|
125
|
+
export type PatternMatchType = any;
|
|
126
|
+
export type RuleCheckReturnType = {
|
|
127
|
+
rule: string;
|
|
128
|
+
message: string;
|
|
129
|
+
start: number;
|
|
130
|
+
end: number;
|
|
131
|
+
severity?: number;
|
|
132
|
+
} | null | undefined;
|
|
133
|
+
export type LintTesterReturnType = string | {
|
|
134
|
+
message: string;
|
|
135
|
+
start: number;
|
|
136
|
+
end: number;
|
|
137
|
+
} | null | undefined;
|
|
138
|
+
export type LintRuleContextObject = any | null | undefined;
|
|
139
|
+
export type LintTester = (state: TraversalState, content: string, selectorMatch: ReadonlyArray<TreeNode>, patternMatch: PatternMatchType, context: LintRuleContextObject) => LintTesterReturnType;
|
|
140
|
+
export type AppliesTester = (context: LintRuleContextObject) => boolean;
|
|
141
|
+
/**
|
|
142
|
+
* A Rule object describes a Perseus lint rule. See the comment at the top of
|
|
143
|
+
* this file for detailed description.
|
|
144
|
+
*/
|
|
145
|
+
export default class Rule {
|
|
146
|
+
name: string;
|
|
147
|
+
severity: number;
|
|
148
|
+
selector: Selector;
|
|
149
|
+
pattern: RegExp | null | undefined;
|
|
150
|
+
lint: LintTester;
|
|
151
|
+
applies: AppliesTester;
|
|
152
|
+
message: string | null | undefined;
|
|
153
|
+
static DEFAULT_SELECTOR: Selector;
|
|
154
|
+
constructor(name: string | null | undefined, severity: number | null | undefined, selector: Selector | null | undefined, pattern: RegExp | null | undefined, lint: LintTester | string, applies: AppliesTester);
|
|
155
|
+
static makeRule(options: any): Rule;
|
|
156
|
+
check(node: TreeNode, traversalState: TraversalState, content: string, context: LintRuleContextObject): RuleCheckReturnType;
|
|
157
|
+
_defaultLintFunction(state: TraversalState, content: string, selectorMatch: ReadonlyArray<TreeNode>, patternMatch: PatternMatchType, context: LintRuleContextObject): {
|
|
158
|
+
end: number;
|
|
159
|
+
message: string;
|
|
160
|
+
start: number;
|
|
161
|
+
};
|
|
162
|
+
static makePattern(pattern?: RegExp | string | null): RegExp | null | undefined;
|
|
163
|
+
static FakePatternMatch(input: string, match: string | null | undefined, index: number): PatternMatchType;
|
|
164
|
+
static Severity: {
|
|
165
|
+
BULK_WARNING: number;
|
|
166
|
+
ERROR: number;
|
|
167
|
+
GUIDELINE: number;
|
|
168
|
+
WARNING: number;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Selector from "./selector";
|
|
8
|
+
import type { TraversalState, TreeNode } from "./tree-transformer";
|
|
9
|
+
export type PatternMatchType = any;
|
|
10
|
+
export type RuleCheckReturnType = {|
|
|
11
|
+
rule: string,
|
|
12
|
+
message: string,
|
|
13
|
+
start: number,
|
|
14
|
+
end: number,
|
|
15
|
+
severity?: number,
|
|
16
|
+
|} | null | void;
|
|
17
|
+
export type LintTesterReturnType =
|
|
18
|
+
| string
|
|
19
|
+
| {|
|
|
20
|
+
message: string,
|
|
21
|
+
start: number,
|
|
22
|
+
end: number,
|
|
23
|
+
|}
|
|
24
|
+
| null
|
|
25
|
+
| void;
|
|
26
|
+
export type LintRuleContextObject = any | null | void;
|
|
27
|
+
export type LintTester = (
|
|
28
|
+
state: TraversalState,
|
|
29
|
+
content: string,
|
|
30
|
+
selectorMatch: $ReadOnlyArray<TreeNode>,
|
|
31
|
+
patternMatch: PatternMatchType,
|
|
32
|
+
context: LintRuleContextObject
|
|
33
|
+
) => LintTesterReturnType;
|
|
34
|
+
export type AppliesTester = (context: LintRuleContextObject) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* A Rule object describes a Perseus lint rule. See the comment at the top of
|
|
37
|
+
* this file for detailed description.
|
|
38
|
+
*/
|
|
39
|
+
declare export default class Rule {
|
|
40
|
+
name: string;
|
|
41
|
+
severity: number;
|
|
42
|
+
selector: Selector;
|
|
43
|
+
pattern: RegExp | null | void;
|
|
44
|
+
lint: LintTester;
|
|
45
|
+
applies: AppliesTester;
|
|
46
|
+
message: string | null | void;
|
|
47
|
+
static DEFAULT_SELECTOR: Selector;
|
|
48
|
+
constructor(
|
|
49
|
+
name: string | null | void,
|
|
50
|
+
severity: number | null | void,
|
|
51
|
+
selector: Selector | null | void,
|
|
52
|
+
pattern: RegExp | null | void,
|
|
53
|
+
lint: LintTester | string,
|
|
54
|
+
applies: AppliesTester
|
|
55
|
+
): this;
|
|
56
|
+
static makeRule(options: any): Rule;
|
|
57
|
+
check(
|
|
58
|
+
node: TreeNode,
|
|
59
|
+
traversalState: TraversalState,
|
|
60
|
+
content: string,
|
|
61
|
+
context: LintRuleContextObject
|
|
62
|
+
): RuleCheckReturnType;
|
|
63
|
+
_defaultLintFunction(
|
|
64
|
+
state: TraversalState,
|
|
65
|
+
content: string,
|
|
66
|
+
selectorMatch: $ReadOnlyArray<TreeNode>,
|
|
67
|
+
patternMatch: PatternMatchType,
|
|
68
|
+
context: LintRuleContextObject
|
|
69
|
+
): {|
|
|
70
|
+
end: number,
|
|
71
|
+
message: string,
|
|
72
|
+
start: number,
|
|
73
|
+
|};
|
|
74
|
+
static makePattern(pattern?: RegExp | string | null): RegExp | null | void;
|
|
75
|
+
static FakePatternMatch(
|
|
76
|
+
input: string,
|
|
77
|
+
match: string | null | void,
|
|
78
|
+
index: number
|
|
79
|
+
): PatternMatchType;
|
|
80
|
+
static Severity: {|
|
|
81
|
+
BULK_WARNING: number,
|
|
82
|
+
ERROR: number,
|
|
83
|
+
GUIDELINE: number,
|
|
84
|
+
WARNING: number,
|
|
85
|
+
|};
|
|
86
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as $Flowgen$Import$_2e__2e_ from "..";
|
|
8
|
+
declare var _default: $Flowgen$Import$_2e__2e_.Rule[];
|
|
9
|
+
declare export default typeof _default;
|