@eslint-react/jsx 0.5.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/LICENSE +21 -0
- package/dist/index.cjs +594 -0
- package/dist/index.d.mts +188 -0
- package/dist/index.d.ts +188 -0
- package/dist/index.js +594 -0
- package/dist/index.mjs +554 -0
- package/package.json +56 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { RuleContext } from '@eslint-react/types';
|
|
3
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
4
|
+
import { TSESTreeFunction } from '@eslint-react/ast';
|
|
5
|
+
import { E, O } from '@eslint-react/tools';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Check if a JSXElement or JSXFragment has children
|
|
9
|
+
* @param node The AST node to check
|
|
10
|
+
* @returns `true` if the node has children
|
|
11
|
+
*/
|
|
12
|
+
declare function hasChildren(node: TSESTree.JSXElement | TSESTree.JSXFragment): boolean;
|
|
13
|
+
|
|
14
|
+
declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
|
|
15
|
+
|
|
16
|
+
declare function getFragmentFromContext<T extends RuleContext>(context: T): E.Either<Error, string>;
|
|
17
|
+
declare const getPragmaFromContext: <T extends RuleContext>(context: T) => E.Either<Error, string>;
|
|
18
|
+
|
|
19
|
+
type CallFromPragmaPredicate = (node: TSESTree$1.Node, context: RuleContext) => node is TSESTree$1.CallExpression;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the given node is a call expression to the given function or method of the pragma
|
|
22
|
+
* @param name The name of the function or method to check
|
|
23
|
+
* @returns A predicate that checks if the given node is a call expression to the given function or method
|
|
24
|
+
*/
|
|
25
|
+
declare const isCallFromPragma: (name: string) => (node: TSESTree$1.Node, context: RuleContext) => node is TSESTree$1.CallExpression;
|
|
26
|
+
|
|
27
|
+
declare function isDestructuredFromPragma<T extends RuleContext>(variableName: string, context: T): boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Checks if the given node is a call expression to `React.createElement`
|
|
31
|
+
* @param node The AST node to check
|
|
32
|
+
* @param context The rule context
|
|
33
|
+
* @returns `true` if the node is a call expression to `createElement`
|
|
34
|
+
*/
|
|
35
|
+
declare const isCreateElementCall: CallFromPragmaPredicate;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the given node is a call expression to `React.cloneElement`
|
|
38
|
+
* @param node The AST node to check
|
|
39
|
+
* @param context The rule context
|
|
40
|
+
* @returns `true` if the node is a call expression to `cloneElement`
|
|
41
|
+
*/
|
|
42
|
+
declare const isCloneElementCall: CallFromPragmaPredicate;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Determines whether inside createElement's props.
|
|
46
|
+
* @param node The AST node to check
|
|
47
|
+
* @param context The rule context
|
|
48
|
+
* @returns `true` if the node is inside createElement's props
|
|
49
|
+
*/
|
|
50
|
+
declare function isInsideCreateElementProps(node: TSESTree.Node, context: RuleContext): boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the tag name associated with a JSXOpeningElement.
|
|
54
|
+
* @param node The visited JSXOpeningElement node object.
|
|
55
|
+
* @returns The element's tag name.
|
|
56
|
+
*/
|
|
57
|
+
declare function elementType(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
|
|
58
|
+
|
|
59
|
+
declare const hdlAnimation: readonly ["onAnimationStart", "onAnimationEnd", "onAnimationIteration"];
|
|
60
|
+
declare const hdlClipboard: readonly ["onCopy", "onCut", "onPaste"];
|
|
61
|
+
declare const hdlComposition: readonly ["onCompositionEnd", "onCompositionStart", "onCompositionUpdate"];
|
|
62
|
+
declare const hdlFocus: readonly ["onFocus", "onBlur"];
|
|
63
|
+
declare const hdlForm: readonly ["onChange", "onInput", "onSubmit"];
|
|
64
|
+
declare const hdlImage: readonly ["onLoad", "onError"];
|
|
65
|
+
declare const hdlKeyboard: readonly ["onKeyDown", "onKeyPress", "onKeyUp"];
|
|
66
|
+
declare const hdlMedia: readonly ["onAbort", "onCanPlay", "onCanPlayThrough", "onDurationChange", "onEmptied", "onEncrypted", "onEnded", "onError", "onLoadedData", "onLoadedMetadata", "onLoadStart", "onPause", "onPlay", "onPlaying", "onProgress", "onRateChange", "onSeeked", "onSeeking", "onStalled", "onSuspend", "onTimeUpdate", "onVolumeChange", "onWaiting"];
|
|
67
|
+
declare const hdlMouse: readonly ["onClick", "onContextMenu", "onDblClick", "onDoubleClick", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp"];
|
|
68
|
+
declare const hdlSelection: readonly ["onSelect"];
|
|
69
|
+
declare const hdlTouch: readonly ["onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart"];
|
|
70
|
+
declare const hdlTransition: readonly ["onTransitionEnd"];
|
|
71
|
+
declare const hdlScroll: readonly ["onScroll"];
|
|
72
|
+
declare const hdlWheel: readonly ["onWheel"];
|
|
73
|
+
|
|
74
|
+
type JSXValueCheckOptions = {
|
|
75
|
+
/**
|
|
76
|
+
* Whether to check all branches of the conditional expression
|
|
77
|
+
*/
|
|
78
|
+
strict?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to ignore null values
|
|
81
|
+
*/
|
|
82
|
+
ignoreNull?: boolean;
|
|
83
|
+
};
|
|
84
|
+
declare const defaultJSXValueCheckOptions: {
|
|
85
|
+
readonly ignoreNull: false;
|
|
86
|
+
readonly strict: false;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Check if a node is a JSX value
|
|
90
|
+
* @param node The AST node to check
|
|
91
|
+
* @param context The rule context
|
|
92
|
+
* @param options The `JSXValueCheckOptions` to use
|
|
93
|
+
* @returns boolean
|
|
94
|
+
*/
|
|
95
|
+
declare function isJSXValue(node: TSESTree$1.Node | null | undefined, context: RuleContext, options?: JSXValueCheckOptions): boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Check if function is returning JSX
|
|
99
|
+
* @param node The return statement node to check
|
|
100
|
+
* @param context The rule context
|
|
101
|
+
* @param options The JSX value check options
|
|
102
|
+
* @returns boolean
|
|
103
|
+
*/
|
|
104
|
+
declare function isFunctionReturningJSXValue(node: TSESTreeFunction, context: RuleContext, options?: JSXValueCheckOptions): boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Check if the given prop name is present in the given attributes
|
|
108
|
+
* @param attributes The attributes to search in
|
|
109
|
+
* @param propName The prop name to search for
|
|
110
|
+
* @param context The rule context
|
|
111
|
+
* @returns `true` if the given prop name is present in the given properties
|
|
112
|
+
*/
|
|
113
|
+
declare function hasProp(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], propName: string, context: RuleContext): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Check if any of the given prop names are present in the given attributes
|
|
116
|
+
* @param attributes The attributes to search in
|
|
117
|
+
* @param propNames The prop names to search for
|
|
118
|
+
* @param context The rule context
|
|
119
|
+
* @returns `true` if any of the given prop names are present in the given attributes
|
|
120
|
+
*/
|
|
121
|
+
declare function hasAnyProp(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], propNames: string[], context: RuleContext): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Check if all of the given prop names are present in the given attributes
|
|
124
|
+
* @param attributes The attributes to search in
|
|
125
|
+
* @param propNames The prop names to search for
|
|
126
|
+
* @param context The rule context
|
|
127
|
+
* @returns `true` if all of the given prop names are present in the given attributes
|
|
128
|
+
*/
|
|
129
|
+
declare function hasEveryProp(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], propNames: string[], context: RuleContext): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Get the name of a JSX attribute
|
|
132
|
+
* @param node The JSX attribute node
|
|
133
|
+
* @returns string
|
|
134
|
+
*/
|
|
135
|
+
declare function getPropName(node: TSESTree.JSXAttribute): string;
|
|
136
|
+
/**
|
|
137
|
+
* Get the name of a JSX attribute with namespace
|
|
138
|
+
* @param node The JSX attribute node
|
|
139
|
+
* @returns string
|
|
140
|
+
*/
|
|
141
|
+
declare function getPropNameWithNamespace(node: TSESTree.JSXAttribute): string;
|
|
142
|
+
/**
|
|
143
|
+
* Traverses up prop node
|
|
144
|
+
* @param node The AST node to start traversing from
|
|
145
|
+
* @param predicate The predicate to check each node
|
|
146
|
+
* @returns prop node if found
|
|
147
|
+
*/
|
|
148
|
+
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean): O.Option<TSESTree.JSXAttribute>;
|
|
149
|
+
/**
|
|
150
|
+
* Checks if the node is inside a prop's value
|
|
151
|
+
* @param node The AST node to check
|
|
152
|
+
* @returns `true` if the node is inside a prop's value
|
|
153
|
+
*/
|
|
154
|
+
declare function isInsidePropValue(node: TSESTree.Node): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* @param properties The properties to search in
|
|
157
|
+
* @param context The rule context
|
|
158
|
+
* @param seenProps The properties that have already been seen
|
|
159
|
+
* @returns A function that searches for a property in the given properties
|
|
160
|
+
*/
|
|
161
|
+
declare function findPropInProperties(properties: (TSESTree.Property | TSESTree.RestElement)[] | TSESTree.ObjectLiteralElement[], context: RuleContext, seenProps?: string[]): (propName: string) => O.Option<(typeof properties)[number]>;
|
|
162
|
+
/**
|
|
163
|
+
* @param attributes The attributes to search in
|
|
164
|
+
* @param context The rule context
|
|
165
|
+
* @returns A function that searches for a property in the given attributes
|
|
166
|
+
*/
|
|
167
|
+
declare function findPropInAttributes(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], context: RuleContext): (propName: string) => O.Option<NonNullable<TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | undefined>>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Check if a node is a Literal or JSXText
|
|
171
|
+
* @param node The AST node to check
|
|
172
|
+
* @returns boolean `true` if the node is a Literal or JSXText
|
|
173
|
+
*/
|
|
174
|
+
declare const isLiteral: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXText | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
|
|
175
|
+
/**
|
|
176
|
+
* Check if a Literal or JSXText node is whitespace
|
|
177
|
+
* @param node The AST node to check
|
|
178
|
+
* @returns boolean `true` if the node is whitespace
|
|
179
|
+
*/
|
|
180
|
+
declare function isWhiteSpace(node: TSESTree.JSXText | TSESTree.Literal): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Check if a Literal or JSXText node is a line break
|
|
183
|
+
* @param node The AST node to check
|
|
184
|
+
* @returns boolean
|
|
185
|
+
*/
|
|
186
|
+
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
187
|
+
|
|
188
|
+
export { type CallFromPragmaPredicate, type JSXValueCheckOptions, defaultJSXValueCheckOptions, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getPropName, getPropNameWithNamespace, hasAnyProp, hasChildren, hasEveryProp, hasProp, hdlAnimation, hdlClipboard, hdlComposition, hdlFocus, hdlForm, hdlImage, hdlKeyboard, hdlMedia, hdlMouse, hdlScroll, hdlSelection, hdlTouch, hdlTransition, hdlWheel, isCallFromPragma, isChildrenOfCreateElement, isCloneElementCall, isCreateElementCall, isDestructuredFromPragma, isFunctionReturningJSXValue, isInsideCreateElementProps, isInsidePropValue, isJSXValue, isLineBreak, isLiteral, isWhiteSpace, traverseUpProp };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { RuleContext } from '@eslint-react/types';
|
|
3
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
4
|
+
import { TSESTreeFunction } from '@eslint-react/ast';
|
|
5
|
+
import { E, O } from '@eslint-react/tools';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Check if a JSXElement or JSXFragment has children
|
|
9
|
+
* @param node The AST node to check
|
|
10
|
+
* @returns `true` if the node has children
|
|
11
|
+
*/
|
|
12
|
+
declare function hasChildren(node: TSESTree.JSXElement | TSESTree.JSXFragment): boolean;
|
|
13
|
+
|
|
14
|
+
declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
|
|
15
|
+
|
|
16
|
+
declare function getFragmentFromContext<T extends RuleContext>(context: T): E.Either<Error, string>;
|
|
17
|
+
declare const getPragmaFromContext: <T extends RuleContext>(context: T) => E.Either<Error, string>;
|
|
18
|
+
|
|
19
|
+
type CallFromPragmaPredicate = (node: TSESTree$1.Node, context: RuleContext) => node is TSESTree$1.CallExpression;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the given node is a call expression to the given function or method of the pragma
|
|
22
|
+
* @param name The name of the function or method to check
|
|
23
|
+
* @returns A predicate that checks if the given node is a call expression to the given function or method
|
|
24
|
+
*/
|
|
25
|
+
declare const isCallFromPragma: (name: string) => (node: TSESTree$1.Node, context: RuleContext) => node is TSESTree$1.CallExpression;
|
|
26
|
+
|
|
27
|
+
declare function isDestructuredFromPragma<T extends RuleContext>(variableName: string, context: T): boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Checks if the given node is a call expression to `React.createElement`
|
|
31
|
+
* @param node The AST node to check
|
|
32
|
+
* @param context The rule context
|
|
33
|
+
* @returns `true` if the node is a call expression to `createElement`
|
|
34
|
+
*/
|
|
35
|
+
declare const isCreateElementCall: CallFromPragmaPredicate;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the given node is a call expression to `React.cloneElement`
|
|
38
|
+
* @param node The AST node to check
|
|
39
|
+
* @param context The rule context
|
|
40
|
+
* @returns `true` if the node is a call expression to `cloneElement`
|
|
41
|
+
*/
|
|
42
|
+
declare const isCloneElementCall: CallFromPragmaPredicate;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Determines whether inside createElement's props.
|
|
46
|
+
* @param node The AST node to check
|
|
47
|
+
* @param context The rule context
|
|
48
|
+
* @returns `true` if the node is inside createElement's props
|
|
49
|
+
*/
|
|
50
|
+
declare function isInsideCreateElementProps(node: TSESTree.Node, context: RuleContext): boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the tag name associated with a JSXOpeningElement.
|
|
54
|
+
* @param node The visited JSXOpeningElement node object.
|
|
55
|
+
* @returns The element's tag name.
|
|
56
|
+
*/
|
|
57
|
+
declare function elementType(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
|
|
58
|
+
|
|
59
|
+
declare const hdlAnimation: readonly ["onAnimationStart", "onAnimationEnd", "onAnimationIteration"];
|
|
60
|
+
declare const hdlClipboard: readonly ["onCopy", "onCut", "onPaste"];
|
|
61
|
+
declare const hdlComposition: readonly ["onCompositionEnd", "onCompositionStart", "onCompositionUpdate"];
|
|
62
|
+
declare const hdlFocus: readonly ["onFocus", "onBlur"];
|
|
63
|
+
declare const hdlForm: readonly ["onChange", "onInput", "onSubmit"];
|
|
64
|
+
declare const hdlImage: readonly ["onLoad", "onError"];
|
|
65
|
+
declare const hdlKeyboard: readonly ["onKeyDown", "onKeyPress", "onKeyUp"];
|
|
66
|
+
declare const hdlMedia: readonly ["onAbort", "onCanPlay", "onCanPlayThrough", "onDurationChange", "onEmptied", "onEncrypted", "onEnded", "onError", "onLoadedData", "onLoadedMetadata", "onLoadStart", "onPause", "onPlay", "onPlaying", "onProgress", "onRateChange", "onSeeked", "onSeeking", "onStalled", "onSuspend", "onTimeUpdate", "onVolumeChange", "onWaiting"];
|
|
67
|
+
declare const hdlMouse: readonly ["onClick", "onContextMenu", "onDblClick", "onDoubleClick", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp"];
|
|
68
|
+
declare const hdlSelection: readonly ["onSelect"];
|
|
69
|
+
declare const hdlTouch: readonly ["onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart"];
|
|
70
|
+
declare const hdlTransition: readonly ["onTransitionEnd"];
|
|
71
|
+
declare const hdlScroll: readonly ["onScroll"];
|
|
72
|
+
declare const hdlWheel: readonly ["onWheel"];
|
|
73
|
+
|
|
74
|
+
type JSXValueCheckOptions = {
|
|
75
|
+
/**
|
|
76
|
+
* Whether to check all branches of the conditional expression
|
|
77
|
+
*/
|
|
78
|
+
strict?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to ignore null values
|
|
81
|
+
*/
|
|
82
|
+
ignoreNull?: boolean;
|
|
83
|
+
};
|
|
84
|
+
declare const defaultJSXValueCheckOptions: {
|
|
85
|
+
readonly ignoreNull: false;
|
|
86
|
+
readonly strict: false;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Check if a node is a JSX value
|
|
90
|
+
* @param node The AST node to check
|
|
91
|
+
* @param context The rule context
|
|
92
|
+
* @param options The `JSXValueCheckOptions` to use
|
|
93
|
+
* @returns boolean
|
|
94
|
+
*/
|
|
95
|
+
declare function isJSXValue(node: TSESTree$1.Node | null | undefined, context: RuleContext, options?: JSXValueCheckOptions): boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Check if function is returning JSX
|
|
99
|
+
* @param node The return statement node to check
|
|
100
|
+
* @param context The rule context
|
|
101
|
+
* @param options The JSX value check options
|
|
102
|
+
* @returns boolean
|
|
103
|
+
*/
|
|
104
|
+
declare function isFunctionReturningJSXValue(node: TSESTreeFunction, context: RuleContext, options?: JSXValueCheckOptions): boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Check if the given prop name is present in the given attributes
|
|
108
|
+
* @param attributes The attributes to search in
|
|
109
|
+
* @param propName The prop name to search for
|
|
110
|
+
* @param context The rule context
|
|
111
|
+
* @returns `true` if the given prop name is present in the given properties
|
|
112
|
+
*/
|
|
113
|
+
declare function hasProp(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], propName: string, context: RuleContext): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Check if any of the given prop names are present in the given attributes
|
|
116
|
+
* @param attributes The attributes to search in
|
|
117
|
+
* @param propNames The prop names to search for
|
|
118
|
+
* @param context The rule context
|
|
119
|
+
* @returns `true` if any of the given prop names are present in the given attributes
|
|
120
|
+
*/
|
|
121
|
+
declare function hasAnyProp(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], propNames: string[], context: RuleContext): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Check if all of the given prop names are present in the given attributes
|
|
124
|
+
* @param attributes The attributes to search in
|
|
125
|
+
* @param propNames The prop names to search for
|
|
126
|
+
* @param context The rule context
|
|
127
|
+
* @returns `true` if all of the given prop names are present in the given attributes
|
|
128
|
+
*/
|
|
129
|
+
declare function hasEveryProp(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], propNames: string[], context: RuleContext): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Get the name of a JSX attribute
|
|
132
|
+
* @param node The JSX attribute node
|
|
133
|
+
* @returns string
|
|
134
|
+
*/
|
|
135
|
+
declare function getPropName(node: TSESTree.JSXAttribute): string;
|
|
136
|
+
/**
|
|
137
|
+
* Get the name of a JSX attribute with namespace
|
|
138
|
+
* @param node The JSX attribute node
|
|
139
|
+
* @returns string
|
|
140
|
+
*/
|
|
141
|
+
declare function getPropNameWithNamespace(node: TSESTree.JSXAttribute): string;
|
|
142
|
+
/**
|
|
143
|
+
* Traverses up prop node
|
|
144
|
+
* @param node The AST node to start traversing from
|
|
145
|
+
* @param predicate The predicate to check each node
|
|
146
|
+
* @returns prop node if found
|
|
147
|
+
*/
|
|
148
|
+
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean): O.Option<TSESTree.JSXAttribute>;
|
|
149
|
+
/**
|
|
150
|
+
* Checks if the node is inside a prop's value
|
|
151
|
+
* @param node The AST node to check
|
|
152
|
+
* @returns `true` if the node is inside a prop's value
|
|
153
|
+
*/
|
|
154
|
+
declare function isInsidePropValue(node: TSESTree.Node): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* @param properties The properties to search in
|
|
157
|
+
* @param context The rule context
|
|
158
|
+
* @param seenProps The properties that have already been seen
|
|
159
|
+
* @returns A function that searches for a property in the given properties
|
|
160
|
+
*/
|
|
161
|
+
declare function findPropInProperties(properties: (TSESTree.Property | TSESTree.RestElement)[] | TSESTree.ObjectLiteralElement[], context: RuleContext, seenProps?: string[]): (propName: string) => O.Option<(typeof properties)[number]>;
|
|
162
|
+
/**
|
|
163
|
+
* @param attributes The attributes to search in
|
|
164
|
+
* @param context The rule context
|
|
165
|
+
* @returns A function that searches for a property in the given attributes
|
|
166
|
+
*/
|
|
167
|
+
declare function findPropInAttributes(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], context: RuleContext): (propName: string) => O.Option<NonNullable<TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | undefined>>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Check if a node is a Literal or JSXText
|
|
171
|
+
* @param node The AST node to check
|
|
172
|
+
* @returns boolean `true` if the node is a Literal or JSXText
|
|
173
|
+
*/
|
|
174
|
+
declare const isLiteral: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXText | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
|
|
175
|
+
/**
|
|
176
|
+
* Check if a Literal or JSXText node is whitespace
|
|
177
|
+
* @param node The AST node to check
|
|
178
|
+
* @returns boolean `true` if the node is whitespace
|
|
179
|
+
*/
|
|
180
|
+
declare function isWhiteSpace(node: TSESTree.JSXText | TSESTree.Literal): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Check if a Literal or JSXText node is a line break
|
|
183
|
+
* @param node The AST node to check
|
|
184
|
+
* @returns boolean
|
|
185
|
+
*/
|
|
186
|
+
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
187
|
+
|
|
188
|
+
export { type CallFromPragmaPredicate, type JSXValueCheckOptions, defaultJSXValueCheckOptions, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getPropName, getPropNameWithNamespace, hasAnyProp, hasChildren, hasEveryProp, hasProp, hdlAnimation, hdlClipboard, hdlComposition, hdlFocus, hdlForm, hdlImage, hdlKeyboard, hdlMedia, hdlMouse, hdlScroll, hdlSelection, hdlTouch, hdlTransition, hdlWheel, isCallFromPragma, isChildrenOfCreateElement, isCloneElementCall, isCreateElementCall, isDestructuredFromPragma, isFunctionReturningJSXValue, isInsideCreateElementProps, isInsidePropValue, isJSXValue, isLineBreak, isLiteral, isWhiteSpace, traverseUpProp };
|