@eslint-react/core 1.20.2-next.2 → 1.20.2-next.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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +80 -80
- package/dist/index.mjs +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
|
-
import { O } from '@eslint-react/
|
|
2
|
+
import { O } from '@eslint-react/eff';
|
|
3
3
|
import { TSESTree } from '@typescript-eslint/types';
|
|
4
4
|
import * as _eslint_react_types from '@eslint-react/types';
|
|
5
5
|
import { RuleContext } from '@eslint-react/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
|
-
import { O } from '@eslint-react/
|
|
2
|
+
import { O } from '@eslint-react/eff';
|
|
3
3
|
import { TSESTree } from '@typescript-eslint/types';
|
|
4
4
|
import * as _eslint_react_types from '@eslint-react/types';
|
|
5
5
|
import { RuleContext } from '@eslint-react/types';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var AST9 = require('@eslint-react/ast');
|
|
4
|
+
var eff = require('@eslint-react/eff');
|
|
4
5
|
var JSX4 = require('@eslint-react/jsx');
|
|
5
|
-
var tools = require('@eslint-react/tools');
|
|
6
6
|
var types = require('@typescript-eslint/types');
|
|
7
7
|
var ShortUniqueId = require('short-unique-id');
|
|
8
8
|
var tsPattern = require('ts-pattern');
|
|
@@ -42,13 +42,13 @@ function getElementRepresentName(node, context) {
|
|
|
42
42
|
if (rawElementName === rawElementName.toLowerCase()) return rawElementName;
|
|
43
43
|
const { components, polymorphicPropName } = shared.normalizeSettings(shared.decodeSettings(context.settings));
|
|
44
44
|
const asElementName = components.get(rawElementName);
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
if (eff.isString(asElementName)) return asElementName;
|
|
46
|
+
return eff.F.pipe(
|
|
47
|
+
eff.O.fromNullable(polymorphicPropName),
|
|
48
|
+
eff.O.flatMap(JSX4__namespace.findPropInAttributes(node.attributes, context.sourceCode.getScope(node))),
|
|
49
|
+
eff.O.flatMap((attr) => JSX4__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
|
|
50
|
+
eff.O.filter(eff.isString),
|
|
51
|
+
eff.O.getOrElse(() => rawElementName)
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
function isInitializedFromReact(name, initialScope, settings) {
|
|
@@ -129,21 +129,21 @@ var isMemoCall = isReactAPICallWithName("memo");
|
|
|
129
129
|
|
|
130
130
|
// src/element/hierarchy.ts
|
|
131
131
|
function isInsideCreateElementProps(node, context) {
|
|
132
|
-
return
|
|
132
|
+
return eff.F.pipe(
|
|
133
133
|
AST9__namespace.traverseUp(node, (n) => AST9__namespace.is(types.AST_NODE_TYPES.CallExpression)(n) && isCreateElementCall(n, context)),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
eff.O.filter(AST9__namespace.is(types.AST_NODE_TYPES.CallExpression)),
|
|
135
|
+
eff.O.flatMapNullable((c) => c.arguments.at(1)),
|
|
136
|
+
eff.O.filter(AST9__namespace.is(types.AST_NODE_TYPES.ObjectExpression)),
|
|
137
|
+
eff.O.zipWith(AST9__namespace.traverseUp(node, AST9__namespace.is(types.AST_NODE_TYPES.ObjectExpression)), (a, b) => a === b),
|
|
138
|
+
eff.O.getOrElse(eff.F.constFalse)
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
function isChildrenOfCreateElement(node, context) {
|
|
142
|
-
return
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
return eff.F.pipe(
|
|
143
|
+
eff.O.fromNullable(node.parent),
|
|
144
|
+
eff.O.filter(AST9__namespace.is(types.AST_NODE_TYPES.CallExpression)),
|
|
145
|
+
eff.O.filter((n) => isCreateElementCall(n, context)),
|
|
146
|
+
eff.O.exists(
|
|
147
147
|
(n) => n.arguments.slice(2).some((arg) => arg === node)
|
|
148
148
|
)
|
|
149
149
|
);
|
|
@@ -164,10 +164,10 @@ function isReactHookName(name) {
|
|
|
164
164
|
|
|
165
165
|
// src/hook/is.ts
|
|
166
166
|
function isReactHook(node) {
|
|
167
|
-
return
|
|
167
|
+
return eff.F.pipe(
|
|
168
168
|
AST9__namespace.getFunctionIdentifier(node),
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
eff.O.flatMapNullable((id) => id.name),
|
|
170
|
+
eff.O.exists(isReactHookName)
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
function isReactHookCall(node) {
|
|
@@ -228,28 +228,28 @@ function isUseEffectCallLoose(node) {
|
|
|
228
228
|
return false;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
var isUseCallbackCall =
|
|
232
|
-
var isUseContextCall =
|
|
233
|
-
var isUseDebugValueCall =
|
|
234
|
-
var isUseDeferredValueCall =
|
|
235
|
-
var isUseEffectCall =
|
|
236
|
-
var isUseIdCall =
|
|
237
|
-
var isUseImperativeHandleCall =
|
|
238
|
-
var isUseInsertionEffectCall =
|
|
239
|
-
var isUseLayoutEffectCall =
|
|
240
|
-
var isUseMemoCall =
|
|
241
|
-
var isUseReducerCall =
|
|
242
|
-
var isUseRefCall =
|
|
243
|
-
var isUseStateCall =
|
|
244
|
-
var isUseSyncExternalStoreCall =
|
|
245
|
-
var isUseTransitionCall =
|
|
231
|
+
var isUseCallbackCall = eff.F.flip(isReactHookCallWithName)("useCallback");
|
|
232
|
+
var isUseContextCall = eff.F.flip(isReactHookCallWithName)("useContext");
|
|
233
|
+
var isUseDebugValueCall = eff.F.flip(isReactHookCallWithName)("useDebugValue");
|
|
234
|
+
var isUseDeferredValueCall = eff.F.flip(isReactHookCallWithName)("useDeferredValue");
|
|
235
|
+
var isUseEffectCall = eff.F.flip(isReactHookCallWithName)("useEffect");
|
|
236
|
+
var isUseIdCall = eff.F.flip(isReactHookCallWithName)("useId");
|
|
237
|
+
var isUseImperativeHandleCall = eff.F.flip(isReactHookCallWithName)("useImperativeHandle");
|
|
238
|
+
var isUseInsertionEffectCall = eff.F.flip(isReactHookCallWithName)("useInsertionEffect");
|
|
239
|
+
var isUseLayoutEffectCall = eff.F.flip(isReactHookCallWithName)("useLayoutEffect");
|
|
240
|
+
var isUseMemoCall = eff.F.flip(isReactHookCallWithName)("useMemo");
|
|
241
|
+
var isUseReducerCall = eff.F.flip(isReactHookCallWithName)("useReducer");
|
|
242
|
+
var isUseRefCall = eff.F.flip(isReactHookCallWithName)("useRef");
|
|
243
|
+
var isUseStateCall = eff.F.flip(isReactHookCallWithName)("useState");
|
|
244
|
+
var isUseSyncExternalStoreCall = eff.F.flip(isReactHookCallWithName)("useSyncExternalStore");
|
|
245
|
+
var isUseTransitionCall = eff.F.flip(isReactHookCallWithName)("useTransition");
|
|
246
246
|
|
|
247
247
|
// src/hook/hierarchy.ts
|
|
248
248
|
function isInsideReactHook(node) {
|
|
249
|
-
return
|
|
249
|
+
return eff.O.exists(AST9__namespace.traverseUpGuard(node, AST9__namespace.isFunction), isReactHook);
|
|
250
250
|
}
|
|
251
251
|
function isInsideReactHookCall(node) {
|
|
252
|
-
return
|
|
252
|
+
return eff.O.isSome(AST9__namespace.traverseUp(node, (n) => AST9__namespace.is(types.AST_NODE_TYPES.CallExpression)(n) && isReactHookCall(n)));
|
|
253
253
|
}
|
|
254
254
|
var uid = new ShortUniqueId__default.default({ length: 10 });
|
|
255
255
|
function useHookCollector() {
|
|
@@ -257,14 +257,14 @@ function useHookCollector() {
|
|
|
257
257
|
const fStack = [];
|
|
258
258
|
const onFunctionEnter = (node) => {
|
|
259
259
|
const id = AST9__namespace.getFunctionIdentifier(node);
|
|
260
|
-
const name =
|
|
261
|
-
const isHook =
|
|
260
|
+
const name = eff.O.flatMapNullable(id, (id2) => id2.name);
|
|
261
|
+
const isHook = eff.O.isSome(id) && eff.O.isSome(name) && isReactHookName(name.value);
|
|
262
262
|
if (!isHook) {
|
|
263
|
-
fStack.push([node,
|
|
263
|
+
fStack.push([node, eff.O.none()]);
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
const key = uid.rnd();
|
|
267
|
-
fStack.push([node,
|
|
267
|
+
fStack.push([node, eff.O.some(key)]);
|
|
268
268
|
hooks.set(key, {
|
|
269
269
|
_: key,
|
|
270
270
|
id,
|
|
@@ -294,11 +294,11 @@ function useHookCollector() {
|
|
|
294
294
|
if (!isReactHookCall(node)) return;
|
|
295
295
|
const [fNode, hookId] = fStack.at(-1) ?? [];
|
|
296
296
|
if (!fNode || !hookId) return;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
eff.F.pipe(
|
|
298
|
+
eff.O.Do,
|
|
299
|
+
eff.O.bind("id", () => hookId),
|
|
300
|
+
eff.O.bind("hook", ({ id }) => eff.O.fromNullable(hooks.get(id))),
|
|
301
|
+
eff.O.map(({ id, hook }) => {
|
|
302
302
|
hooks.set(id, {
|
|
303
303
|
...hook,
|
|
304
304
|
hookCalls: [
|
|
@@ -354,15 +354,15 @@ function isComponentWrapperCall(node, context) {
|
|
|
354
354
|
}
|
|
355
355
|
function getFunctionComponentIdentifier(node, context) {
|
|
356
356
|
const functionId = AST9__namespace.getFunctionIdentifier(node);
|
|
357
|
-
if (
|
|
357
|
+
if (eff.O.isSome(functionId)) return functionId;
|
|
358
358
|
const { parent } = node;
|
|
359
359
|
if (parent.type === types.AST_NODE_TYPES.CallExpression && isComponentWrapperCall(parent, context) && parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator && parent.parent.id.type === types.AST_NODE_TYPES.Identifier) {
|
|
360
|
-
return
|
|
360
|
+
return eff.O.some(parent.parent.id);
|
|
361
361
|
}
|
|
362
362
|
if (parent.type === types.AST_NODE_TYPES.CallExpression && isComponentWrapperCall(parent, context) && parent.parent.type === types.AST_NODE_TYPES.CallExpression && isComponentWrapperCall(parent.parent, context) && parent.parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator && parent.parent.parent.id.type === types.AST_NODE_TYPES.Identifier) {
|
|
363
|
-
return
|
|
363
|
+
return eff.O.some(parent.parent.parent.id);
|
|
364
364
|
}
|
|
365
|
-
return
|
|
365
|
+
return eff.O.none();
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
// src/component/component-name.ts
|
|
@@ -430,10 +430,10 @@ function useComponentCollectorLegacy() {
|
|
|
430
430
|
_: key,
|
|
431
431
|
id,
|
|
432
432
|
kind: "class",
|
|
433
|
-
name:
|
|
433
|
+
name: eff.O.flatMapNullable(id, (n) => n.name),
|
|
434
434
|
node,
|
|
435
435
|
// TODO: Get displayName of class component
|
|
436
|
-
displayName:
|
|
436
|
+
displayName: eff.O.none(),
|
|
437
437
|
flag,
|
|
438
438
|
hint: 0n,
|
|
439
439
|
// TODO: Get methods of class component
|
|
@@ -470,13 +470,13 @@ function isInsideRenderMethod(node) {
|
|
|
470
470
|
const predicate = (node2) => {
|
|
471
471
|
return isRenderMethodLike(node2) && isClassComponent(node2.parent.parent);
|
|
472
472
|
};
|
|
473
|
-
return
|
|
473
|
+
return eff.O.isSome(AST9__namespace.traverseUp(node, predicate));
|
|
474
474
|
}
|
|
475
475
|
function hasNoneOrValidComponentName(node, context) {
|
|
476
|
-
return
|
|
476
|
+
return eff.O.match(
|
|
477
477
|
getFunctionComponentIdentifier(node, context),
|
|
478
478
|
{
|
|
479
|
-
onNone:
|
|
479
|
+
onNone: eff.F.constTrue,
|
|
480
480
|
onSome: (id) => {
|
|
481
481
|
const name = Array.isArray(id) ? id.at(-1)?.name : id.name;
|
|
482
482
|
return !!name && isComponentName(name);
|
|
@@ -503,7 +503,7 @@ function hasValidHierarchy(node, context, hint) {
|
|
|
503
503
|
if (hint & ERComponentHint.SkipClassProperty && AST9__namespace.isFunctionOfClassProperty(node.parent)) {
|
|
504
504
|
return false;
|
|
505
505
|
}
|
|
506
|
-
return !
|
|
506
|
+
return !eff.O.exists(
|
|
507
507
|
AST9__namespace.traverseUp(
|
|
508
508
|
node,
|
|
509
509
|
AST9__namespace.isOneOf([
|
|
@@ -531,7 +531,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
531
531
|
const jsxCtx = { getScope: (node) => context.sourceCode.getScope(node) };
|
|
532
532
|
const components = /* @__PURE__ */ new Map();
|
|
533
533
|
const functionStack = [];
|
|
534
|
-
const getCurrentFunction = () =>
|
|
534
|
+
const getCurrentFunction = () => eff.O.fromNullable(functionStack.at(-1));
|
|
535
535
|
const onFunctionEnter = (node) => functionStack.push([uid3.rnd(), node, false, []]);
|
|
536
536
|
const onFunctionExit = () => {
|
|
537
537
|
const [key, fn, isComponent] = functionStack.at(-1) ?? [];
|
|
@@ -559,14 +559,14 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
559
559
|
":function[type]:exit": onFunctionExit,
|
|
560
560
|
"ArrowFunctionExpression[type][body.type!='BlockStatement']"() {
|
|
561
561
|
const maybeCurrentFn = getCurrentFunction();
|
|
562
|
-
if (
|
|
562
|
+
if (eff.O.isNone(maybeCurrentFn)) return;
|
|
563
563
|
const [_key, currentFn, _isComponent, hookCalls] = maybeCurrentFn.value;
|
|
564
564
|
const { body } = currentFn;
|
|
565
565
|
const isComponent = hasNoneOrValidComponentName(currentFn, context) && JSX4__namespace.isJSXValue(body, jsxCtx, hint) && hasValidHierarchy(currentFn, context, hint);
|
|
566
566
|
if (!isComponent) return;
|
|
567
567
|
const initPath = AST9__namespace.getFunctionInitPath(currentFn);
|
|
568
568
|
const id = getFunctionComponentIdentifier(currentFn, context);
|
|
569
|
-
const name =
|
|
569
|
+
const name = eff.O.flatMapNullable(id, getComponentNameFromIdentifier);
|
|
570
570
|
const key = uid3.rnd();
|
|
571
571
|
components.set(key, {
|
|
572
572
|
_: key,
|
|
@@ -574,7 +574,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
574
574
|
kind: "function",
|
|
575
575
|
name,
|
|
576
576
|
node: currentFn,
|
|
577
|
-
displayName:
|
|
577
|
+
displayName: eff.O.none(),
|
|
578
578
|
flag: getComponentFlag(initPath),
|
|
579
579
|
hint,
|
|
580
580
|
hookCalls,
|
|
@@ -585,26 +585,26 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
585
585
|
if (node.type !== types.AST_NODE_TYPES.AssignmentExpression) return;
|
|
586
586
|
const { left, right } = node;
|
|
587
587
|
if (left.type !== types.AST_NODE_TYPES.MemberExpression) return;
|
|
588
|
-
const maybeComponentName = tsPattern.match(left.object).with({ type: types.AST_NODE_TYPES.Identifier }, (n) =>
|
|
589
|
-
if (
|
|
590
|
-
const component = Array.from(components.values()).findLast(({ name }) =>
|
|
588
|
+
const maybeComponentName = tsPattern.match(left.object).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => eff.O.some(n.name)).otherwise(eff.O.none);
|
|
589
|
+
if (eff.O.isNone(maybeComponentName)) return;
|
|
590
|
+
const component = Array.from(components.values()).findLast(({ name }) => eff.O.exists(name, (n) => n === maybeComponentName.value));
|
|
591
591
|
if (!component) return;
|
|
592
592
|
components.set(component._, {
|
|
593
593
|
...component,
|
|
594
|
-
displayName:
|
|
594
|
+
displayName: eff.O.some(right)
|
|
595
595
|
});
|
|
596
596
|
},
|
|
597
597
|
"CallExpression[type]:exit"(node) {
|
|
598
598
|
if (!isReactHookCall(node)) return;
|
|
599
599
|
const maybeCurrentFn = getCurrentFunction();
|
|
600
|
-
if (
|
|
600
|
+
if (eff.O.isNone(maybeCurrentFn)) return;
|
|
601
601
|
const [key, currentFn, isComponent, hookCalls] = maybeCurrentFn.value;
|
|
602
602
|
functionStack.pop();
|
|
603
603
|
functionStack.push([key, currentFn, isComponent, [...hookCalls, node]]);
|
|
604
604
|
},
|
|
605
605
|
"ReturnStatement[type]"(node) {
|
|
606
606
|
const maybeCurrentFn = getCurrentFunction();
|
|
607
|
-
if (
|
|
607
|
+
if (eff.O.isNone(maybeCurrentFn)) return;
|
|
608
608
|
const [key, currentFn, isKnown, hookCalls] = maybeCurrentFn.value;
|
|
609
609
|
if (isKnown) return;
|
|
610
610
|
const isComponent = hasNoneOrValidComponentName(currentFn, context) && JSX4__namespace.isJSXValue(node.argument, jsxCtx, hint) && hasValidHierarchy(currentFn, context, hint);
|
|
@@ -613,14 +613,14 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
613
613
|
functionStack.push([key, currentFn, true, []]);
|
|
614
614
|
const initPath = AST9__namespace.getFunctionInitPath(currentFn);
|
|
615
615
|
const id = getFunctionComponentIdentifier(currentFn, context);
|
|
616
|
-
const name =
|
|
616
|
+
const name = eff.O.flatMapNullable(id, getComponentNameFromIdentifier);
|
|
617
617
|
components.set(key, {
|
|
618
618
|
_: key,
|
|
619
619
|
id,
|
|
620
620
|
kind: "function",
|
|
621
621
|
name,
|
|
622
622
|
node: currentFn,
|
|
623
|
-
displayName:
|
|
623
|
+
displayName: eff.O.none(),
|
|
624
624
|
flag: getComponentFlag(initPath),
|
|
625
625
|
hint,
|
|
626
626
|
hookCalls,
|
|
@@ -634,10 +634,10 @@ function isSetupFunction(node) {
|
|
|
634
634
|
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);
|
|
635
635
|
}
|
|
636
636
|
function isCleanupFunction(node) {
|
|
637
|
-
const nearestRet =
|
|
637
|
+
const nearestRet = eff.O.getOrNull(AST9__namespace.traverseUpGuard(node, AST9__namespace.is(types.AST_NODE_TYPES.ReturnStatement)));
|
|
638
638
|
if (!nearestRet) return false;
|
|
639
|
-
const nearestFunction =
|
|
640
|
-
const nearestFunctionOfRet =
|
|
639
|
+
const nearestFunction = eff.O.getOrNull(AST9__namespace.traverseUpGuard(node, AST9__namespace.isFunction));
|
|
640
|
+
const nearestFunctionOfRet = eff.O.getOrNull(AST9__namespace.traverseUpGuard(nearestRet, AST9__namespace.isFunction));
|
|
641
641
|
if (!nearestFunction || !nearestFunctionOfRet) return false;
|
|
642
642
|
return nearestFunction === nearestFunctionOfRet && isSetupFunction(nearestFunction);
|
|
643
643
|
}
|
|
@@ -645,7 +645,7 @@ var ERPhaseRelevance = birecord__default.default({
|
|
|
645
645
|
mount: "unmount",
|
|
646
646
|
setup: "cleanup"
|
|
647
647
|
});
|
|
648
|
-
var isInversePhase =
|
|
648
|
+
var isInversePhase = eff.F.dual(2, (a, b) => ERPhaseRelevance.get(a) === b);
|
|
649
649
|
function isDirectValueOfRenderPropertyLoose(node) {
|
|
650
650
|
const matching = tsPattern.isMatching({
|
|
651
651
|
key: {
|
|
@@ -660,12 +660,12 @@ function isDeclaredInRenderPropLoose(node) {
|
|
|
660
660
|
if (isDirectValueOfRenderPropertyLoose(node)) {
|
|
661
661
|
return true;
|
|
662
662
|
}
|
|
663
|
-
return
|
|
663
|
+
return eff.F.pipe(
|
|
664
664
|
AST9__namespace.traverseUpGuard(node, AST9__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)),
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
665
|
+
eff.O.flatMapNullable((c) => c.parent),
|
|
666
|
+
eff.O.filter(AST9__namespace.is(types.AST_NODE_TYPES.JSXAttribute)),
|
|
667
|
+
eff.O.flatMapNullable((a) => a.name),
|
|
668
|
+
eff.O.exists(tsPattern.isMatching({
|
|
669
669
|
type: types.AST_NODE_TYPES.JSXIdentifier,
|
|
670
670
|
name: tsPattern.P.string.startsWith("render")
|
|
671
671
|
}))
|
|
@@ -674,7 +674,7 @@ function isDeclaredInRenderPropLoose(node) {
|
|
|
674
674
|
function isRenderFunctionLoose(node, context) {
|
|
675
675
|
const { body, parent } = node;
|
|
676
676
|
const maybeId = AST9__namespace.getFunctionIdentifier(node);
|
|
677
|
-
if (
|
|
677
|
+
if (eff.O.isSome(maybeId) && !maybeId.value.name.startsWith("render")) {
|
|
678
678
|
return parent.type === types.AST_NODE_TYPES.JSXExpressionContainer && parent.parent.type === types.AST_NODE_TYPES.JSXAttribute && parent.parent.name.type === types.AST_NODE_TYPES.JSXIdentifier && parent.parent.name.name.startsWith("render");
|
|
679
679
|
}
|
|
680
680
|
const jsxCtx = { getScope: (node2) => context.sourceCode.getScope(node2) };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as AST9 from '@eslint-react/ast';
|
|
2
|
+
import { F, isString, O } from '@eslint-react/eff';
|
|
2
3
|
import * as JSX4 from '@eslint-react/jsx';
|
|
3
|
-
import { F, isString, O } from '@eslint-react/tools';
|
|
4
4
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
5
5
|
import ShortUniqueId from 'short-unique-id';
|
|
6
6
|
import { isMatching, P, match } from 'ts-pattern';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.20.2-next.
|
|
3
|
+
"version": "1.20.2-next.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": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"birecord": "^0.1.1",
|
|
43
43
|
"short-unique-id": "^5.2.0",
|
|
44
44
|
"ts-pattern": "^5.6.0",
|
|
45
|
-
"@eslint-react/ast": "1.20.2-next.
|
|
46
|
-
"@eslint-react/jsx": "1.20.2-next.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/types": "1.20.2-next.
|
|
50
|
-
"@eslint-react/var": "1.20.2-next.
|
|
45
|
+
"@eslint-react/ast": "1.20.2-next.3",
|
|
46
|
+
"@eslint-react/jsx": "1.20.2-next.3",
|
|
47
|
+
"@eslint-react/eff": "1.20.2-next.3",
|
|
48
|
+
"@eslint-react/shared": "1.20.2-next.3",
|
|
49
|
+
"@eslint-react/types": "1.20.2-next.3",
|
|
50
|
+
"@eslint-react/var": "1.20.2-next.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"tsup": "^8.3.5",
|