@eslint-react/jsx 1.17.4-beta.2 → 1.17.4-beta.7

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 CHANGED
@@ -28,11 +28,7 @@ declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadA
28
28
  * @param initialScope The initial scope to start from
29
29
  * @returns The static value of the given JSX attribute
30
30
  */
31
- declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, initialScope: Scope): O.None<{
32
- value: unknown;
33
- } | null> | O.Some<{
34
- value: unknown;
35
- } | null>;
31
+ declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, initialScope: Scope): O.None<unknown> | O.Some<unknown>;
36
32
  /**
37
33
  * @param properties The properties to search in
38
34
  * @param initialScope The initial scope to start from
package/dist/index.d.ts CHANGED
@@ -28,11 +28,7 @@ declare function getProp(props: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadA
28
28
  * @param initialScope The initial scope to start from
29
29
  * @returns The static value of the given JSX attribute
30
30
  */
31
- declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, initialScope: Scope): O.None<{
32
- value: unknown;
33
- } | null> | O.Some<{
34
- value: unknown;
35
- } | null>;
31
+ declare function getPropValue(attribute: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, initialScope: Scope): O.None<unknown> | O.Some<unknown>;
36
32
  /**
37
33
  * @param properties The properties to search in
38
34
  * @param initialScope The initial scope to start from
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ var types = require('@typescript-eslint/types');
4
4
  var tools = require('@eslint-react/tools');
5
5
  var AST = require('@eslint-react/ast');
6
6
  var VAR = require('@eslint-react/var');
7
- var astUtils = require('@typescript-eslint/utils/ast-utils');
8
7
  var tsPattern = require('ts-pattern');
9
8
  var birecord = require('birecord');
10
9
 
@@ -71,14 +70,14 @@ function getPropValue(attribute, initialScope) {
71
70
  if (attribute.type === types.AST_NODE_TYPES.JSXAttribute && "value" in attribute) {
72
71
  const { value } = attribute;
73
72
  if (value === null) return tools.O.none();
74
- if (value.type === types.AST_NODE_TYPES.Literal) return tools.O.some(astUtils.getStaticValue(value, initialScope));
73
+ if (value.type === types.AST_NODE_TYPES.Literal) return VAR__namespace.getStaticValue(value, initialScope);
75
74
  if (value.type === types.AST_NODE_TYPES.JSXExpressionContainer) {
76
- return tools.O.some(astUtils.getStaticValue(value.expression, initialScope));
75
+ return VAR__namespace.getStaticValue(value.expression, initialScope);
77
76
  }
78
77
  return tools.O.none();
79
78
  }
80
79
  const { argument } = attribute;
81
- return tools.O.some(astUtils.getStaticValue(argument, initialScope));
80
+ return VAR__namespace.getStaticValue(argument, initialScope);
82
81
  }
83
82
  function findPropInProperties(properties, initialScope, seenProps = []) {
84
83
  return (propName) => {
@@ -170,7 +169,6 @@ function getElementType(jsxCtx, components, polymorphicPropName) {
170
169
  tools.O.fromNullable(polymorphicPropName),
171
170
  tools.O.flatMap(findPropInAttributes(node.attributes, initialScope)),
172
171
  tools.O.flatMap((attr) => getPropValue(attr, jsxCtx.getScope(attr))),
173
- tools.O.flatMapNullable((v) => v?.value),
174
172
  tools.O.filter(tools.isString),
175
173
  tools.O.getOrElse(() => elementName)
176
174
  );
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types';
2
2
  import { O, isString, F } from '@eslint-react/tools';
3
3
  import * as AST from '@eslint-react/ast';
4
4
  import * as VAR from '@eslint-react/var';
5
- import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
6
5
  import { match, P } from 'ts-pattern';
7
6
  import birecord from 'birecord';
8
7
 
@@ -45,14 +44,14 @@ function getPropValue(attribute, initialScope) {
45
44
  if (attribute.type === AST_NODE_TYPES.JSXAttribute && "value" in attribute) {
46
45
  const { value } = attribute;
47
46
  if (value === null) return O.none();
48
- if (value.type === AST_NODE_TYPES.Literal) return O.some(getStaticValue(value, initialScope));
47
+ if (value.type === AST_NODE_TYPES.Literal) return VAR.getStaticValue(value, initialScope);
49
48
  if (value.type === AST_NODE_TYPES.JSXExpressionContainer) {
50
- return O.some(getStaticValue(value.expression, initialScope));
49
+ return VAR.getStaticValue(value.expression, initialScope);
51
50
  }
52
51
  return O.none();
53
52
  }
54
53
  const { argument } = attribute;
55
- return O.some(getStaticValue(argument, initialScope));
54
+ return VAR.getStaticValue(argument, initialScope);
56
55
  }
57
56
  function findPropInProperties(properties, initialScope, seenProps = []) {
58
57
  return (propName) => {
@@ -144,7 +143,6 @@ function getElementType(jsxCtx, components, polymorphicPropName) {
144
143
  O.fromNullable(polymorphicPropName),
145
144
  O.flatMap(findPropInAttributes(node.attributes, initialScope)),
146
145
  O.flatMap((attr) => getPropValue(attr, jsxCtx.getScope(attr))),
147
- O.flatMapNullable((v) => v?.value),
148
146
  O.filter(isString),
149
147
  O.getOrElse(() => elementName)
150
148
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/jsx",
3
- "version": "1.17.4-beta.2",
3
+ "version": "1.17.4-beta.7",
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": {
@@ -40,10 +40,10 @@
40
40
  "@typescript-eslint/utils": "^8.17.0",
41
41
  "birecord": "^0.1.1",
42
42
  "ts-pattern": "^5.5.0",
43
- "@eslint-react/ast": "1.17.4-beta.2",
44
- "@eslint-react/tools": "1.17.4-beta.2",
45
- "@eslint-react/var": "1.17.4-beta.2",
46
- "@eslint-react/types": "1.17.4-beta.2"
43
+ "@eslint-react/ast": "1.17.4-beta.7",
44
+ "@eslint-react/types": "1.17.4-beta.7",
45
+ "@eslint-react/var": "1.17.4-beta.7",
46
+ "@eslint-react/tools": "1.17.4-beta.7"
47
47
  },
48
48
  "devDependencies": {
49
49
  "tsup": "^8.3.5"