@eslint-react/jsx 0.5.7 → 0.5.8
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.cjs +109 -429
- package/dist/index.d.mts +15 -8
- package/dist/index.d.ts +15 -8
- package/dist/index.js +109 -429
- package/dist/index.mjs +108 -429
- package/package.json +5 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TSESTree } from '@typescript-eslint/types';
|
|
2
2
|
import { RuleContext } from '@eslint-react/types';
|
|
3
|
-
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
4
3
|
import { TSESTreeFunction } from '@eslint-react/ast';
|
|
5
|
-
import {
|
|
4
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
5
|
+
import { O } from '@eslint-react/tools';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Check if a JSXElement or JSXFragment has children
|
|
@@ -13,18 +13,19 @@ declare function hasChildren(node: TSESTree.JSXElement | TSESTree.JSXFragment):
|
|
|
13
13
|
|
|
14
14
|
declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
|
|
15
15
|
|
|
16
|
-
declare function getFragmentFromContext<T extends RuleContext>(context: T):
|
|
17
|
-
declare const getPragmaFromContext: <T extends RuleContext>(context: T) =>
|
|
16
|
+
declare function getFragmentFromContext<T extends RuleContext>(context: T): string;
|
|
17
|
+
declare const getPragmaFromContext: <T extends RuleContext>(context: T) => string;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
declare function isInitializedFromPragma(variableName: string, context: RuleContext, pragma?: string): boolean;
|
|
20
|
+
type CallFromPragmaPredicate = (node: TSESTree.Node, context: RuleContext) => node is TSESTree.CallExpression;
|
|
20
21
|
/**
|
|
21
22
|
* Checks if the given node is a call expression to the given function or method of the pragma
|
|
22
23
|
* @param name The name of the function or method to check
|
|
23
24
|
* @returns A predicate that checks if the given node is a call expression to the given function or method
|
|
24
25
|
*/
|
|
25
|
-
declare
|
|
26
|
+
declare function isCallFromPragma(name: string): (node: TSESTree.Node, context: RuleContext) => node is TSESTree.CallExpression;
|
|
26
27
|
|
|
27
|
-
declare function
|
|
28
|
+
declare function isPropertyOfPragma(name: string, context: RuleContext, pragma?: string): (node: TSESTree.Node) => boolean;
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Checks if the given node is a call expression to `createElement`
|
|
@@ -165,6 +166,12 @@ declare function findPropInProperties(properties: (TSESTree.Property | TSESTree.
|
|
|
165
166
|
* @returns A function that searches for a property in the given attributes
|
|
166
167
|
*/
|
|
167
168
|
declare function findPropInAttributes(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], context: RuleContext): (propName: string) => O.Option<NonNullable<TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | undefined>>;
|
|
169
|
+
/**
|
|
170
|
+
* Gets and resolves the static value of a JSX attribute
|
|
171
|
+
* @param attribute The JSX attribute to get the value of
|
|
172
|
+
* @param context The rule context
|
|
173
|
+
* @returns The static value of the given JSX attribute
|
|
174
|
+
*/
|
|
168
175
|
declare function getPropValue(attribute: TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute, context: RuleContext): O.None<{
|
|
169
176
|
value: unknown;
|
|
170
177
|
} | null> | O.Some<{
|
|
@@ -190,4 +197,4 @@ declare function isWhiteSpace(node: TSESTree.JSXText | TSESTree.Literal): boolea
|
|
|
190
197
|
*/
|
|
191
198
|
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
192
199
|
|
|
193
|
-
export { type CallFromPragmaPredicate, type JSXValueCheckOptions, defaultJSXValueCheckOptions, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getPropName, getPropNameWithNamespace, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, hdlAnimation, hdlClipboard, hdlComposition, hdlFocus, hdlForm, hdlImage, hdlKeyboard, hdlMedia, hdlMouse, hdlScroll, hdlSelection, hdlTouch, hdlTransition, hdlWheel, isCallFromPragma, isChildrenOfCreateElement, isCloneElementCall, isCreateElementCall,
|
|
200
|
+
export { type CallFromPragmaPredicate, type JSXValueCheckOptions, defaultJSXValueCheckOptions, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getPropName, getPropNameWithNamespace, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, hdlAnimation, hdlClipboard, hdlComposition, hdlFocus, hdlForm, hdlImage, hdlKeyboard, hdlMedia, hdlMouse, hdlScroll, hdlSelection, hdlTouch, hdlTransition, hdlWheel, isCallFromPragma, isChildrenOfCreateElement, isCloneElementCall, isCreateElementCall, isFunctionReturningJSXValue, isInitializedFromPragma, isInsideCreateElementProps, isInsidePropValue, isJSXValue, isLineBreak, isLiteral, isPropertyOfPragma, isWhiteSpace, traverseUpProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TSESTree } from '@typescript-eslint/types';
|
|
2
2
|
import { RuleContext } from '@eslint-react/types';
|
|
3
|
-
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
4
3
|
import { TSESTreeFunction } from '@eslint-react/ast';
|
|
5
|
-
import {
|
|
4
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
5
|
+
import { O } from '@eslint-react/tools';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Check if a JSXElement or JSXFragment has children
|
|
@@ -13,18 +13,19 @@ declare function hasChildren(node: TSESTree.JSXElement | TSESTree.JSXFragment):
|
|
|
13
13
|
|
|
14
14
|
declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
|
|
15
15
|
|
|
16
|
-
declare function getFragmentFromContext<T extends RuleContext>(context: T):
|
|
17
|
-
declare const getPragmaFromContext: <T extends RuleContext>(context: T) =>
|
|
16
|
+
declare function getFragmentFromContext<T extends RuleContext>(context: T): string;
|
|
17
|
+
declare const getPragmaFromContext: <T extends RuleContext>(context: T) => string;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
declare function isInitializedFromPragma(variableName: string, context: RuleContext, pragma?: string): boolean;
|
|
20
|
+
type CallFromPragmaPredicate = (node: TSESTree.Node, context: RuleContext) => node is TSESTree.CallExpression;
|
|
20
21
|
/**
|
|
21
22
|
* Checks if the given node is a call expression to the given function or method of the pragma
|
|
22
23
|
* @param name The name of the function or method to check
|
|
23
24
|
* @returns A predicate that checks if the given node is a call expression to the given function or method
|
|
24
25
|
*/
|
|
25
|
-
declare
|
|
26
|
+
declare function isCallFromPragma(name: string): (node: TSESTree.Node, context: RuleContext) => node is TSESTree.CallExpression;
|
|
26
27
|
|
|
27
|
-
declare function
|
|
28
|
+
declare function isPropertyOfPragma(name: string, context: RuleContext, pragma?: string): (node: TSESTree.Node) => boolean;
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Checks if the given node is a call expression to `createElement`
|
|
@@ -165,6 +166,12 @@ declare function findPropInProperties(properties: (TSESTree.Property | TSESTree.
|
|
|
165
166
|
* @returns A function that searches for a property in the given attributes
|
|
166
167
|
*/
|
|
167
168
|
declare function findPropInAttributes(attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[], context: RuleContext): (propName: string) => O.Option<NonNullable<TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | undefined>>;
|
|
169
|
+
/**
|
|
170
|
+
* Gets and resolves the static value of a JSX attribute
|
|
171
|
+
* @param attribute The JSX attribute to get the value of
|
|
172
|
+
* @param context The rule context
|
|
173
|
+
* @returns The static value of the given JSX attribute
|
|
174
|
+
*/
|
|
168
175
|
declare function getPropValue(attribute: TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute, context: RuleContext): O.None<{
|
|
169
176
|
value: unknown;
|
|
170
177
|
} | null> | O.Some<{
|
|
@@ -190,4 +197,4 @@ declare function isWhiteSpace(node: TSESTree.JSXText | TSESTree.Literal): boolea
|
|
|
190
197
|
*/
|
|
191
198
|
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
192
199
|
|
|
193
|
-
export { type CallFromPragmaPredicate, type JSXValueCheckOptions, defaultJSXValueCheckOptions, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getPropName, getPropNameWithNamespace, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, hdlAnimation, hdlClipboard, hdlComposition, hdlFocus, hdlForm, hdlImage, hdlKeyboard, hdlMedia, hdlMouse, hdlScroll, hdlSelection, hdlTouch, hdlTransition, hdlWheel, isCallFromPragma, isChildrenOfCreateElement, isCloneElementCall, isCreateElementCall,
|
|
200
|
+
export { type CallFromPragmaPredicate, type JSXValueCheckOptions, defaultJSXValueCheckOptions, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getPropName, getPropNameWithNamespace, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, hdlAnimation, hdlClipboard, hdlComposition, hdlFocus, hdlForm, hdlImage, hdlKeyboard, hdlMedia, hdlMouse, hdlScroll, hdlSelection, hdlTouch, hdlTransition, hdlWheel, isCallFromPragma, isChildrenOfCreateElement, isCloneElementCall, isCreateElementCall, isFunctionReturningJSXValue, isInitializedFromPragma, isInsideCreateElementProps, isInsidePropValue, isJSXValue, isLineBreak, isLiteral, isPropertyOfPragma, isWhiteSpace, traverseUpProp };
|