@eslint-react/jsx 1.5.25-beta.1 → 1.5.25-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 +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +43 -1889
- package/dist/index.mjs +43 -1889
- package/package.json +5 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { O } from '@eslint-react/tools';
|
|
2
3
|
import { RuleContext } from '@eslint-react/types';
|
|
3
|
-
import { Option } from 'effect';
|
|
4
4
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
5
5
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
|
11
11
|
*/
|
|
12
12
|
declare function elementType(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
|
|
13
13
|
|
|
14
|
-
declare function getJSXPragma(context: RuleContext):
|
|
14
|
+
declare function getJSXPragma(context: RuleContext): O.Option<string>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Get the name of a JSX attribute with namespace
|
|
@@ -19,16 +19,16 @@ declare function getJSXPragma(context: RuleContext): Option.Option<string>;
|
|
|
19
19
|
* @returns string
|
|
20
20
|
*/
|
|
21
21
|
declare function getPropName(node: TSESTree$1.JSXAttribute): string;
|
|
22
|
-
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope):
|
|
22
|
+
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope): O.Option<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute>;
|
|
23
23
|
/**
|
|
24
24
|
* Gets and resolves the static value of a JSX attribute
|
|
25
25
|
* @param attribute The JSX attribute to get the value of
|
|
26
26
|
* @param context The rule context
|
|
27
27
|
* @returns The static value of the given JSX attribute
|
|
28
28
|
*/
|
|
29
|
-
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext):
|
|
29
|
+
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext): O.None<{
|
|
30
30
|
value: unknown;
|
|
31
|
-
} | null> |
|
|
31
|
+
} | null> | O.Some<{
|
|
32
32
|
value: unknown;
|
|
33
33
|
} | null>;
|
|
34
34
|
/**
|
|
@@ -38,14 +38,14 @@ declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JS
|
|
|
38
38
|
* @param seenProps The properties that have already been seen
|
|
39
39
|
* @returns A function that searches for a property in the given properties
|
|
40
40
|
*/
|
|
41
|
-
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) =>
|
|
41
|
+
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) => O.Option<(typeof properties)[number]>;
|
|
42
42
|
/**
|
|
43
43
|
* @param attributes The attributes to search in
|
|
44
44
|
* @param context The rule context
|
|
45
45
|
* @param initialScope The initial scope to start from
|
|
46
46
|
* @returns A function that searches for a property in the given attributes
|
|
47
47
|
*/
|
|
48
|
-
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) =>
|
|
48
|
+
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) => O.Option<NonNullable<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | undefined>>;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Check if the given prop name is present in the given attributes
|
|
@@ -143,6 +143,6 @@ declare function isPaddingSpaces(node: TSESTree.Node): boolean;
|
|
|
143
143
|
* @param predicate The predicate to check each node
|
|
144
144
|
* @returns prop node if found
|
|
145
145
|
*/
|
|
146
|
-
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean):
|
|
146
|
+
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean): O.Option<TSESTree.JSXAttribute>;
|
|
147
147
|
|
|
148
148
|
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getJSXPragma, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { O } from '@eslint-react/tools';
|
|
2
3
|
import { RuleContext } from '@eslint-react/types';
|
|
3
|
-
import { Option } from 'effect';
|
|
4
4
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
5
5
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
|
11
11
|
*/
|
|
12
12
|
declare function elementType(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
|
|
13
13
|
|
|
14
|
-
declare function getJSXPragma(context: RuleContext):
|
|
14
|
+
declare function getJSXPragma(context: RuleContext): O.Option<string>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Get the name of a JSX attribute with namespace
|
|
@@ -19,16 +19,16 @@ declare function getJSXPragma(context: RuleContext): Option.Option<string>;
|
|
|
19
19
|
* @returns string
|
|
20
20
|
*/
|
|
21
21
|
declare function getPropName(node: TSESTree$1.JSXAttribute): string;
|
|
22
|
-
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope):
|
|
22
|
+
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope): O.Option<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute>;
|
|
23
23
|
/**
|
|
24
24
|
* Gets and resolves the static value of a JSX attribute
|
|
25
25
|
* @param attribute The JSX attribute to get the value of
|
|
26
26
|
* @param context The rule context
|
|
27
27
|
* @returns The static value of the given JSX attribute
|
|
28
28
|
*/
|
|
29
|
-
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext):
|
|
29
|
+
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext): O.None<{
|
|
30
30
|
value: unknown;
|
|
31
|
-
} | null> |
|
|
31
|
+
} | null> | O.Some<{
|
|
32
32
|
value: unknown;
|
|
33
33
|
} | null>;
|
|
34
34
|
/**
|
|
@@ -38,14 +38,14 @@ declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JS
|
|
|
38
38
|
* @param seenProps The properties that have already been seen
|
|
39
39
|
* @returns A function that searches for a property in the given properties
|
|
40
40
|
*/
|
|
41
|
-
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) =>
|
|
41
|
+
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) => O.Option<(typeof properties)[number]>;
|
|
42
42
|
/**
|
|
43
43
|
* @param attributes The attributes to search in
|
|
44
44
|
* @param context The rule context
|
|
45
45
|
* @param initialScope The initial scope to start from
|
|
46
46
|
* @returns A function that searches for a property in the given attributes
|
|
47
47
|
*/
|
|
48
|
-
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) =>
|
|
48
|
+
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) => O.Option<NonNullable<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | undefined>>;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Check if the given prop name is present in the given attributes
|
|
@@ -143,6 +143,6 @@ declare function isPaddingSpaces(node: TSESTree.Node): boolean;
|
|
|
143
143
|
* @param predicate The predicate to check each node
|
|
144
144
|
* @returns prop node if found
|
|
145
145
|
*/
|
|
146
|
-
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean):
|
|
146
|
+
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean): O.Option<TSESTree.JSXAttribute>;
|
|
147
147
|
|
|
148
148
|
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getJSXPragma, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp };
|