@eslint-react/jsx 1.23.2 → 1.23.3-beta.2
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +101 -51
- package/dist/index.mjs +101 -51
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -82,13 +82,14 @@ declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
|
82
82
|
|
|
83
83
|
declare const JSXValueHint: {
|
|
84
84
|
readonly None: 0n;
|
|
85
|
+
readonly SkipUndefined: bigint;
|
|
85
86
|
readonly SkipNullLiteral: bigint;
|
|
86
|
-
readonly SkipUndefinedLiteral: bigint;
|
|
87
87
|
readonly SkipBooleanLiteral: bigint;
|
|
88
88
|
readonly SkipStringLiteral: bigint;
|
|
89
89
|
readonly SkipNumberLiteral: bigint;
|
|
90
|
-
readonly
|
|
90
|
+
readonly SkipBigIntLiteral: bigint;
|
|
91
91
|
readonly SkipEmptyArray: bigint;
|
|
92
|
+
readonly SkipCreateElement: bigint;
|
|
92
93
|
readonly StrictArray: bigint;
|
|
93
94
|
readonly StrictLogical: bigint;
|
|
94
95
|
readonly StrictConditional: bigint;
|
package/dist/index.d.ts
CHANGED
|
@@ -82,13 +82,14 @@ declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
|
82
82
|
|
|
83
83
|
declare const JSXValueHint: {
|
|
84
84
|
readonly None: 0n;
|
|
85
|
+
readonly SkipUndefined: bigint;
|
|
85
86
|
readonly SkipNullLiteral: bigint;
|
|
86
|
-
readonly SkipUndefinedLiteral: bigint;
|
|
87
87
|
readonly SkipBooleanLiteral: bigint;
|
|
88
88
|
readonly SkipStringLiteral: bigint;
|
|
89
89
|
readonly SkipNumberLiteral: bigint;
|
|
90
|
-
readonly
|
|
90
|
+
readonly SkipBigIntLiteral: bigint;
|
|
91
91
|
readonly SkipEmptyArray: bigint;
|
|
92
|
+
readonly SkipCreateElement: bigint;
|
|
92
93
|
readonly StrictArray: bigint;
|
|
93
94
|
readonly StrictLogical: bigint;
|
|
94
95
|
readonly StrictConditional: bigint;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var AST2 = require('@eslint-react/ast');
|
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
5
|
var types = require('@typescript-eslint/types');
|
|
6
6
|
var VAR = require('@eslint-react/var');
|
|
7
|
-
var tsPattern = require('ts-pattern');
|
|
8
7
|
var types$1 = require('@eslint-react/types');
|
|
9
8
|
|
|
10
9
|
function _interopNamespace(e) {
|
|
@@ -72,8 +71,12 @@ function getProp(props, propName, initialScope) {
|
|
|
72
71
|
function getPropValue(attribute, initialScope) {
|
|
73
72
|
if (attribute.type === types.AST_NODE_TYPES.JSXAttribute && "value" in attribute) {
|
|
74
73
|
const { value } = attribute;
|
|
75
|
-
if (value === null)
|
|
76
|
-
|
|
74
|
+
if (value === null) {
|
|
75
|
+
return eff.O.none();
|
|
76
|
+
}
|
|
77
|
+
if (value.type === types.AST_NODE_TYPES.Literal) {
|
|
78
|
+
return VAR__namespace.getStaticValue(value, initialScope);
|
|
79
|
+
}
|
|
77
80
|
if (value.type === types.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
78
81
|
return VAR__namespace.getStaticValue(value.expression, initialScope);
|
|
79
82
|
}
|
|
@@ -93,7 +96,9 @@ function findPropInProperties(properties, initialScope, seenProps = []) {
|
|
|
93
96
|
switch (true) {
|
|
94
97
|
case prop.argument.type === types.AST_NODE_TYPES.Identifier: {
|
|
95
98
|
const { name } = prop.argument;
|
|
96
|
-
if (seenProps.includes(name))
|
|
99
|
+
if (seenProps.includes(name)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
97
102
|
return eff.F.pipe(
|
|
98
103
|
VAR__namespace.findVariable(name, initialScope),
|
|
99
104
|
eff.O.flatMap(VAR__namespace.getVariableNode(0)),
|
|
@@ -177,65 +182,110 @@ function isUserDefinedElement(node) {
|
|
|
177
182
|
}
|
|
178
183
|
var JSXValueHint = {
|
|
179
184
|
None: 0n,
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
SkipUndefined: 1n << 0n,
|
|
186
|
+
SkipNullLiteral: 1n << 1n,
|
|
182
187
|
SkipBooleanLiteral: 1n << 2n,
|
|
183
188
|
SkipStringLiteral: 1n << 3n,
|
|
184
189
|
SkipNumberLiteral: 1n << 4n,
|
|
185
|
-
|
|
190
|
+
SkipBigIntLiteral: 1n << 5n,
|
|
186
191
|
SkipEmptyArray: 1n << 6n,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
SkipCreateElement: 1n << 7n,
|
|
193
|
+
StrictArray: 1n << 8n,
|
|
194
|
+
StrictLogical: 1n << 9n,
|
|
195
|
+
StrictConditional: 1n << 10n
|
|
190
196
|
};
|
|
191
|
-
var DEFAULT_JSX_VALUE_HINT = 0n | JSXValueHint.
|
|
197
|
+
var DEFAULT_JSX_VALUE_HINT = 0n | JSXValueHint.SkipUndefined | JSXValueHint.SkipBooleanLiteral;
|
|
192
198
|
function isJSXValue(node, jsxCtx, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
switch (node?.type) {
|
|
200
|
+
case types.AST_NODE_TYPES.JSXElement:
|
|
201
|
+
case types.AST_NODE_TYPES.JSXFragment:
|
|
202
|
+
case types.AST_NODE_TYPES.JSXMemberExpression:
|
|
203
|
+
case types.AST_NODE_TYPES.JSXNamespacedName: {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
case types.AST_NODE_TYPES.Literal: {
|
|
207
|
+
switch (typeof node.value) {
|
|
208
|
+
case "boolean":
|
|
209
|
+
return !(hint & JSXValueHint.SkipBooleanLiteral);
|
|
210
|
+
case "string":
|
|
211
|
+
return !(hint & JSXValueHint.SkipStringLiteral);
|
|
212
|
+
case "number":
|
|
213
|
+
return !(hint & JSXValueHint.SkipNumberLiteral);
|
|
214
|
+
case "bigint":
|
|
215
|
+
return !(hint & JSXValueHint.SkipBigIntLiteral);
|
|
216
|
+
}
|
|
217
|
+
if (node.value === null) {
|
|
218
|
+
return !(hint & JSXValueHint.SkipNullLiteral);
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
case types.AST_NODE_TYPES.TemplateLiteral: {
|
|
223
|
+
return !(hint & JSXValueHint.SkipStringLiteral);
|
|
224
|
+
}
|
|
225
|
+
case types.AST_NODE_TYPES.ArrayExpression: {
|
|
226
|
+
if (hint & JSXValueHint.StrictArray) {
|
|
227
|
+
return node.elements.every((n) => isJSXValue(n, jsxCtx, hint));
|
|
228
|
+
}
|
|
229
|
+
return node.elements.some((n) => isJSXValue(n, jsxCtx, hint));
|
|
230
|
+
}
|
|
231
|
+
case types.AST_NODE_TYPES.LogicalExpression: {
|
|
232
|
+
if (hint & JSXValueHint.StrictLogical) {
|
|
233
|
+
return isJSXValue(node.left, jsxCtx, hint) && isJSXValue(node.right, jsxCtx, hint);
|
|
234
|
+
}
|
|
235
|
+
return isJSXValue(node.left, jsxCtx, hint) || isJSXValue(node.right, jsxCtx, hint);
|
|
236
|
+
}
|
|
237
|
+
case types.AST_NODE_TYPES.ConditionalExpression: {
|
|
238
|
+
let leftHasJSX2 = function(node2) {
|
|
239
|
+
if (Array.isArray(node2.consequent)) {
|
|
240
|
+
if (node2.consequent.length === 0) {
|
|
241
|
+
return !(hint & JSXValueHint.SkipEmptyArray);
|
|
242
|
+
}
|
|
243
|
+
if (hint & JSXValueHint.StrictArray) {
|
|
244
|
+
return node2.consequent.every((n) => isJSXValue(n, jsxCtx, hint));
|
|
245
|
+
}
|
|
246
|
+
return node2.consequent.some((n) => isJSXValue(n, jsxCtx, hint));
|
|
205
247
|
}
|
|
206
|
-
return
|
|
248
|
+
return isJSXValue(node2.consequent, jsxCtx, hint);
|
|
249
|
+
}, rightHasJSX2 = function(node2) {
|
|
250
|
+
return isJSXValue(node2.alternate, jsxCtx, hint);
|
|
251
|
+
};
|
|
252
|
+
if (hint & JSXValueHint.StrictConditional) {
|
|
253
|
+
return leftHasJSX2(node) && rightHasJSX2(node);
|
|
207
254
|
}
|
|
208
|
-
return
|
|
255
|
+
return leftHasJSX2(node) || rightHasJSX2(node);
|
|
209
256
|
}
|
|
210
|
-
|
|
211
|
-
|
|
257
|
+
case types.AST_NODE_TYPES.SequenceExpression: {
|
|
258
|
+
const exp = node.expressions.at(-1);
|
|
259
|
+
return isJSXValue(exp, jsxCtx, hint);
|
|
212
260
|
}
|
|
213
|
-
|
|
214
|
-
|
|
261
|
+
case types.AST_NODE_TYPES.CallExpression: {
|
|
262
|
+
if (hint & JSXValueHint.SkipCreateElement) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
switch (node.callee.type) {
|
|
266
|
+
case types.AST_NODE_TYPES.Identifier:
|
|
267
|
+
return node.callee.name === "createElement";
|
|
268
|
+
case types.AST_NODE_TYPES.MemberExpression:
|
|
269
|
+
return node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "createElement";
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
215
272
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
273
|
+
case types.AST_NODE_TYPES.Identifier: {
|
|
274
|
+
const { name } = node;
|
|
275
|
+
if (name === "undefined") {
|
|
276
|
+
return !(hint & JSXValueHint.SkipUndefined);
|
|
277
|
+
}
|
|
278
|
+
if (AST2__namespace.isJSXTagNameExpression(node)) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
return eff.F.pipe(
|
|
282
|
+
VAR__namespace.findVariable(name, jsxCtx.getScope(node)),
|
|
283
|
+
eff.O.flatMap(VAR__namespace.getVariableNode(0)),
|
|
284
|
+
eff.O.exists((n) => isJSXValue(n, jsxCtx, hint))
|
|
285
|
+
);
|
|
220
286
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const exp = node2.expressions.at(-1);
|
|
224
|
-
return isJSXValue(exp, jsxCtx, hint);
|
|
225
|
-
}).with({ type: types.AST_NODE_TYPES.CallExpression }, (node2) => {
|
|
226
|
-
if (hint & JSXValueHint.SkipCreateElement) return false;
|
|
227
|
-
return tsPattern.match(node2.callee).with({ type: types.AST_NODE_TYPES.Identifier, name: "createElement" }, eff.F.constTrue).with({ type: types.AST_NODE_TYPES.MemberExpression, property: { name: "createElement" } }, eff.F.constTrue).otherwise(eff.F.constFalse);
|
|
228
|
-
}).with({ type: types.AST_NODE_TYPES.Identifier }, (node2) => {
|
|
229
|
-
const { name } = node2;
|
|
230
|
-
if (name === "undefined") return !(hint & JSXValueHint.SkipUndefinedLiteral);
|
|
231
|
-
if (AST2__namespace.isJSXTagNameExpression(node2)) return true;
|
|
232
|
-
const initialScope = jsxCtx.getScope(node2);
|
|
233
|
-
return eff.F.pipe(
|
|
234
|
-
VAR__namespace.findVariable(name, initialScope),
|
|
235
|
-
eff.O.flatMap(VAR__namespace.getVariableNode(0)),
|
|
236
|
-
eff.O.exists((n) => isJSXValue(n, jsxCtx, hint))
|
|
237
|
-
);
|
|
238
|
-
}).otherwise(eff.F.constFalse);
|
|
287
|
+
}
|
|
288
|
+
return false;
|
|
239
289
|
}
|
|
240
290
|
var isLiteral = AST2__namespace.isOneOf([types.AST_NODE_TYPES.Literal, types.AST_NODE_TYPES.JSXText]);
|
|
241
291
|
function isWhiteSpace(node) {
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import * as AST2 from '@eslint-react/ast';
|
|
|
2
2
|
import { F, O, isString } from '@eslint-react/eff';
|
|
3
3
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
4
4
|
import * as VAR from '@eslint-react/var';
|
|
5
|
-
import { match, P } from 'ts-pattern';
|
|
6
5
|
import { birecord } from '@eslint-react/types';
|
|
7
6
|
|
|
8
7
|
// src/find-parent-prop.ts
|
|
@@ -49,8 +48,12 @@ function getProp(props, propName, initialScope) {
|
|
|
49
48
|
function getPropValue(attribute, initialScope) {
|
|
50
49
|
if (attribute.type === AST_NODE_TYPES.JSXAttribute && "value" in attribute) {
|
|
51
50
|
const { value } = attribute;
|
|
52
|
-
if (value === null)
|
|
53
|
-
|
|
51
|
+
if (value === null) {
|
|
52
|
+
return O.none();
|
|
53
|
+
}
|
|
54
|
+
if (value.type === AST_NODE_TYPES.Literal) {
|
|
55
|
+
return VAR.getStaticValue(value, initialScope);
|
|
56
|
+
}
|
|
54
57
|
if (value.type === AST_NODE_TYPES.JSXExpressionContainer) {
|
|
55
58
|
return VAR.getStaticValue(value.expression, initialScope);
|
|
56
59
|
}
|
|
@@ -70,7 +73,9 @@ function findPropInProperties(properties, initialScope, seenProps = []) {
|
|
|
70
73
|
switch (true) {
|
|
71
74
|
case prop.argument.type === AST_NODE_TYPES.Identifier: {
|
|
72
75
|
const { name } = prop.argument;
|
|
73
|
-
if (seenProps.includes(name))
|
|
76
|
+
if (seenProps.includes(name)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
74
79
|
return F.pipe(
|
|
75
80
|
VAR.findVariable(name, initialScope),
|
|
76
81
|
O.flatMap(VAR.getVariableNode(0)),
|
|
@@ -154,65 +159,110 @@ function isUserDefinedElement(node) {
|
|
|
154
159
|
}
|
|
155
160
|
var JSXValueHint = {
|
|
156
161
|
None: 0n,
|
|
157
|
-
|
|
158
|
-
|
|
162
|
+
SkipUndefined: 1n << 0n,
|
|
163
|
+
SkipNullLiteral: 1n << 1n,
|
|
159
164
|
SkipBooleanLiteral: 1n << 2n,
|
|
160
165
|
SkipStringLiteral: 1n << 3n,
|
|
161
166
|
SkipNumberLiteral: 1n << 4n,
|
|
162
|
-
|
|
167
|
+
SkipBigIntLiteral: 1n << 5n,
|
|
163
168
|
SkipEmptyArray: 1n << 6n,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
SkipCreateElement: 1n << 7n,
|
|
170
|
+
StrictArray: 1n << 8n,
|
|
171
|
+
StrictLogical: 1n << 9n,
|
|
172
|
+
StrictConditional: 1n << 10n
|
|
167
173
|
};
|
|
168
|
-
var DEFAULT_JSX_VALUE_HINT = 0n | JSXValueHint.
|
|
174
|
+
var DEFAULT_JSX_VALUE_HINT = 0n | JSXValueHint.SkipUndefined | JSXValueHint.SkipBooleanLiteral;
|
|
169
175
|
function isJSXValue(node, jsxCtx, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
switch (node?.type) {
|
|
177
|
+
case AST_NODE_TYPES.JSXElement:
|
|
178
|
+
case AST_NODE_TYPES.JSXFragment:
|
|
179
|
+
case AST_NODE_TYPES.JSXMemberExpression:
|
|
180
|
+
case AST_NODE_TYPES.JSXNamespacedName: {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
case AST_NODE_TYPES.Literal: {
|
|
184
|
+
switch (typeof node.value) {
|
|
185
|
+
case "boolean":
|
|
186
|
+
return !(hint & JSXValueHint.SkipBooleanLiteral);
|
|
187
|
+
case "string":
|
|
188
|
+
return !(hint & JSXValueHint.SkipStringLiteral);
|
|
189
|
+
case "number":
|
|
190
|
+
return !(hint & JSXValueHint.SkipNumberLiteral);
|
|
191
|
+
case "bigint":
|
|
192
|
+
return !(hint & JSXValueHint.SkipBigIntLiteral);
|
|
193
|
+
}
|
|
194
|
+
if (node.value === null) {
|
|
195
|
+
return !(hint & JSXValueHint.SkipNullLiteral);
|
|
196
|
+
}
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
case AST_NODE_TYPES.TemplateLiteral: {
|
|
200
|
+
return !(hint & JSXValueHint.SkipStringLiteral);
|
|
201
|
+
}
|
|
202
|
+
case AST_NODE_TYPES.ArrayExpression: {
|
|
203
|
+
if (hint & JSXValueHint.StrictArray) {
|
|
204
|
+
return node.elements.every((n) => isJSXValue(n, jsxCtx, hint));
|
|
205
|
+
}
|
|
206
|
+
return node.elements.some((n) => isJSXValue(n, jsxCtx, hint));
|
|
207
|
+
}
|
|
208
|
+
case AST_NODE_TYPES.LogicalExpression: {
|
|
209
|
+
if (hint & JSXValueHint.StrictLogical) {
|
|
210
|
+
return isJSXValue(node.left, jsxCtx, hint) && isJSXValue(node.right, jsxCtx, hint);
|
|
211
|
+
}
|
|
212
|
+
return isJSXValue(node.left, jsxCtx, hint) || isJSXValue(node.right, jsxCtx, hint);
|
|
213
|
+
}
|
|
214
|
+
case AST_NODE_TYPES.ConditionalExpression: {
|
|
215
|
+
let leftHasJSX2 = function(node2) {
|
|
216
|
+
if (Array.isArray(node2.consequent)) {
|
|
217
|
+
if (node2.consequent.length === 0) {
|
|
218
|
+
return !(hint & JSXValueHint.SkipEmptyArray);
|
|
219
|
+
}
|
|
220
|
+
if (hint & JSXValueHint.StrictArray) {
|
|
221
|
+
return node2.consequent.every((n) => isJSXValue(n, jsxCtx, hint));
|
|
222
|
+
}
|
|
223
|
+
return node2.consequent.some((n) => isJSXValue(n, jsxCtx, hint));
|
|
182
224
|
}
|
|
183
|
-
return
|
|
225
|
+
return isJSXValue(node2.consequent, jsxCtx, hint);
|
|
226
|
+
}, rightHasJSX2 = function(node2) {
|
|
227
|
+
return isJSXValue(node2.alternate, jsxCtx, hint);
|
|
228
|
+
};
|
|
229
|
+
if (hint & JSXValueHint.StrictConditional) {
|
|
230
|
+
return leftHasJSX2(node) && rightHasJSX2(node);
|
|
184
231
|
}
|
|
185
|
-
return
|
|
232
|
+
return leftHasJSX2(node) || rightHasJSX2(node);
|
|
186
233
|
}
|
|
187
|
-
|
|
188
|
-
|
|
234
|
+
case AST_NODE_TYPES.SequenceExpression: {
|
|
235
|
+
const exp = node.expressions.at(-1);
|
|
236
|
+
return isJSXValue(exp, jsxCtx, hint);
|
|
189
237
|
}
|
|
190
|
-
|
|
191
|
-
|
|
238
|
+
case AST_NODE_TYPES.CallExpression: {
|
|
239
|
+
if (hint & JSXValueHint.SkipCreateElement) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
switch (node.callee.type) {
|
|
243
|
+
case AST_NODE_TYPES.Identifier:
|
|
244
|
+
return node.callee.name === "createElement";
|
|
245
|
+
case AST_NODE_TYPES.MemberExpression:
|
|
246
|
+
return node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "createElement";
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
192
249
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
250
|
+
case AST_NODE_TYPES.Identifier: {
|
|
251
|
+
const { name } = node;
|
|
252
|
+
if (name === "undefined") {
|
|
253
|
+
return !(hint & JSXValueHint.SkipUndefined);
|
|
254
|
+
}
|
|
255
|
+
if (AST2.isJSXTagNameExpression(node)) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
return F.pipe(
|
|
259
|
+
VAR.findVariable(name, jsxCtx.getScope(node)),
|
|
260
|
+
O.flatMap(VAR.getVariableNode(0)),
|
|
261
|
+
O.exists((n) => isJSXValue(n, jsxCtx, hint))
|
|
262
|
+
);
|
|
197
263
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const exp = node2.expressions.at(-1);
|
|
201
|
-
return isJSXValue(exp, jsxCtx, hint);
|
|
202
|
-
}).with({ type: AST_NODE_TYPES.CallExpression }, (node2) => {
|
|
203
|
-
if (hint & JSXValueHint.SkipCreateElement) return false;
|
|
204
|
-
return match(node2.callee).with({ type: AST_NODE_TYPES.Identifier, name: "createElement" }, F.constTrue).with({ type: AST_NODE_TYPES.MemberExpression, property: { name: "createElement" } }, F.constTrue).otherwise(F.constFalse);
|
|
205
|
-
}).with({ type: AST_NODE_TYPES.Identifier }, (node2) => {
|
|
206
|
-
const { name } = node2;
|
|
207
|
-
if (name === "undefined") return !(hint & JSXValueHint.SkipUndefinedLiteral);
|
|
208
|
-
if (AST2.isJSXTagNameExpression(node2)) return true;
|
|
209
|
-
const initialScope = jsxCtx.getScope(node2);
|
|
210
|
-
return F.pipe(
|
|
211
|
-
VAR.findVariable(name, initialScope),
|
|
212
|
-
O.flatMap(VAR.getVariableNode(0)),
|
|
213
|
-
O.exists((n) => isJSXValue(n, jsxCtx, hint))
|
|
214
|
-
);
|
|
215
|
-
}).otherwise(F.constFalse);
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
216
266
|
}
|
|
217
267
|
var isLiteral = AST2.isOneOf([AST_NODE_TYPES.Literal, AST_NODE_TYPES.JSXText]);
|
|
218
268
|
function isWhiteSpace(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "1.23.2",
|
|
3
|
+
"version": "1.23.3-beta.2",
|
|
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": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"author": "Eva1ent<rel1cx@proton.me>",
|
|
16
|
+
"sideEffects": false,
|
|
16
17
|
"exports": {
|
|
17
18
|
".": {
|
|
18
19
|
"import": {
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"./package.json": "./package.json"
|
|
28
29
|
},
|
|
29
30
|
"main": "dist/index.js",
|
|
31
|
+
"module": "dist/index.mjs",
|
|
30
32
|
"types": "dist/index.d.ts",
|
|
31
33
|
"files": [
|
|
32
34
|
"dist",
|
|
@@ -37,10 +39,10 @@
|
|
|
37
39
|
"@typescript-eslint/types": "^8.19.1",
|
|
38
40
|
"@typescript-eslint/utils": "^8.19.1",
|
|
39
41
|
"ts-pattern": "^5.6.0",
|
|
40
|
-
"@eslint-react/ast": "1.23.2",
|
|
41
|
-
"@eslint-react/eff": "1.23.2",
|
|
42
|
-
"@eslint-react/types": "1.23.2",
|
|
43
|
-
"@eslint-react/var": "1.23.2"
|
|
42
|
+
"@eslint-react/ast": "1.23.3-beta.2",
|
|
43
|
+
"@eslint-react/eff": "1.23.3-beta.2",
|
|
44
|
+
"@eslint-react/types": "1.23.3-beta.2",
|
|
45
|
+
"@eslint-react/var": "1.23.3-beta.2"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"tsup": "^8.3.5",
|
|
@@ -50,8 +52,6 @@
|
|
|
50
52
|
"bun": ">=1.0.15",
|
|
51
53
|
"node": ">=18.18.0"
|
|
52
54
|
},
|
|
53
|
-
"sideEffects": false,
|
|
54
|
-
"module": "dist/index.mjs",
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsup",
|
|
57
57
|
"lint:publish": "publint",
|