@eslint-react/jsx 1.17.4-next.8 → 1.17.4-next.9

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
@@ -1,6 +1,6 @@
1
1
  import { TSESTree } from '@typescript-eslint/types';
2
- import { Scope } from '@typescript-eslint/scope-manager';
3
2
  import { O } from '@eslint-react/tools';
3
+ import { Scope } from '@typescript-eslint/scope-manager';
4
4
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
5
5
  import * as birecord from 'birecord';
6
6
 
@@ -11,10 +11,6 @@ import * as birecord from 'birecord';
11
11
  */
12
12
  declare function getElementName(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
13
13
 
14
- declare function getElementType(jsxCtx: {
15
- getScope: (node: TSESTree.Node) => Scope;
16
- }, components?: Map<string, string>, polymorphicPropName?: string): (node: TSESTree.JSXOpeningElement) => string;
17
-
18
14
  /**
19
15
  * Get the name of a JSX attribute with namespace
20
16
  * @param node The JSX attribute node
@@ -404,4 +400,4 @@ declare const xhtmlEntities: birecord.BiRecord<{
404
400
  readonly zwnj: "‌";
405
401
  }>;
406
402
 
407
- export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findPropInAttributes, findPropInProperties, getElementName, getElementType, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp, unescapeStringLiteralText, xhtmlEntities };
403
+ export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findPropInAttributes, findPropInProperties, getElementName, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp, unescapeStringLiteralText, xhtmlEntities };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TSESTree } from '@typescript-eslint/types';
2
- import { Scope } from '@typescript-eslint/scope-manager';
3
2
  import { O } from '@eslint-react/tools';
3
+ import { Scope } from '@typescript-eslint/scope-manager';
4
4
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
5
5
  import * as birecord from 'birecord';
6
6
 
@@ -11,10 +11,6 @@ import * as birecord from 'birecord';
11
11
  */
12
12
  declare function getElementName(node: TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment): string;
13
13
 
14
- declare function getElementType(jsxCtx: {
15
- getScope: (node: TSESTree.Node) => Scope;
16
- }, components?: Map<string, string>, polymorphicPropName?: string): (node: TSESTree.JSXOpeningElement) => string;
17
-
18
14
  /**
19
15
  * Get the name of a JSX attribute with namespace
20
16
  * @param node The JSX attribute node
@@ -404,4 +400,4 @@ declare const xhtmlEntities: birecord.BiRecord<{
404
400
  readonly zwnj: "‌";
405
401
  }>;
406
402
 
407
- export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findPropInAttributes, findPropInProperties, getElementName, getElementType, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp, unescapeStringLiteralText, xhtmlEntities };
403
+ export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findPropInAttributes, findPropInProperties, getElementName, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp, unescapeStringLiteralText, xhtmlEntities };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var types = require('@typescript-eslint/types');
4
- var tools = require('@eslint-react/tools');
5
4
  var AST = require('@eslint-react/ast');
5
+ var tools = require('@eslint-react/tools');
6
6
  var VAR = require('@eslint-react/var');
7
7
  var tsPattern = require('ts-pattern');
8
8
  var birecord = require('birecord');
@@ -156,24 +156,6 @@ function findPropInAttributes(attributes, initialScope) {
156
156
  );
157
157
  };
158
158
  }
159
-
160
- // src/get-element-type.ts
161
- function getElementType(jsxCtx, components, polymorphicPropName) {
162
- return (node) => {
163
- const elementName = getElementName(node);
164
- if (elementName === elementName.toLowerCase()) return elementName;
165
- const asElementName = components?.get(elementName);
166
- if (tools.isString(asElementName)) return asElementName;
167
- const initialScope = jsxCtx.getScope(node);
168
- return tools.F.pipe(
169
- tools.O.fromNullable(polymorphicPropName),
170
- tools.O.flatMap(findPropInAttributes(node.attributes, initialScope)),
171
- tools.O.flatMap((attr) => getPropValue(attr, jsxCtx.getScope(attr))),
172
- tools.O.filter(tools.isString),
173
- tools.O.getOrElse(() => elementName)
174
- );
175
- };
176
- }
177
159
  function hasProp(attributes, propName, initialScope) {
178
160
  return tools.O.isSome(findPropInAttributes(attributes, initialScope)(propName));
179
161
  }
@@ -543,7 +525,6 @@ exports.JSXValueHint = JSXValueHint;
543
525
  exports.findPropInAttributes = findPropInAttributes;
544
526
  exports.findPropInProperties = findPropInProperties;
545
527
  exports.getElementName = getElementName;
546
- exports.getElementType = getElementType;
547
528
  exports.getProp = getProp;
548
529
  exports.getPropName = getPropName;
549
530
  exports.getPropValue = getPropValue;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
2
- import { O, isString, F } from '@eslint-react/tools';
3
2
  import * as AST from '@eslint-react/ast';
3
+ import { O, F, isString } from '@eslint-react/tools';
4
4
  import * as VAR from '@eslint-react/var';
5
5
  import { match, P } from 'ts-pattern';
6
6
  import birecord from 'birecord';
@@ -130,24 +130,6 @@ function findPropInAttributes(attributes, initialScope) {
130
130
  );
131
131
  };
132
132
  }
133
-
134
- // src/get-element-type.ts
135
- function getElementType(jsxCtx, components, polymorphicPropName) {
136
- return (node) => {
137
- const elementName = getElementName(node);
138
- if (elementName === elementName.toLowerCase()) return elementName;
139
- const asElementName = components?.get(elementName);
140
- if (isString(asElementName)) return asElementName;
141
- const initialScope = jsxCtx.getScope(node);
142
- return F.pipe(
143
- O.fromNullable(polymorphicPropName),
144
- O.flatMap(findPropInAttributes(node.attributes, initialScope)),
145
- O.flatMap((attr) => getPropValue(attr, jsxCtx.getScope(attr))),
146
- O.filter(isString),
147
- O.getOrElse(() => elementName)
148
- );
149
- };
150
- }
151
133
  function hasProp(attributes, propName, initialScope) {
152
134
  return O.isSome(findPropInAttributes(attributes, initialScope)(propName));
153
135
  }
@@ -512,4 +494,4 @@ function unescapeStringLiteralText(text) {
512
494
  });
513
495
  }
514
496
 
515
- export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findPropInAttributes, findPropInProperties, getElementName, getElementType, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp, unescapeStringLiteralText, xhtmlEntities };
497
+ export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findPropInAttributes, findPropInProperties, getElementName, getProp, getPropName, getPropValue, hasAnyProp, hasEveryProp, hasProp, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, traverseUpProp, unescapeStringLiteralText, xhtmlEntities };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/jsx",
3
- "version": "1.17.4-next.8",
3
+ "version": "1.17.4-next.9",
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-next.8",
44
- "@eslint-react/types": "1.17.4-next.8",
45
- "@eslint-react/tools": "1.17.4-next.8",
46
- "@eslint-react/var": "1.17.4-next.8"
43
+ "@eslint-react/ast": "1.17.4-next.9",
44
+ "@eslint-react/tools": "1.17.4-next.9",
45
+ "@eslint-react/var": "1.17.4-next.9",
46
+ "@eslint-react/types": "1.17.4-next.9"
47
47
  },
48
48
  "devDependencies": {
49
49
  "tsup": "^8.3.5"