@eslint-react/core 1.38.0 → 1.38.1-beta.3
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 +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -149,7 +149,7 @@ declare function isRenderMethodLike(node: TSESTree.Node): node is AST.TSESTreeMe
|
|
|
149
149
|
declare function isFunctionOfRenderMethod(node: AST.TSESTreeFunction): boolean;
|
|
150
150
|
/**
|
|
151
151
|
* Check whether given node is declared inside class component's render block
|
|
152
|
-
* ```
|
|
152
|
+
* ```tsx
|
|
153
153
|
* class Component extends React.Component {
|
|
154
154
|
* render() {
|
|
155
155
|
* class NestedClassComponent extends React.Component {
|
|
@@ -185,7 +185,7 @@ declare const isInversePhase: {
|
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
187
|
* Unsafe check whether given node is a render function
|
|
188
|
-
* ```
|
|
188
|
+
* ```tsx
|
|
189
189
|
* const renderRow = () => <div />
|
|
190
190
|
* ` ^^^^^^^^^^^^`
|
|
191
191
|
* _ = <Component renderRow={() => <div />} />
|
|
@@ -198,7 +198,7 @@ declare const isInversePhase: {
|
|
|
198
198
|
declare function isRenderFunctionLoose(context: RuleContext, node: AST.TSESTreeFunction): boolean;
|
|
199
199
|
/**
|
|
200
200
|
* Unsafe check whether given JSXAttribute is a render prop
|
|
201
|
-
* ```
|
|
201
|
+
* ```tsx
|
|
202
202
|
* _ = <Component renderRow={() => <div />} />
|
|
203
203
|
* ` ^^^^^^^^^^^^^^^^^^^^^^^^^ `
|
|
204
204
|
* ```
|
|
@@ -209,7 +209,7 @@ declare function isRenderFunctionLoose(context: RuleContext, node: AST.TSESTreeF
|
|
|
209
209
|
declare function isRenderPropLoose(context: RuleContext, node: TSESTree.JSXAttribute): boolean;
|
|
210
210
|
/**
|
|
211
211
|
* Unsafe check whether given node is declared directly inside a render property
|
|
212
|
-
* ```
|
|
212
|
+
* ```tsx
|
|
213
213
|
* const rows = { render: () => <div /> }
|
|
214
214
|
* ` ^^^^^^^^^^^^^ `
|
|
215
215
|
* _ = <Component rows={ [{ render: () => <div /> }] } />
|
|
@@ -222,7 +222,7 @@ declare function isRenderPropLoose(context: RuleContext, node: TSESTree.JSXAttri
|
|
|
222
222
|
declare function isDirectValueOfRenderPropertyLoose(node: TSESTree.Node): boolean;
|
|
223
223
|
/**
|
|
224
224
|
* Unsafe check whether given node is declared inside a render prop
|
|
225
|
-
* ```
|
|
225
|
+
* ```tsx
|
|
226
226
|
* _ = <Component renderRow={"node"} />
|
|
227
227
|
* ` ^^^^^^ `
|
|
228
228
|
* _ = <Component rows={ [{ render: "node" }] } />
|
|
@@ -260,8 +260,8 @@ declare const DISPLAY_NAME_ASSIGNMENT_SELECTOR: string;
|
|
|
260
260
|
|
|
261
261
|
type EREffectKind = "useEffect" | "useLayoutEffect" | "useInsertionEffect";
|
|
262
262
|
|
|
263
|
-
declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | _): boolean
|
|
264
|
-
declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | _): boolean
|
|
263
|
+
declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | _): boolean;
|
|
264
|
+
declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | _): boolean;
|
|
265
265
|
|
|
266
266
|
interface ERHook extends ERSemanticNode {
|
|
267
267
|
id: TSESTree.Identifier | _;
|
|
@@ -286,7 +286,7 @@ declare const RE_HOOK_NAME: RegExp;
|
|
|
286
286
|
declare function isReactHookName(name: string): boolean;
|
|
287
287
|
declare function isReactHookNameLoose(name: string): boolean;
|
|
288
288
|
|
|
289
|
-
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean
|
|
289
|
+
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean;
|
|
290
290
|
/**
|
|
291
291
|
* Check if the given node is a React Hook call by its name.
|
|
292
292
|
* @param node The node to check.
|
package/dist/index.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ declare function isRenderMethodLike(node: TSESTree.Node): node is AST.TSESTreeMe
|
|
|
149
149
|
declare function isFunctionOfRenderMethod(node: AST.TSESTreeFunction): boolean;
|
|
150
150
|
/**
|
|
151
151
|
* Check whether given node is declared inside class component's render block
|
|
152
|
-
* ```
|
|
152
|
+
* ```tsx
|
|
153
153
|
* class Component extends React.Component {
|
|
154
154
|
* render() {
|
|
155
155
|
* class NestedClassComponent extends React.Component {
|
|
@@ -185,7 +185,7 @@ declare const isInversePhase: {
|
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
187
|
* Unsafe check whether given node is a render function
|
|
188
|
-
* ```
|
|
188
|
+
* ```tsx
|
|
189
189
|
* const renderRow = () => <div />
|
|
190
190
|
* ` ^^^^^^^^^^^^`
|
|
191
191
|
* _ = <Component renderRow={() => <div />} />
|
|
@@ -198,7 +198,7 @@ declare const isInversePhase: {
|
|
|
198
198
|
declare function isRenderFunctionLoose(context: RuleContext, node: AST.TSESTreeFunction): boolean;
|
|
199
199
|
/**
|
|
200
200
|
* Unsafe check whether given JSXAttribute is a render prop
|
|
201
|
-
* ```
|
|
201
|
+
* ```tsx
|
|
202
202
|
* _ = <Component renderRow={() => <div />} />
|
|
203
203
|
* ` ^^^^^^^^^^^^^^^^^^^^^^^^^ `
|
|
204
204
|
* ```
|
|
@@ -209,7 +209,7 @@ declare function isRenderFunctionLoose(context: RuleContext, node: AST.TSESTreeF
|
|
|
209
209
|
declare function isRenderPropLoose(context: RuleContext, node: TSESTree.JSXAttribute): boolean;
|
|
210
210
|
/**
|
|
211
211
|
* Unsafe check whether given node is declared directly inside a render property
|
|
212
|
-
* ```
|
|
212
|
+
* ```tsx
|
|
213
213
|
* const rows = { render: () => <div /> }
|
|
214
214
|
* ` ^^^^^^^^^^^^^ `
|
|
215
215
|
* _ = <Component rows={ [{ render: () => <div /> }] } />
|
|
@@ -222,7 +222,7 @@ declare function isRenderPropLoose(context: RuleContext, node: TSESTree.JSXAttri
|
|
|
222
222
|
declare function isDirectValueOfRenderPropertyLoose(node: TSESTree.Node): boolean;
|
|
223
223
|
/**
|
|
224
224
|
* Unsafe check whether given node is declared inside a render prop
|
|
225
|
-
* ```
|
|
225
|
+
* ```tsx
|
|
226
226
|
* _ = <Component renderRow={"node"} />
|
|
227
227
|
* ` ^^^^^^ `
|
|
228
228
|
* _ = <Component rows={ [{ render: "node" }] } />
|
|
@@ -260,8 +260,8 @@ declare const DISPLAY_NAME_ASSIGNMENT_SELECTOR: string;
|
|
|
260
260
|
|
|
261
261
|
type EREffectKind = "useEffect" | "useLayoutEffect" | "useInsertionEffect";
|
|
262
262
|
|
|
263
|
-
declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | _): boolean
|
|
264
|
-
declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | _): boolean
|
|
263
|
+
declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | _): boolean;
|
|
264
|
+
declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | _): boolean;
|
|
265
265
|
|
|
266
266
|
interface ERHook extends ERSemanticNode {
|
|
267
267
|
id: TSESTree.Identifier | _;
|
|
@@ -286,7 +286,7 @@ declare const RE_HOOK_NAME: RegExp;
|
|
|
286
286
|
declare function isReactHookName(name: string): boolean;
|
|
287
287
|
declare function isReactHookNameLoose(name: string): boolean;
|
|
288
288
|
|
|
289
|
-
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean
|
|
289
|
+
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean;
|
|
290
290
|
/**
|
|
291
291
|
* Check if the given node is a React Hook call by its name.
|
|
292
292
|
* @param node The node to check.
|
package/dist/index.js
CHANGED
|
@@ -663,7 +663,7 @@ var isMemoCall = isReactAPICall("memo");
|
|
|
663
663
|
|
|
664
664
|
// src/hook/is.ts
|
|
665
665
|
function isReactHook(node) {
|
|
666
|
-
if (node == null) return
|
|
666
|
+
if (node == null) return false;
|
|
667
667
|
const id = AST6__namespace.getFunctionIdentifier(node);
|
|
668
668
|
return id?.name != null && isReactHookName(id.name);
|
|
669
669
|
}
|
|
@@ -1202,11 +1202,11 @@ function isAssignmentToThisState(node) {
|
|
|
1202
1202
|
return left.type === types.AST_NODE_TYPES.MemberExpression && AST6__namespace.isThisExpression(left.object) && AST6__namespace.getPropertyName(left.property) === "state";
|
|
1203
1203
|
}
|
|
1204
1204
|
function isFunctionOfUseEffectSetup(node) {
|
|
1205
|
-
if (node == null) return
|
|
1205
|
+
if (node == null) return false;
|
|
1206
1206
|
return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
|
|
1207
1207
|
}
|
|
1208
1208
|
function isFunctionOfUseEffectCleanup(node) {
|
|
1209
|
-
if (node == null) return
|
|
1209
|
+
if (node == null) return false;
|
|
1210
1210
|
const returnStatement = AST6__namespace.findParentNode(node, AST6__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
|
|
1211
1211
|
const enclosingFunction = AST6__namespace.findParentNode(node, AST6__namespace.isFunction);
|
|
1212
1212
|
const functionOfReturnStatement = AST6__namespace.findParentNode(returnStatement, AST6__namespace.isFunction);
|
package/dist/index.mjs
CHANGED
|
@@ -636,7 +636,7 @@ var isMemoCall = isReactAPICall("memo");
|
|
|
636
636
|
|
|
637
637
|
// src/hook/is.ts
|
|
638
638
|
function isReactHook(node) {
|
|
639
|
-
if (node == null) return
|
|
639
|
+
if (node == null) return false;
|
|
640
640
|
const id = AST6.getFunctionIdentifier(node);
|
|
641
641
|
return id?.name != null && isReactHookName(id.name);
|
|
642
642
|
}
|
|
@@ -1175,11 +1175,11 @@ function isAssignmentToThisState(node) {
|
|
|
1175
1175
|
return left.type === AST_NODE_TYPES.MemberExpression && AST6.isThisExpression(left.object) && AST6.getPropertyName(left.property) === "state";
|
|
1176
1176
|
}
|
|
1177
1177
|
function isFunctionOfUseEffectSetup(node) {
|
|
1178
|
-
if (node == null) return
|
|
1178
|
+
if (node == null) return false;
|
|
1179
1179
|
return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
|
|
1180
1180
|
}
|
|
1181
1181
|
function isFunctionOfUseEffectCleanup(node) {
|
|
1182
|
-
if (node == null) return
|
|
1182
|
+
if (node == null) return false;
|
|
1183
1183
|
const returnStatement = AST6.findParentNode(node, AST6.is(AST_NODE_TYPES.ReturnStatement));
|
|
1184
1184
|
const enclosingFunction = AST6.findParentNode(node, AST6.isFunction);
|
|
1185
1185
|
const functionOfReturnStatement = AST6.findParentNode(returnStatement, AST6.isFunction);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.38.
|
|
3
|
+
"version": "1.38.1-beta.3",
|
|
4
4
|
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.28.0",
|
|
42
42
|
"birecord": "^0.1.1",
|
|
43
43
|
"ts-pattern": "^5.6.2",
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/shared": "1.38.
|
|
44
|
+
"@eslint-react/ast": "1.38.1-beta.3",
|
|
45
|
+
"@eslint-react/eff": "1.38.1-beta.3",
|
|
46
|
+
"@eslint-react/kit": "1.38.1-beta.3",
|
|
47
|
+
"@eslint-react/jsx": "1.38.1-beta.3",
|
|
48
|
+
"@eslint-react/var": "1.38.1-beta.3",
|
|
49
|
+
"@eslint-react/shared": "1.38.1-beta.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"tsup": "^8.4.0",
|