@eslint-react/jsx 1.5.0 → 1.5.1-beta.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/dist/index.cjs +1109 -41
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1109 -41
- package/dist/index.mjs +1109 -41
- package/package.json +9 -6
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { RuleContext } from '@eslint-react/types';
|
|
|
2
2
|
import { TSESTree } from '@typescript-eslint/types';
|
|
3
3
|
import { TSESTreeFunction } from '@eslint-react/ast';
|
|
4
4
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
5
|
-
import { O } from '@eslint-react/tools';
|
|
6
5
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
6
|
+
import { Option } from 'effect';
|
|
7
7
|
|
|
8
8
|
type _ = (node: TSESTree.Identifier | TSESTree.MemberExpression, context: RuleContext) => boolean;
|
|
9
9
|
declare const isCreateElement: _;
|
|
@@ -104,16 +104,16 @@ declare function isCallFromPragmaMember(pragmaMemberName: string, name: string):
|
|
|
104
104
|
* @returns string
|
|
105
105
|
*/
|
|
106
106
|
declare function getPropName(node: TSESTree$1.JSXAttribute): string;
|
|
107
|
-
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope):
|
|
107
|
+
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope): Option.Option<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute>;
|
|
108
108
|
/**
|
|
109
109
|
* Gets and resolves the static value of a JSX attribute
|
|
110
110
|
* @param attribute The JSX attribute to get the value of
|
|
111
111
|
* @param context The rule context
|
|
112
112
|
* @returns The static value of the given JSX attribute
|
|
113
113
|
*/
|
|
114
|
-
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext):
|
|
114
|
+
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext): Option.None<{
|
|
115
115
|
value: unknown;
|
|
116
|
-
} | null> |
|
|
116
|
+
} | null> | Option.Some<{
|
|
117
117
|
value: unknown;
|
|
118
118
|
} | null>;
|
|
119
119
|
/**
|
|
@@ -123,14 +123,14 @@ declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JS
|
|
|
123
123
|
* @param seenProps The properties that have already been seen
|
|
124
124
|
* @returns A function that searches for a property in the given properties
|
|
125
125
|
*/
|
|
126
|
-
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[] | TSESTree$1.ObjectLiteralElement[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) =>
|
|
126
|
+
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[] | TSESTree$1.ObjectLiteralElement[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) => Option.Option<(typeof properties)[number]>;
|
|
127
127
|
/**
|
|
128
128
|
* @param attributes The attributes to search in
|
|
129
129
|
* @param context The rule context
|
|
130
130
|
* @param initialScope
|
|
131
131
|
* @returns A function that searches for a property in the given attributes
|
|
132
132
|
*/
|
|
133
|
-
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) =>
|
|
133
|
+
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) => Option.Option<NonNullable<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | undefined>>;
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* Check if the given prop name is present in the given attributes
|
|
@@ -173,7 +173,7 @@ declare function isInsidePropValue(node: TSESTree.Node): boolean;
|
|
|
173
173
|
* @param predicate The predicate to check each node
|
|
174
174
|
* @returns prop node if found
|
|
175
175
|
*/
|
|
176
|
-
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean):
|
|
176
|
+
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean): Option.Option<TSESTree.JSXAttribute>;
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* Check if a node is a Literal or JSXText
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { RuleContext } from '@eslint-react/types';
|
|
|
2
2
|
import { TSESTree } from '@typescript-eslint/types';
|
|
3
3
|
import { TSESTreeFunction } from '@eslint-react/ast';
|
|
4
4
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
5
|
-
import { O } from '@eslint-react/tools';
|
|
6
5
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
6
|
+
import { Option } from 'effect';
|
|
7
7
|
|
|
8
8
|
type _ = (node: TSESTree.Identifier | TSESTree.MemberExpression, context: RuleContext) => boolean;
|
|
9
9
|
declare const isCreateElement: _;
|
|
@@ -104,16 +104,16 @@ declare function isCallFromPragmaMember(pragmaMemberName: string, name: string):
|
|
|
104
104
|
* @returns string
|
|
105
105
|
*/
|
|
106
106
|
declare function getPropName(node: TSESTree$1.JSXAttribute): string;
|
|
107
|
-
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope):
|
|
107
|
+
declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], propName: string, context: RuleContext, initialScope: Scope): Option.Option<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute>;
|
|
108
108
|
/**
|
|
109
109
|
* Gets and resolves the static value of a JSX attribute
|
|
110
110
|
* @param attribute The JSX attribute to get the value of
|
|
111
111
|
* @param context The rule context
|
|
112
112
|
* @returns The static value of the given JSX attribute
|
|
113
113
|
*/
|
|
114
|
-
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext):
|
|
114
|
+
declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, context: RuleContext): Option.None<{
|
|
115
115
|
value: unknown;
|
|
116
|
-
} | null> |
|
|
116
|
+
} | null> | Option.Some<{
|
|
117
117
|
value: unknown;
|
|
118
118
|
} | null>;
|
|
119
119
|
/**
|
|
@@ -123,14 +123,14 @@ declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JS
|
|
|
123
123
|
* @param seenProps The properties that have already been seen
|
|
124
124
|
* @returns A function that searches for a property in the given properties
|
|
125
125
|
*/
|
|
126
|
-
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[] | TSESTree$1.ObjectLiteralElement[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) =>
|
|
126
|
+
declare function findPropInProperties(properties: (TSESTree$1.Property | TSESTree$1.RestElement | TSESTree$1.SpreadElement)[] | TSESTree$1.ObjectLiteralElement[], context: RuleContext, initialScope: Scope, seenProps?: string[]): (propName: string) => Option.Option<(typeof properties)[number]>;
|
|
127
127
|
/**
|
|
128
128
|
* @param attributes The attributes to search in
|
|
129
129
|
* @param context The rule context
|
|
130
130
|
* @param initialScope
|
|
131
131
|
* @returns A function that searches for a property in the given attributes
|
|
132
132
|
*/
|
|
133
|
-
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) =>
|
|
133
|
+
declare function findPropInAttributes(attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], context: RuleContext, initialScope: Scope): (propName: string) => Option.Option<NonNullable<TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | undefined>>;
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* Check if the given prop name is present in the given attributes
|
|
@@ -173,7 +173,7 @@ declare function isInsidePropValue(node: TSESTree.Node): boolean;
|
|
|
173
173
|
* @param predicate The predicate to check each node
|
|
174
174
|
* @returns prop node if found
|
|
175
175
|
*/
|
|
176
|
-
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean):
|
|
176
|
+
declare function traverseUpProp(node: TSESTree.Node, predicate?: (node: TSESTree.JSXAttribute) => boolean): Option.Option<TSESTree.JSXAttribute>;
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* Check if a node is a Literal or JSXText
|