@eslint-react/jsx 1.5.28-next.8 → 1.5.29-next.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.js +4 -4
- package/dist/index.mjs +5 -5
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -326,11 +326,11 @@ function findPropInProperties(properties, context, initialScope, seenProps = [])
|
|
|
326
326
|
const { name } = argument;
|
|
327
327
|
const maybeInit = tools.O.flatMap(
|
|
328
328
|
_var.findVariable(name, initialScope),
|
|
329
|
-
_var.
|
|
329
|
+
_var.getVariableNode(0)
|
|
330
330
|
);
|
|
331
331
|
if (tools.O.isNone(maybeInit)) return false;
|
|
332
332
|
const init = maybeInit.value;
|
|
333
|
-
if (
|
|
333
|
+
if (!ast.is(ast.NodeType.ObjectExpression)(init)) return false;
|
|
334
334
|
if (seenProps.includes(name)) return false;
|
|
335
335
|
return tools.O.isSome(
|
|
336
336
|
findPropInProperties(init.properties, context, initialScope, [...seenProps, name])(propName)
|
|
@@ -356,7 +356,7 @@ function findPropInAttributes(attributes, context, initialScope) {
|
|
|
356
356
|
const { name } = argument;
|
|
357
357
|
const maybeInit = tools.O.flatMap(
|
|
358
358
|
_var.findVariable(name, initialScope),
|
|
359
|
-
_var.
|
|
359
|
+
_var.getVariableNode(0)
|
|
360
360
|
);
|
|
361
361
|
if (tools.O.isNone(maybeInit)) return false;
|
|
362
362
|
const init = maybeInit.value;
|
|
@@ -453,7 +453,7 @@ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
|
453
453
|
const maybeVariable = _var.findVariable(name, initialScope);
|
|
454
454
|
return tools.F.pipe(
|
|
455
455
|
maybeVariable,
|
|
456
|
-
tools.O.flatMap(_var.
|
|
456
|
+
tools.O.flatMap(_var.getVariableNode(0)),
|
|
457
457
|
tools.O.exists((n2) => isJSXValue(n2, context, hint))
|
|
458
458
|
);
|
|
459
459
|
}).otherwise(tools.F.constFalse);
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
2
2
|
import { F, O, Pred } from '@eslint-react/tools';
|
|
3
3
|
import { isOneOf, NodeType, is, isJSXTagNameExpression, isMultiLine, traverseUpGuard } from '@eslint-react/ast';
|
|
4
|
-
import { findVariable,
|
|
4
|
+
import { findVariable, getVariableNode } from '@eslint-react/var';
|
|
5
5
|
import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
|
|
6
6
|
|
|
7
7
|
// src/element-type.ts
|
|
@@ -324,11 +324,11 @@ function findPropInProperties(properties, context, initialScope, seenProps = [])
|
|
|
324
324
|
const { name } = argument;
|
|
325
325
|
const maybeInit = O.flatMap(
|
|
326
326
|
findVariable(name, initialScope),
|
|
327
|
-
|
|
327
|
+
getVariableNode(0)
|
|
328
328
|
);
|
|
329
329
|
if (O.isNone(maybeInit)) return false;
|
|
330
330
|
const init = maybeInit.value;
|
|
331
|
-
if (
|
|
331
|
+
if (!is(NodeType.ObjectExpression)(init)) return false;
|
|
332
332
|
if (seenProps.includes(name)) return false;
|
|
333
333
|
return O.isSome(
|
|
334
334
|
findPropInProperties(init.properties, context, initialScope, [...seenProps, name])(propName)
|
|
@@ -354,7 +354,7 @@ function findPropInAttributes(attributes, context, initialScope) {
|
|
|
354
354
|
const { name } = argument;
|
|
355
355
|
const maybeInit = O.flatMap(
|
|
356
356
|
findVariable(name, initialScope),
|
|
357
|
-
|
|
357
|
+
getVariableNode(0)
|
|
358
358
|
);
|
|
359
359
|
if (O.isNone(maybeInit)) return false;
|
|
360
360
|
const init = maybeInit.value;
|
|
@@ -451,7 +451,7 @@ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
|
451
451
|
const maybeVariable = findVariable(name, initialScope);
|
|
452
452
|
return F.pipe(
|
|
453
453
|
maybeVariable,
|
|
454
|
-
O.flatMap(
|
|
454
|
+
O.flatMap(getVariableNode(0)),
|
|
455
455
|
O.exists((n2) => isJSXValue(n2, context, hint))
|
|
456
456
|
);
|
|
457
457
|
}).otherwise(F.constFalse);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.29-next.0",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module for static analysis of JSX.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"@typescript-eslint/scope-manager": "^7.16.1",
|
|
39
39
|
"@typescript-eslint/types": "^7.16.1",
|
|
40
40
|
"@typescript-eslint/utils": "^7.16.1",
|
|
41
|
-
"@eslint-react/ast": "1.5.
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/var": "1.5.
|
|
44
|
-
"@eslint-react/
|
|
41
|
+
"@eslint-react/ast": "1.5.29-next.0",
|
|
42
|
+
"@eslint-react/tools": "1.5.29-next.0",
|
|
43
|
+
"@eslint-react/var": "1.5.29-next.0",
|
|
44
|
+
"@eslint-react/types": "1.5.29-next.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"ts-pattern": "5.2.0",
|
|
48
|
-
"tsup": "8.2.
|
|
48
|
+
"tsup": "8.2.1"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup",
|