@eslint-react/jsx 1.5.11-next.9 → 1.5.12-beta.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.d.mts CHANGED
@@ -1,15 +1,8 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
- import { RuleContext } from '@eslint-react/types';
3
1
  import { TSESTree } from '@typescript-eslint/types';
4
- import { TSESTreeFunction } from '@eslint-react/ast';
2
+ import { RuleContext } from '@eslint-react/types';
3
+ import { Option } from 'effect';
5
4
  import { Scope } from '@typescript-eslint/scope-manager';
6
5
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
7
- import { Option } from 'effect';
8
-
9
- declare const isCreateElement: (node: TSESTree.Identifier | TSESTree.MemberExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
10
- declare const isCreateElementCall: (node: TSESTree.CallExpression, context: RuleContext) => boolean;
11
- declare const isCloneElement: (node: TSESTree.Identifier | TSESTree.MemberExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
12
- declare const isCloneElementCall: (node: TSESTree.CallExpression, context: RuleContext) => boolean;
13
6
 
14
7
  /**
15
8
  * Returns the tag name associated with a JSXOpeningElement.
@@ -18,30 +11,6 @@ declare const isCloneElementCall: (node: TSESTree.CallExpression, context: RuleC
18
11
  */
19
12
  declare function elementType(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
20
13
 
21
- /**
22
- * Determines whether inside createElement's props.
23
- * @param node The AST node to check
24
- * @param context The rule context
25
- * @returns `true` if the node is inside createElement's props
26
- */
27
- declare function isInsideCreateElementProps(node: TSESTree.Node, context: RuleContext): boolean;
28
- declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
29
- /**
30
- * Check if a `JSXElement` or `JSXFragment` has children
31
- * @param node The AST node to check
32
- * @param predicate A predicate to filter the children
33
- * @returns `true` if the node has children
34
- */
35
- declare function hasChildren(node: TSESTree.JSXElement | TSESTree.JSXFragment, predicate?: (node: TSESTree.JSXChild) => boolean): boolean;
36
- /**
37
- * Check if a node is a child of a `JSXElement`
38
- * @param node The AST node to check
39
- * @returns `true` if the node is a child of a `JSXElement`
40
- */
41
- declare function isChildOfJSXElement(node: TSESTree.Node): node is {
42
- parent: TSESTree.JSXElement;
43
- } & TSESTree.JSXElement;
44
-
45
14
  /**
46
15
  * Check if a node is a `JSXElement` of `User-Defined Component` type
47
16
  * @param node The AST node to check
@@ -55,48 +24,7 @@ declare function isJSXElementOfUserDefinedComponent(node: TSESTree.JSXElement):
55
24
  */
56
25
  declare function isJSXElementOfBuiltinComponent(node: TSESTree.JSXElement): boolean;
57
26
 
58
- declare const isFragment: (node: TSESTree.Node, pragma: string, fragment: string) => node is TSESTree.JSXElement | TSESTree.JSXFragment;
59
- /**
60
- * Check if a node is `<></>`
61
- */
62
- declare const isFragmentSyntax: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
63
- /**
64
- * Check if a node is `<Fragment></Fragment>` or `<Pragma.Fragment></Pragma.Fragment>`
65
- * @param node
66
- * @param pragma
67
- * @param fragment
68
- */
69
- declare function isFragmentElement(node: TSESTree.JSXElement, pragma: string, fragment: string): boolean;
70
-
71
- /**
72
- * Check if function is returning JSX
73
- * @param node The return statement node to check
74
- * @param context The rule context
75
- * @param hint The `JSXValueHint` to use
76
- * @returns boolean
77
- */
78
- declare function isFunctionReturningJSXValue(node: TSESTreeFunction, context: RuleContext, hint?: bigint): boolean;
79
-
80
- declare function getFragmentFromContext<T extends RuleContext>(context: T): string;
81
- declare const getPragmaFromContext: <T extends RuleContext>(context: T) => string;
82
-
83
- declare function isInitializedFromPragma(variableName: string, context: RuleContext, initialScope: Scope, pragma?: string): boolean;
84
- declare function isPropertyOfPragma(name: string, context: RuleContext, pragma?: string): (node: TSESTree.Node) => boolean;
85
- /**
86
- * Checks if the given node is a call expression to the given function or method of the pragma
87
- * @param name The name of the function or method to check
88
- * @returns A predicate that checks if the given node is a call expression to the given function or method
89
- */
90
- declare function isFromPragma(name: string): (node: TSESTree.Identifier | TSESTree.MemberExpression, context: RuleContext) => boolean;
91
- /**
92
- * @internal
93
- * @param pragmaMemberName
94
- * @param name
95
- * @returns A function that checks if a given node is a member expression of a Pragma member.
96
- */
97
- declare function isFromPragmaMember(pragmaMemberName: string, name: string): (node: TSESTree.MemberExpression, context: RuleContext, pragma?: string) => boolean;
98
- declare function isCallFromPragma(name: string): (node: TSESTree.CallExpression, context: RuleContext) => boolean;
99
- declare function isCallFromPragmaMember(pragmaMemberName: string, name: string): (node: TSESTree.CallExpression, context: RuleContext) => boolean;
27
+ declare function getJSXPragmaFromContext(context: RuleContext): Option.Option<string>;
100
28
 
101
29
  /**
102
30
  * Get the name of a JSX attribute with namespace
@@ -222,4 +150,4 @@ declare const DEFAULT_JSX_VALUE_HINT: bigint;
222
150
  */
223
151
  declare function isJSXValue(node: TSESTree$1.Node | null | undefined, context: RuleContext, hint?: bigint): boolean;
224
152
 
225
- export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getProp, getPropName, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, isCallFromPragma, isCallFromPragmaMember, isChildOfJSXElement, isChildrenOfCreateElement, isCloneElement, isCloneElementCall, isCreateElement, isCreateElementCall, isFragment, isFragmentElement, isFragmentSyntax, isFromPragma, isFromPragmaMember, isFunctionReturningJSXValue, isInitializedFromPragma, isInsideCreateElementProps, isInsidePropValue, isJSXElementOfBuiltinComponent, isJSXElementOfUserDefinedComponent, isJSXValue, isLineBreak, isLiteral, isPaddingSpaces, isPropertyOfPragma, isWhiteSpace, traverseUpProp };
153
+ export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getJSXPragmaFromContext, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isInsidePropValue, isJSXElementOfBuiltinComponent, isJSXElementOfUserDefinedComponent, isJSXValue, isLineBreak, isLiteral, isPaddingSpaces, isWhiteSpace, traverseUpProp };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,8 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
- import { RuleContext } from '@eslint-react/types';
3
1
  import { TSESTree } from '@typescript-eslint/types';
4
- import { TSESTreeFunction } from '@eslint-react/ast';
2
+ import { RuleContext } from '@eslint-react/types';
3
+ import { Option } from 'effect';
5
4
  import { Scope } from '@typescript-eslint/scope-manager';
6
5
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
7
- import { Option } from 'effect';
8
-
9
- declare const isCreateElement: (node: TSESTree.Identifier | TSESTree.MemberExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
10
- declare const isCreateElementCall: (node: TSESTree.CallExpression, context: RuleContext) => boolean;
11
- declare const isCloneElement: (node: TSESTree.Identifier | TSESTree.MemberExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
12
- declare const isCloneElementCall: (node: TSESTree.CallExpression, context: RuleContext) => boolean;
13
6
 
14
7
  /**
15
8
  * Returns the tag name associated with a JSXOpeningElement.
@@ -18,30 +11,6 @@ declare const isCloneElementCall: (node: TSESTree.CallExpression, context: RuleC
18
11
  */
19
12
  declare function elementType(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
20
13
 
21
- /**
22
- * Determines whether inside createElement's props.
23
- * @param node The AST node to check
24
- * @param context The rule context
25
- * @returns `true` if the node is inside createElement's props
26
- */
27
- declare function isInsideCreateElementProps(node: TSESTree.Node, context: RuleContext): boolean;
28
- declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
29
- /**
30
- * Check if a `JSXElement` or `JSXFragment` has children
31
- * @param node The AST node to check
32
- * @param predicate A predicate to filter the children
33
- * @returns `true` if the node has children
34
- */
35
- declare function hasChildren(node: TSESTree.JSXElement | TSESTree.JSXFragment, predicate?: (node: TSESTree.JSXChild) => boolean): boolean;
36
- /**
37
- * Check if a node is a child of a `JSXElement`
38
- * @param node The AST node to check
39
- * @returns `true` if the node is a child of a `JSXElement`
40
- */
41
- declare function isChildOfJSXElement(node: TSESTree.Node): node is {
42
- parent: TSESTree.JSXElement;
43
- } & TSESTree.JSXElement;
44
-
45
14
  /**
46
15
  * Check if a node is a `JSXElement` of `User-Defined Component` type
47
16
  * @param node The AST node to check
@@ -55,48 +24,7 @@ declare function isJSXElementOfUserDefinedComponent(node: TSESTree.JSXElement):
55
24
  */
56
25
  declare function isJSXElementOfBuiltinComponent(node: TSESTree.JSXElement): boolean;
57
26
 
58
- declare const isFragment: (node: TSESTree.Node, pragma: string, fragment: string) => node is TSESTree.JSXElement | TSESTree.JSXFragment;
59
- /**
60
- * Check if a node is `<></>`
61
- */
62
- declare const isFragmentSyntax: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
63
- /**
64
- * Check if a node is `<Fragment></Fragment>` or `<Pragma.Fragment></Pragma.Fragment>`
65
- * @param node
66
- * @param pragma
67
- * @param fragment
68
- */
69
- declare function isFragmentElement(node: TSESTree.JSXElement, pragma: string, fragment: string): boolean;
70
-
71
- /**
72
- * Check if function is returning JSX
73
- * @param node The return statement node to check
74
- * @param context The rule context
75
- * @param hint The `JSXValueHint` to use
76
- * @returns boolean
77
- */
78
- declare function isFunctionReturningJSXValue(node: TSESTreeFunction, context: RuleContext, hint?: bigint): boolean;
79
-
80
- declare function getFragmentFromContext<T extends RuleContext>(context: T): string;
81
- declare const getPragmaFromContext: <T extends RuleContext>(context: T) => string;
82
-
83
- declare function isInitializedFromPragma(variableName: string, context: RuleContext, initialScope: Scope, pragma?: string): boolean;
84
- declare function isPropertyOfPragma(name: string, context: RuleContext, pragma?: string): (node: TSESTree.Node) => boolean;
85
- /**
86
- * Checks if the given node is a call expression to the given function or method of the pragma
87
- * @param name The name of the function or method to check
88
- * @returns A predicate that checks if the given node is a call expression to the given function or method
89
- */
90
- declare function isFromPragma(name: string): (node: TSESTree.Identifier | TSESTree.MemberExpression, context: RuleContext) => boolean;
91
- /**
92
- * @internal
93
- * @param pragmaMemberName
94
- * @param name
95
- * @returns A function that checks if a given node is a member expression of a Pragma member.
96
- */
97
- declare function isFromPragmaMember(pragmaMemberName: string, name: string): (node: TSESTree.MemberExpression, context: RuleContext, pragma?: string) => boolean;
98
- declare function isCallFromPragma(name: string): (node: TSESTree.CallExpression, context: RuleContext) => boolean;
99
- declare function isCallFromPragmaMember(pragmaMemberName: string, name: string): (node: TSESTree.CallExpression, context: RuleContext) => boolean;
27
+ declare function getJSXPragmaFromContext(context: RuleContext): Option.Option<string>;
100
28
 
101
29
  /**
102
30
  * Get the name of a JSX attribute with namespace
@@ -222,4 +150,4 @@ declare const DEFAULT_JSX_VALUE_HINT: bigint;
222
150
  */
223
151
  declare function isJSXValue(node: TSESTree$1.Node | null | undefined, context: RuleContext, hint?: bigint): boolean;
224
152
 
225
- export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getProp, getPropName, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, isCallFromPragma, isCallFromPragmaMember, isChildOfJSXElement, isChildrenOfCreateElement, isCloneElement, isCloneElementCall, isCreateElement, isCreateElementCall, isFragment, isFragmentElement, isFragmentSyntax, isFromPragma, isFromPragmaMember, isFunctionReturningJSXValue, isInitializedFromPragma, isInsideCreateElementProps, isInsidePropValue, isJSXElementOfBuiltinComponent, isJSXElementOfUserDefinedComponent, isJSXValue, isLineBreak, isLiteral, isPaddingSpaces, isPropertyOfPragma, isWhiteSpace, traverseUpProp };
153
+ export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getJSXPragmaFromContext, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isInsidePropValue, isJSXElementOfBuiltinComponent, isJSXElementOfUserDefinedComponent, isJSXValue, isLineBreak, isLiteral, isPaddingSpaces, isWhiteSpace, traverseUpProp };