@eslint-react/jsx 1.24.0-next.12 → 1.24.0-next.14
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 +34 -43
- package/dist/index.d.ts +34 -43
- package/dist/index.js +18 -287
- package/dist/index.mjs +19 -286
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
-
import { TSESTree as TSESTree$1 } from '@typescript-eslint/types';
|
|
3
1
|
import { _ } from '@eslint-react/eff';
|
|
2
|
+
import { TSESTree } from '@typescript-eslint/types';
|
|
4
3
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
4
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
5
5
|
import * as VAR from '@eslint-react/var';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Get the stringified name of a JSX attribute
|
|
9
|
-
* @param node The JSX attribute node
|
|
10
|
-
* @returns The name of the attribute
|
|
11
|
-
*/
|
|
12
|
-
declare function getAttributeName(node: TSESTree.JSXAttribute): string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Get the stringified name of a JSX element
|
|
16
|
-
* @param node The JSX element node
|
|
17
|
-
* @returns The name of the element
|
|
18
|
-
*/
|
|
19
|
-
declare function getElementName(node: TSESTree$1.JSXElement | TSESTree$1.JSXFragment): string;
|
|
20
|
-
|
|
21
7
|
/**
|
|
22
8
|
* Find the parent JSX attribute node of a node
|
|
23
9
|
* @param node The node to find the parent attribute of
|
|
24
10
|
* @param test The test to apply to the parent attribute
|
|
25
11
|
* @returns The parent attribute node or undefined
|
|
26
12
|
*/
|
|
27
|
-
declare function findParentAttribute(node: TSESTree
|
|
13
|
+
declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | _;
|
|
28
14
|
|
|
29
15
|
/**
|
|
30
16
|
* Get the JSX attribute node with the given name
|
|
@@ -33,36 +19,50 @@ declare function findParentAttribute(node: TSESTree$1.Node, test?: (node: TSESTr
|
|
|
33
19
|
* @param attributes The attributes to search
|
|
34
20
|
* @returns The JSX attribute node or undefined
|
|
35
21
|
*/
|
|
36
|
-
declare function getAttribute(name: string, initialScope: Scope, attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[]): TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | _;
|
|
22
|
+
declare function getAttribute(name: string, initialScope: Scope, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[]): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | _;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get the stringified name of a JSX attribute
|
|
26
|
+
* @param node The JSX attribute node
|
|
27
|
+
* @returns The name of the attribute
|
|
28
|
+
*/
|
|
29
|
+
declare function getAttributeName(node: TSESTree$1.JSXAttribute): string;
|
|
37
30
|
|
|
38
31
|
/**
|
|
39
32
|
* Get a StaticValue of the attribute value
|
|
40
|
-
* @param name The name of the attribute
|
|
41
33
|
* @param node The JSX attribute node
|
|
34
|
+
* @param name The name of the attribute
|
|
42
35
|
* @param initialScope The initial scope to use
|
|
43
36
|
* @returns The StaticValue of the attribute value
|
|
44
37
|
*/
|
|
45
|
-
declare function getAttributeValue(
|
|
38
|
+
declare function getAttributeValue(node: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, name: string, initialScope: Scope): Exclude<VAR.LazyValue, {
|
|
46
39
|
kind: "lazy";
|
|
47
40
|
}>;
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Get the stringified name of a JSX element
|
|
44
|
+
* @param node The JSX element node
|
|
45
|
+
* @returns The name of the element
|
|
46
|
+
*/
|
|
47
|
+
declare function getElementName(node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
|
|
52
48
|
|
|
53
|
-
declare function
|
|
49
|
+
declare function hasAttribute(name: string, initialScope: Scope, attributes: TSESTree.JSXOpeningElement["attributes"]): boolean;
|
|
50
|
+
declare function hasAnyAttribute(names: string[], initialScope: Scope, attributes: TSESTree.JSXOpeningElement["attributes"]): boolean;
|
|
51
|
+
declare function hasEveryAttribute(names: string[], initialScope: Scope, attributes: TSESTree.JSXOpeningElement["attributes"]): boolean;
|
|
52
|
+
|
|
53
|
+
declare function isKeyedElement(node: TSESTree.Node, initialScope: Scope): boolean;
|
|
54
54
|
/**
|
|
55
55
|
* Check if a node is a `JSXFragment` of `Built-in Component` type
|
|
56
56
|
* @param node The AST node to check
|
|
57
57
|
* @returns `true` if the node is a `JSXFragment` of `Built-in Component` type
|
|
58
58
|
*/
|
|
59
|
-
declare function isBuiltInElement(node: TSESTree
|
|
59
|
+
declare function isBuiltInElement(node: TSESTree.Node): boolean;
|
|
60
60
|
/**
|
|
61
61
|
* Check if a node is a `JSXElement` of `User-Defined Component` type
|
|
62
62
|
* @param node The AST node to check
|
|
63
63
|
* @returns `true` if the node is a `JSXElement` of `User-Defined Component` type
|
|
64
64
|
*/
|
|
65
|
-
declare function isUserDefinedElement(node: TSESTree
|
|
65
|
+
declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
66
66
|
|
|
67
67
|
declare const JSXValueHint: {
|
|
68
68
|
readonly None: 0n;
|
|
@@ -87,8 +87,8 @@ declare const DEFAULT_JSX_VALUE_HINT: bigint;
|
|
|
87
87
|
* @param hint The `JSXValueHint` to use
|
|
88
88
|
* @returns boolean
|
|
89
89
|
*/
|
|
90
|
-
declare function isJSXValue(node: TSESTree.Node | _ | null, jsxCtx: {
|
|
91
|
-
getScope: (node: TSESTree.Node) => Scope;
|
|
90
|
+
declare function isJSXValue(node: TSESTree$1.Node | _ | null, jsxCtx: {
|
|
91
|
+
getScope: (node: TSESTree$1.Node) => Scope;
|
|
92
92
|
}, hint?: bigint): boolean;
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -96,40 +96,31 @@ declare function isJSXValue(node: TSESTree.Node | _ | null, jsxCtx: {
|
|
|
96
96
|
* @param node The AST node to check
|
|
97
97
|
* @returns boolean `true` if the node is a Literal or JSXText
|
|
98
98
|
*/
|
|
99
|
-
declare const isLiteral: (node: TSESTree
|
|
99
|
+
declare const isLiteral: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXText | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
|
|
100
100
|
/**
|
|
101
101
|
* Check if a Literal or JSXText node is whitespace
|
|
102
102
|
* @param node The AST node to check
|
|
103
103
|
* @returns boolean `true` if the node is whitespace
|
|
104
104
|
*/
|
|
105
|
-
declare function isWhiteSpace(node: TSESTree
|
|
105
|
+
declare function isWhiteSpace(node: TSESTree.JSXText | TSESTree.Literal): boolean;
|
|
106
106
|
/**
|
|
107
107
|
* Check if a Literal or JSXText node is a line break
|
|
108
108
|
* @param node The AST node to check
|
|
109
109
|
* @returns boolean
|
|
110
110
|
*/
|
|
111
|
-
declare function isLineBreak(node: TSESTree
|
|
111
|
+
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
112
112
|
/**
|
|
113
113
|
* Check if a Literal or JSXText node is padding spaces
|
|
114
114
|
* @param node The AST node to check
|
|
115
115
|
* @returns boolean
|
|
116
116
|
*/
|
|
117
|
-
declare function isPaddingSpaces(node: TSESTree
|
|
117
|
+
declare function isPaddingSpaces(node: TSESTree.Node): boolean;
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Get the stringified representation of a JSX node
|
|
121
121
|
* @param node The JSX node
|
|
122
122
|
* @returns The stringified representation
|
|
123
123
|
*/
|
|
124
|
-
declare function toString(node: TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName | TSESTree.JSXOpeningElement | TSESTree.JSXClosingElement | TSESTree.JSXOpeningFragment | TSESTree.JSXClosingFragment | TSESTree.JSXText): string;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Unescape the text content of string literals, e.g. & -> &
|
|
128
|
-
* @param text The escaped string literal text.
|
|
129
|
-
* @returns The unescaped string literal text.
|
|
130
|
-
*/
|
|
131
|
-
declare function unescapeStringLiteralText(text: string): string;
|
|
132
|
-
|
|
133
|
-
declare const xhtmlEntities: Record<string, string>;
|
|
124
|
+
declare function toString(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
|
|
134
125
|
|
|
135
|
-
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementName, hasAnyAttribute, hasAttribute, hasEveryAttribute, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, toString
|
|
126
|
+
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementName, hasAnyAttribute, hasAttribute, hasEveryAttribute, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, toString };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
-
import { TSESTree as TSESTree$1 } from '@typescript-eslint/types';
|
|
3
1
|
import { _ } from '@eslint-react/eff';
|
|
2
|
+
import { TSESTree } from '@typescript-eslint/types';
|
|
4
3
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
4
|
+
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
5
5
|
import * as VAR from '@eslint-react/var';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Get the stringified name of a JSX attribute
|
|
9
|
-
* @param node The JSX attribute node
|
|
10
|
-
* @returns The name of the attribute
|
|
11
|
-
*/
|
|
12
|
-
declare function getAttributeName(node: TSESTree.JSXAttribute): string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Get the stringified name of a JSX element
|
|
16
|
-
* @param node The JSX element node
|
|
17
|
-
* @returns The name of the element
|
|
18
|
-
*/
|
|
19
|
-
declare function getElementName(node: TSESTree$1.JSXElement | TSESTree$1.JSXFragment): string;
|
|
20
|
-
|
|
21
7
|
/**
|
|
22
8
|
* Find the parent JSX attribute node of a node
|
|
23
9
|
* @param node The node to find the parent attribute of
|
|
24
10
|
* @param test The test to apply to the parent attribute
|
|
25
11
|
* @returns The parent attribute node or undefined
|
|
26
12
|
*/
|
|
27
|
-
declare function findParentAttribute(node: TSESTree
|
|
13
|
+
declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | _;
|
|
28
14
|
|
|
29
15
|
/**
|
|
30
16
|
* Get the JSX attribute node with the given name
|
|
@@ -33,36 +19,50 @@ declare function findParentAttribute(node: TSESTree$1.Node, test?: (node: TSESTr
|
|
|
33
19
|
* @param attributes The attributes to search
|
|
34
20
|
* @returns The JSX attribute node or undefined
|
|
35
21
|
*/
|
|
36
|
-
declare function getAttribute(name: string, initialScope: Scope, attributes: (TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute)[]): TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | _;
|
|
22
|
+
declare function getAttribute(name: string, initialScope: Scope, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[]): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | _;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get the stringified name of a JSX attribute
|
|
26
|
+
* @param node The JSX attribute node
|
|
27
|
+
* @returns The name of the attribute
|
|
28
|
+
*/
|
|
29
|
+
declare function getAttributeName(node: TSESTree$1.JSXAttribute): string;
|
|
37
30
|
|
|
38
31
|
/**
|
|
39
32
|
* Get a StaticValue of the attribute value
|
|
40
|
-
* @param name The name of the attribute
|
|
41
33
|
* @param node The JSX attribute node
|
|
34
|
+
* @param name The name of the attribute
|
|
42
35
|
* @param initialScope The initial scope to use
|
|
43
36
|
* @returns The StaticValue of the attribute value
|
|
44
37
|
*/
|
|
45
|
-
declare function getAttributeValue(
|
|
38
|
+
declare function getAttributeValue(node: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, name: string, initialScope: Scope): Exclude<VAR.LazyValue, {
|
|
46
39
|
kind: "lazy";
|
|
47
40
|
}>;
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Get the stringified name of a JSX element
|
|
44
|
+
* @param node The JSX element node
|
|
45
|
+
* @returns The name of the element
|
|
46
|
+
*/
|
|
47
|
+
declare function getElementName(node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
|
|
52
48
|
|
|
53
|
-
declare function
|
|
49
|
+
declare function hasAttribute(name: string, initialScope: Scope, attributes: TSESTree.JSXOpeningElement["attributes"]): boolean;
|
|
50
|
+
declare function hasAnyAttribute(names: string[], initialScope: Scope, attributes: TSESTree.JSXOpeningElement["attributes"]): boolean;
|
|
51
|
+
declare function hasEveryAttribute(names: string[], initialScope: Scope, attributes: TSESTree.JSXOpeningElement["attributes"]): boolean;
|
|
52
|
+
|
|
53
|
+
declare function isKeyedElement(node: TSESTree.Node, initialScope: Scope): boolean;
|
|
54
54
|
/**
|
|
55
55
|
* Check if a node is a `JSXFragment` of `Built-in Component` type
|
|
56
56
|
* @param node The AST node to check
|
|
57
57
|
* @returns `true` if the node is a `JSXFragment` of `Built-in Component` type
|
|
58
58
|
*/
|
|
59
|
-
declare function isBuiltInElement(node: TSESTree
|
|
59
|
+
declare function isBuiltInElement(node: TSESTree.Node): boolean;
|
|
60
60
|
/**
|
|
61
61
|
* Check if a node is a `JSXElement` of `User-Defined Component` type
|
|
62
62
|
* @param node The AST node to check
|
|
63
63
|
* @returns `true` if the node is a `JSXElement` of `User-Defined Component` type
|
|
64
64
|
*/
|
|
65
|
-
declare function isUserDefinedElement(node: TSESTree
|
|
65
|
+
declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
66
66
|
|
|
67
67
|
declare const JSXValueHint: {
|
|
68
68
|
readonly None: 0n;
|
|
@@ -87,8 +87,8 @@ declare const DEFAULT_JSX_VALUE_HINT: bigint;
|
|
|
87
87
|
* @param hint The `JSXValueHint` to use
|
|
88
88
|
* @returns boolean
|
|
89
89
|
*/
|
|
90
|
-
declare function isJSXValue(node: TSESTree.Node | _ | null, jsxCtx: {
|
|
91
|
-
getScope: (node: TSESTree.Node) => Scope;
|
|
90
|
+
declare function isJSXValue(node: TSESTree$1.Node | _ | null, jsxCtx: {
|
|
91
|
+
getScope: (node: TSESTree$1.Node) => Scope;
|
|
92
92
|
}, hint?: bigint): boolean;
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -96,40 +96,31 @@ declare function isJSXValue(node: TSESTree.Node | _ | null, jsxCtx: {
|
|
|
96
96
|
* @param node The AST node to check
|
|
97
97
|
* @returns boolean `true` if the node is a Literal or JSXText
|
|
98
98
|
*/
|
|
99
|
-
declare const isLiteral: (node: TSESTree
|
|
99
|
+
declare const isLiteral: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXText | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
|
|
100
100
|
/**
|
|
101
101
|
* Check if a Literal or JSXText node is whitespace
|
|
102
102
|
* @param node The AST node to check
|
|
103
103
|
* @returns boolean `true` if the node is whitespace
|
|
104
104
|
*/
|
|
105
|
-
declare function isWhiteSpace(node: TSESTree
|
|
105
|
+
declare function isWhiteSpace(node: TSESTree.JSXText | TSESTree.Literal): boolean;
|
|
106
106
|
/**
|
|
107
107
|
* Check if a Literal or JSXText node is a line break
|
|
108
108
|
* @param node The AST node to check
|
|
109
109
|
* @returns boolean
|
|
110
110
|
*/
|
|
111
|
-
declare function isLineBreak(node: TSESTree
|
|
111
|
+
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
112
112
|
/**
|
|
113
113
|
* Check if a Literal or JSXText node is padding spaces
|
|
114
114
|
* @param node The AST node to check
|
|
115
115
|
* @returns boolean
|
|
116
116
|
*/
|
|
117
|
-
declare function isPaddingSpaces(node: TSESTree
|
|
117
|
+
declare function isPaddingSpaces(node: TSESTree.Node): boolean;
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Get the stringified representation of a JSX node
|
|
121
121
|
* @param node The JSX node
|
|
122
122
|
* @returns The stringified representation
|
|
123
123
|
*/
|
|
124
|
-
declare function toString(node: TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName | TSESTree.JSXOpeningElement | TSESTree.JSXClosingElement | TSESTree.JSXOpeningFragment | TSESTree.JSXClosingFragment | TSESTree.JSXText): string;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Unescape the text content of string literals, e.g. & -> &
|
|
128
|
-
* @param text The escaped string literal text.
|
|
129
|
-
* @returns The unescaped string literal text.
|
|
130
|
-
*/
|
|
131
|
-
declare function unescapeStringLiteralText(text: string): string;
|
|
132
|
-
|
|
133
|
-
declare const xhtmlEntities: Record<string, string>;
|
|
124
|
+
declare function toString(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
|
|
134
125
|
|
|
135
|
-
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementName, hasAnyAttribute, hasAttribute, hasEveryAttribute, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, toString
|
|
126
|
+
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementName, hasAnyAttribute, hasAttribute, hasEveryAttribute, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, toString };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var types = require('@typescript-eslint/types');
|
|
4
3
|
var AST3 = require('@eslint-react/ast');
|
|
5
4
|
var eff = require('@eslint-react/eff');
|
|
5
|
+
var types = require('@typescript-eslint/types');
|
|
6
6
|
var VAR = require('@eslint-react/var');
|
|
7
7
|
var tsPattern = require('ts-pattern');
|
|
8
8
|
|
|
@@ -27,7 +27,13 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var AST3__namespace = /*#__PURE__*/_interopNamespace(AST3);
|
|
28
28
|
var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
|
|
29
29
|
|
|
30
|
-
// src/
|
|
30
|
+
// src/find-parent-attribute.ts
|
|
31
|
+
function findParentAttribute(node, test = eff.returnTrue) {
|
|
32
|
+
const guard = (node2) => {
|
|
33
|
+
return node2.type === types.AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
34
|
+
};
|
|
35
|
+
return AST3__namespace.findParentNode(node, guard);
|
|
36
|
+
}
|
|
31
37
|
function toString(node) {
|
|
32
38
|
switch (node.type) {
|
|
33
39
|
case types.AST_NODE_TYPES.JSXIdentifier:
|
|
@@ -49,22 +55,12 @@ function toString(node) {
|
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
// src/attribute-name.ts
|
|
58
|
+
// src/get-attribute-name.ts
|
|
53
59
|
function getAttributeName(node) {
|
|
54
60
|
return toString(node.name);
|
|
55
61
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return "";
|
|
59
|
-
}
|
|
60
|
-
return toString(node.openingElement.name);
|
|
61
|
-
}
|
|
62
|
-
function findParentAttribute(node, test = eff.returnTrue) {
|
|
63
|
-
const guard = (node2) => {
|
|
64
|
-
return node2.type === types.AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
65
|
-
};
|
|
66
|
-
return AST3__namespace.findParentNode(node, guard);
|
|
67
|
-
}
|
|
62
|
+
|
|
63
|
+
// src/get-attribute.ts
|
|
68
64
|
function getAttribute(name, initialScope, attributes) {
|
|
69
65
|
return attributes.findLast((attr) => {
|
|
70
66
|
if (attr.type === types.AST_NODE_TYPES.JSXAttribute) {
|
|
@@ -85,7 +81,7 @@ function getAttribute(name, initialScope, attributes) {
|
|
|
85
81
|
return false;
|
|
86
82
|
});
|
|
87
83
|
}
|
|
88
|
-
function getAttributeValue(
|
|
84
|
+
function getAttributeValue(node, name, initialScope) {
|
|
89
85
|
switch (node.type) {
|
|
90
86
|
case types.AST_NODE_TYPES.JSXAttribute:
|
|
91
87
|
if (node.value?.type === types.AST_NODE_TYPES.Literal) {
|
|
@@ -124,6 +120,12 @@ function getAttributeValue(name, node, initialScope) {
|
|
|
124
120
|
return { kind: "none", node, initialScope };
|
|
125
121
|
}
|
|
126
122
|
}
|
|
123
|
+
function getElementName(node) {
|
|
124
|
+
if (node.type === types.AST_NODE_TYPES.JSXFragment) {
|
|
125
|
+
return "";
|
|
126
|
+
}
|
|
127
|
+
return toString(node.openingElement.name);
|
|
128
|
+
}
|
|
127
129
|
|
|
128
130
|
// src/has-attribute.ts
|
|
129
131
|
function hasAttribute(name, initialScope, attributes) {
|
|
@@ -260,275 +262,6 @@ function isPaddingSpaces(node) {
|
|
|
260
262
|
return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
|
|
261
263
|
}
|
|
262
264
|
|
|
263
|
-
// src/xhtml-entities.ts
|
|
264
|
-
var xhtmlEntities = {
|
|
265
|
-
Aacute: "\xC1",
|
|
266
|
-
aacute: "\xE1",
|
|
267
|
-
Acirc: "\xC2",
|
|
268
|
-
acirc: "\xE2",
|
|
269
|
-
acute: "\xB4",
|
|
270
|
-
AElig: "\xC6",
|
|
271
|
-
aelig: "\xE6",
|
|
272
|
-
Agrave: "\xC0",
|
|
273
|
-
agrave: "\xE0",
|
|
274
|
-
alefsym: "\u2135",
|
|
275
|
-
Alpha: "\u0391",
|
|
276
|
-
alpha: "\u03B1",
|
|
277
|
-
amp: "&",
|
|
278
|
-
and: "\u2227",
|
|
279
|
-
ang: "\u2220",
|
|
280
|
-
apos: "'",
|
|
281
|
-
Aring: "\xC5",
|
|
282
|
-
aring: "\xE5",
|
|
283
|
-
asymp: "\u2248",
|
|
284
|
-
Atilde: "\xC3",
|
|
285
|
-
atilde: "\xE3",
|
|
286
|
-
Auml: "\xC4",
|
|
287
|
-
auml: "\xE4",
|
|
288
|
-
bdquo: "\u201E",
|
|
289
|
-
Beta: "\u0392",
|
|
290
|
-
beta: "\u03B2",
|
|
291
|
-
brvbar: "\xA6",
|
|
292
|
-
bull: "\u2022",
|
|
293
|
-
cap: "\u2229",
|
|
294
|
-
Ccedil: "\xC7",
|
|
295
|
-
ccedil: "\xE7",
|
|
296
|
-
cedil: "\xB8",
|
|
297
|
-
cent: "\xA2",
|
|
298
|
-
Chi: "\u03A7",
|
|
299
|
-
chi: "\u03C7",
|
|
300
|
-
circ: "\u02C6",
|
|
301
|
-
clubs: "\u2663",
|
|
302
|
-
cong: "\u2245",
|
|
303
|
-
copy: "\xA9",
|
|
304
|
-
crarr: "\u21B5",
|
|
305
|
-
cup: "\u222A",
|
|
306
|
-
curren: "\xA4",
|
|
307
|
-
dagger: "\u2020",
|
|
308
|
-
Dagger: "\u2021",
|
|
309
|
-
darr: "\u2193",
|
|
310
|
-
dArr: "\u21D3",
|
|
311
|
-
deg: "\xB0",
|
|
312
|
-
Delta: "\u0394",
|
|
313
|
-
delta: "\u03B4",
|
|
314
|
-
diams: "\u2666",
|
|
315
|
-
divide: "\xF7",
|
|
316
|
-
Eacute: "\xC9",
|
|
317
|
-
eacute: "\xE9",
|
|
318
|
-
Ecirc: "\xCA",
|
|
319
|
-
ecirc: "\xEA",
|
|
320
|
-
Egrave: "\xC8",
|
|
321
|
-
egrave: "\xE8",
|
|
322
|
-
empty: "\u2205",
|
|
323
|
-
emsp: "\u2003",
|
|
324
|
-
ensp: "\u2002",
|
|
325
|
-
Epsilon: "\u0395",
|
|
326
|
-
epsilon: "\u03B5",
|
|
327
|
-
equiv: "\u2261",
|
|
328
|
-
Eta: "\u0397",
|
|
329
|
-
eta: "\u03B7",
|
|
330
|
-
ETH: "\xD0",
|
|
331
|
-
eth: "\xF0",
|
|
332
|
-
Euml: "\xCB",
|
|
333
|
-
euml: "\xEB",
|
|
334
|
-
euro: "\u20AC",
|
|
335
|
-
exist: "\u2203",
|
|
336
|
-
fnof: "\u0192",
|
|
337
|
-
forall: "\u2200",
|
|
338
|
-
frac12: "\xBD",
|
|
339
|
-
frac14: "\xBC",
|
|
340
|
-
frac34: "\xBE",
|
|
341
|
-
frasl: "\u2044",
|
|
342
|
-
Gamma: "\u0393",
|
|
343
|
-
gamma: "\u03B3",
|
|
344
|
-
ge: "\u2265",
|
|
345
|
-
gt: ">",
|
|
346
|
-
harr: "\u2194",
|
|
347
|
-
hArr: "\u21D4",
|
|
348
|
-
hearts: "\u2665",
|
|
349
|
-
hellip: "\u2026",
|
|
350
|
-
Iacute: "\xCD",
|
|
351
|
-
iacute: "\xED",
|
|
352
|
-
Icirc: "\xCE",
|
|
353
|
-
icirc: "\xEE",
|
|
354
|
-
iexcl: "\xA1",
|
|
355
|
-
Igrave: "\xCC",
|
|
356
|
-
igrave: "\xEC",
|
|
357
|
-
image: "\u2111",
|
|
358
|
-
infin: "\u221E",
|
|
359
|
-
int: "\u222B",
|
|
360
|
-
Iota: "\u0399",
|
|
361
|
-
iota: "\u03B9",
|
|
362
|
-
iquest: "\xBF",
|
|
363
|
-
isin: "\u2208",
|
|
364
|
-
Iuml: "\xCF",
|
|
365
|
-
iuml: "\xEF",
|
|
366
|
-
Kappa: "\u039A",
|
|
367
|
-
kappa: "\u03BA",
|
|
368
|
-
Lambda: "\u039B",
|
|
369
|
-
lambda: "\u03BB",
|
|
370
|
-
lang: "\u2329",
|
|
371
|
-
laquo: "\xAB",
|
|
372
|
-
larr: "\u2190",
|
|
373
|
-
lArr: "\u21D0",
|
|
374
|
-
lceil: "\u2308",
|
|
375
|
-
ldquo: "\u201C",
|
|
376
|
-
le: "\u2264",
|
|
377
|
-
lfloor: "\u230A",
|
|
378
|
-
lowast: "\u2217",
|
|
379
|
-
loz: "\u25CA",
|
|
380
|
-
lrm: "\u200E",
|
|
381
|
-
lsaquo: "\u2039",
|
|
382
|
-
lsquo: "\u2018",
|
|
383
|
-
lt: "<",
|
|
384
|
-
macr: "\xAF",
|
|
385
|
-
mdash: "\u2014",
|
|
386
|
-
micro: "\xB5",
|
|
387
|
-
middot: "\xB7",
|
|
388
|
-
minus: "\u2212",
|
|
389
|
-
Mu: "\u039C",
|
|
390
|
-
mu: "\u03BC",
|
|
391
|
-
nabla: "\u2207",
|
|
392
|
-
nbsp: "\xA0",
|
|
393
|
-
ndash: "\u2013",
|
|
394
|
-
ne: "\u2260",
|
|
395
|
-
ni: "\u220B",
|
|
396
|
-
not: "\xAC",
|
|
397
|
-
notin: "\u2209",
|
|
398
|
-
nsub: "\u2284",
|
|
399
|
-
Ntilde: "\xD1",
|
|
400
|
-
ntilde: "\xF1",
|
|
401
|
-
Nu: "\u039D",
|
|
402
|
-
nu: "\u03BD",
|
|
403
|
-
Oacute: "\xD3",
|
|
404
|
-
oacute: "\xF3",
|
|
405
|
-
Ocirc: "\xD4",
|
|
406
|
-
ocirc: "\xF4",
|
|
407
|
-
OElig: "\u0152",
|
|
408
|
-
oelig: "\u0153",
|
|
409
|
-
Ograve: "\xD2",
|
|
410
|
-
ograve: "\xF2",
|
|
411
|
-
oline: "\u203E",
|
|
412
|
-
Omega: "\u03A9",
|
|
413
|
-
omega: "\u03C9",
|
|
414
|
-
Omicron: "\u039F",
|
|
415
|
-
omicron: "\u03BF",
|
|
416
|
-
oplus: "\u2295",
|
|
417
|
-
or: "\u2228",
|
|
418
|
-
ordf: "\xAA",
|
|
419
|
-
ordm: "\xBA",
|
|
420
|
-
Oslash: "\xD8",
|
|
421
|
-
oslash: "\xF8",
|
|
422
|
-
Otilde: "\xD5",
|
|
423
|
-
otilde: "\xF5",
|
|
424
|
-
otimes: "\u2297",
|
|
425
|
-
Ouml: "\xD6",
|
|
426
|
-
ouml: "\xF6",
|
|
427
|
-
para: "\xB6",
|
|
428
|
-
part: "\u2202",
|
|
429
|
-
permil: "\u2030",
|
|
430
|
-
perp: "\u22A5",
|
|
431
|
-
Phi: "\u03A6",
|
|
432
|
-
phi: "\u03C6",
|
|
433
|
-
Pi: "\u03A0",
|
|
434
|
-
pi: "\u03C0",
|
|
435
|
-
piv: "\u03D6",
|
|
436
|
-
plusmn: "\xB1",
|
|
437
|
-
pound: "\xA3",
|
|
438
|
-
prime: "\u2032",
|
|
439
|
-
Prime: "\u2033",
|
|
440
|
-
prod: "\u220F",
|
|
441
|
-
prop: "\u221D",
|
|
442
|
-
Psi: "\u03A8",
|
|
443
|
-
psi: "\u03C8",
|
|
444
|
-
quot: '"',
|
|
445
|
-
radic: "\u221A",
|
|
446
|
-
rang: "\u232A",
|
|
447
|
-
raquo: "\xBB",
|
|
448
|
-
rarr: "\u2192",
|
|
449
|
-
rArr: "\u21D2",
|
|
450
|
-
rceil: "\u2309",
|
|
451
|
-
rdquo: "\u201D",
|
|
452
|
-
real: "\u211C",
|
|
453
|
-
reg: "\xAE",
|
|
454
|
-
rfloor: "\u230B",
|
|
455
|
-
Rho: "\u03A1",
|
|
456
|
-
rho: "\u03C1",
|
|
457
|
-
rlm: "\u200F",
|
|
458
|
-
rsaquo: "\u203A",
|
|
459
|
-
rsquo: "\u2019",
|
|
460
|
-
sbquo: "\u201A",
|
|
461
|
-
Scaron: "\u0160",
|
|
462
|
-
scaron: "\u0161",
|
|
463
|
-
sdot: "\u22C5",
|
|
464
|
-
sect: "\xA7",
|
|
465
|
-
shy: "\xAD",
|
|
466
|
-
Sigma: "\u03A3",
|
|
467
|
-
sigma: "\u03C3",
|
|
468
|
-
sigmaf: "\u03C2",
|
|
469
|
-
sim: "\u223C",
|
|
470
|
-
spades: "\u2660",
|
|
471
|
-
sub: "\u2282",
|
|
472
|
-
sube: "\u2286",
|
|
473
|
-
sum: "\u2211",
|
|
474
|
-
sup: "\u2283",
|
|
475
|
-
sup1: "\xB9",
|
|
476
|
-
sup2: "\xB2",
|
|
477
|
-
sup3: "\xB3",
|
|
478
|
-
supe: "\u2287",
|
|
479
|
-
szlig: "\xDF",
|
|
480
|
-
Tau: "\u03A4",
|
|
481
|
-
tau: "\u03C4",
|
|
482
|
-
there4: "\u2234",
|
|
483
|
-
Theta: "\u0398",
|
|
484
|
-
theta: "\u03B8",
|
|
485
|
-
thetasym: "\u03D1",
|
|
486
|
-
thinsp: "\u2009",
|
|
487
|
-
THORN: "\xDE",
|
|
488
|
-
thorn: "\xFE",
|
|
489
|
-
tilde: "\u02DC",
|
|
490
|
-
times: "\xD7",
|
|
491
|
-
trade: "\u2122",
|
|
492
|
-
Uacute: "\xDA",
|
|
493
|
-
uacute: "\xFA",
|
|
494
|
-
uarr: "\u2191",
|
|
495
|
-
uArr: "\u21D1",
|
|
496
|
-
Ucirc: "\xDB",
|
|
497
|
-
ucirc: "\xFB",
|
|
498
|
-
Ugrave: "\xD9",
|
|
499
|
-
ugrave: "\xF9",
|
|
500
|
-
uml: "\xA8",
|
|
501
|
-
upsih: "\u03D2",
|
|
502
|
-
Upsilon: "\u03A5",
|
|
503
|
-
upsilon: "\u03C5",
|
|
504
|
-
Uuml: "\xDC",
|
|
505
|
-
uuml: "\xFC",
|
|
506
|
-
weierp: "\u2118",
|
|
507
|
-
Xi: "\u039E",
|
|
508
|
-
xi: "\u03BE",
|
|
509
|
-
Yacute: "\xDD",
|
|
510
|
-
yacute: "\xFD",
|
|
511
|
-
yen: "\xA5",
|
|
512
|
-
yuml: "\xFF",
|
|
513
|
-
Yuml: "\u0178",
|
|
514
|
-
Zeta: "\u0396",
|
|
515
|
-
zeta: "\u03B6",
|
|
516
|
-
zwj: "\u200D",
|
|
517
|
-
zwnj: "\u200C"
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
// src/unescape-string-literal-text.ts
|
|
521
|
-
function unescapeStringLiteralText(text) {
|
|
522
|
-
return text.replaceAll(/&(?:#\d+|#x[\da-fA-F]+|[0-9a-zA-Z]+);/g, (entity) => {
|
|
523
|
-
const item = entity.slice(1, -1);
|
|
524
|
-
if (item[0] === "#") {
|
|
525
|
-
const codePoint = item[1] === "x" ? parseInt(item.slice(2), 16) : parseInt(item.slice(1), 10);
|
|
526
|
-
return codePoint > 1114111 ? entity : String.fromCodePoint(codePoint);
|
|
527
|
-
}
|
|
528
|
-
return xhtmlEntities[item] ?? entity;
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
|
|
532
265
|
exports.DEFAULT_JSX_VALUE_HINT = DEFAULT_JSX_VALUE_HINT;
|
|
533
266
|
exports.JSXValueHint = JSXValueHint;
|
|
534
267
|
exports.findParentAttribute = findParentAttribute;
|
|
@@ -548,5 +281,3 @@ exports.isPaddingSpaces = isPaddingSpaces;
|
|
|
548
281
|
exports.isUserDefinedElement = isUserDefinedElement;
|
|
549
282
|
exports.isWhiteSpace = isWhiteSpace;
|
|
550
283
|
exports.toString = toString;
|
|
551
|
-
exports.unescapeStringLiteralText = unescapeStringLiteralText;
|
|
552
|
-
exports.xhtmlEntities = xhtmlEntities;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
2
1
|
import * as AST3 from '@eslint-react/ast';
|
|
3
2
|
import { returnTrue } from '@eslint-react/eff';
|
|
3
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
4
4
|
import * as VAR from '@eslint-react/var';
|
|
5
5
|
import { match, P } from 'ts-pattern';
|
|
6
6
|
|
|
7
|
-
// src/
|
|
7
|
+
// src/find-parent-attribute.ts
|
|
8
|
+
function findParentAttribute(node, test = returnTrue) {
|
|
9
|
+
const guard = (node2) => {
|
|
10
|
+
return node2.type === AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
11
|
+
};
|
|
12
|
+
return AST3.findParentNode(node, guard);
|
|
13
|
+
}
|
|
8
14
|
function toString(node) {
|
|
9
15
|
switch (node.type) {
|
|
10
16
|
case AST_NODE_TYPES.JSXIdentifier:
|
|
@@ -26,22 +32,12 @@ function toString(node) {
|
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
// src/attribute-name.ts
|
|
35
|
+
// src/get-attribute-name.ts
|
|
30
36
|
function getAttributeName(node) {
|
|
31
37
|
return toString(node.name);
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
return toString(node.openingElement.name);
|
|
38
|
-
}
|
|
39
|
-
function findParentAttribute(node, test = returnTrue) {
|
|
40
|
-
const guard = (node2) => {
|
|
41
|
-
return node2.type === AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
42
|
-
};
|
|
43
|
-
return AST3.findParentNode(node, guard);
|
|
44
|
-
}
|
|
39
|
+
|
|
40
|
+
// src/get-attribute.ts
|
|
45
41
|
function getAttribute(name, initialScope, attributes) {
|
|
46
42
|
return attributes.findLast((attr) => {
|
|
47
43
|
if (attr.type === AST_NODE_TYPES.JSXAttribute) {
|
|
@@ -62,7 +58,7 @@ function getAttribute(name, initialScope, attributes) {
|
|
|
62
58
|
return false;
|
|
63
59
|
});
|
|
64
60
|
}
|
|
65
|
-
function getAttributeValue(
|
|
61
|
+
function getAttributeValue(node, name, initialScope) {
|
|
66
62
|
switch (node.type) {
|
|
67
63
|
case AST_NODE_TYPES.JSXAttribute:
|
|
68
64
|
if (node.value?.type === AST_NODE_TYPES.Literal) {
|
|
@@ -101,6 +97,12 @@ function getAttributeValue(name, node, initialScope) {
|
|
|
101
97
|
return { kind: "none", node, initialScope };
|
|
102
98
|
}
|
|
103
99
|
}
|
|
100
|
+
function getElementName(node) {
|
|
101
|
+
if (node.type === AST_NODE_TYPES.JSXFragment) {
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
return toString(node.openingElement.name);
|
|
105
|
+
}
|
|
104
106
|
|
|
105
107
|
// src/has-attribute.ts
|
|
106
108
|
function hasAttribute(name, initialScope, attributes) {
|
|
@@ -237,273 +239,4 @@ function isPaddingSpaces(node) {
|
|
|
237
239
|
return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
|
|
238
240
|
}
|
|
239
241
|
|
|
240
|
-
|
|
241
|
-
var xhtmlEntities = {
|
|
242
|
-
Aacute: "\xC1",
|
|
243
|
-
aacute: "\xE1",
|
|
244
|
-
Acirc: "\xC2",
|
|
245
|
-
acirc: "\xE2",
|
|
246
|
-
acute: "\xB4",
|
|
247
|
-
AElig: "\xC6",
|
|
248
|
-
aelig: "\xE6",
|
|
249
|
-
Agrave: "\xC0",
|
|
250
|
-
agrave: "\xE0",
|
|
251
|
-
alefsym: "\u2135",
|
|
252
|
-
Alpha: "\u0391",
|
|
253
|
-
alpha: "\u03B1",
|
|
254
|
-
amp: "&",
|
|
255
|
-
and: "\u2227",
|
|
256
|
-
ang: "\u2220",
|
|
257
|
-
apos: "'",
|
|
258
|
-
Aring: "\xC5",
|
|
259
|
-
aring: "\xE5",
|
|
260
|
-
asymp: "\u2248",
|
|
261
|
-
Atilde: "\xC3",
|
|
262
|
-
atilde: "\xE3",
|
|
263
|
-
Auml: "\xC4",
|
|
264
|
-
auml: "\xE4",
|
|
265
|
-
bdquo: "\u201E",
|
|
266
|
-
Beta: "\u0392",
|
|
267
|
-
beta: "\u03B2",
|
|
268
|
-
brvbar: "\xA6",
|
|
269
|
-
bull: "\u2022",
|
|
270
|
-
cap: "\u2229",
|
|
271
|
-
Ccedil: "\xC7",
|
|
272
|
-
ccedil: "\xE7",
|
|
273
|
-
cedil: "\xB8",
|
|
274
|
-
cent: "\xA2",
|
|
275
|
-
Chi: "\u03A7",
|
|
276
|
-
chi: "\u03C7",
|
|
277
|
-
circ: "\u02C6",
|
|
278
|
-
clubs: "\u2663",
|
|
279
|
-
cong: "\u2245",
|
|
280
|
-
copy: "\xA9",
|
|
281
|
-
crarr: "\u21B5",
|
|
282
|
-
cup: "\u222A",
|
|
283
|
-
curren: "\xA4",
|
|
284
|
-
dagger: "\u2020",
|
|
285
|
-
Dagger: "\u2021",
|
|
286
|
-
darr: "\u2193",
|
|
287
|
-
dArr: "\u21D3",
|
|
288
|
-
deg: "\xB0",
|
|
289
|
-
Delta: "\u0394",
|
|
290
|
-
delta: "\u03B4",
|
|
291
|
-
diams: "\u2666",
|
|
292
|
-
divide: "\xF7",
|
|
293
|
-
Eacute: "\xC9",
|
|
294
|
-
eacute: "\xE9",
|
|
295
|
-
Ecirc: "\xCA",
|
|
296
|
-
ecirc: "\xEA",
|
|
297
|
-
Egrave: "\xC8",
|
|
298
|
-
egrave: "\xE8",
|
|
299
|
-
empty: "\u2205",
|
|
300
|
-
emsp: "\u2003",
|
|
301
|
-
ensp: "\u2002",
|
|
302
|
-
Epsilon: "\u0395",
|
|
303
|
-
epsilon: "\u03B5",
|
|
304
|
-
equiv: "\u2261",
|
|
305
|
-
Eta: "\u0397",
|
|
306
|
-
eta: "\u03B7",
|
|
307
|
-
ETH: "\xD0",
|
|
308
|
-
eth: "\xF0",
|
|
309
|
-
Euml: "\xCB",
|
|
310
|
-
euml: "\xEB",
|
|
311
|
-
euro: "\u20AC",
|
|
312
|
-
exist: "\u2203",
|
|
313
|
-
fnof: "\u0192",
|
|
314
|
-
forall: "\u2200",
|
|
315
|
-
frac12: "\xBD",
|
|
316
|
-
frac14: "\xBC",
|
|
317
|
-
frac34: "\xBE",
|
|
318
|
-
frasl: "\u2044",
|
|
319
|
-
Gamma: "\u0393",
|
|
320
|
-
gamma: "\u03B3",
|
|
321
|
-
ge: "\u2265",
|
|
322
|
-
gt: ">",
|
|
323
|
-
harr: "\u2194",
|
|
324
|
-
hArr: "\u21D4",
|
|
325
|
-
hearts: "\u2665",
|
|
326
|
-
hellip: "\u2026",
|
|
327
|
-
Iacute: "\xCD",
|
|
328
|
-
iacute: "\xED",
|
|
329
|
-
Icirc: "\xCE",
|
|
330
|
-
icirc: "\xEE",
|
|
331
|
-
iexcl: "\xA1",
|
|
332
|
-
Igrave: "\xCC",
|
|
333
|
-
igrave: "\xEC",
|
|
334
|
-
image: "\u2111",
|
|
335
|
-
infin: "\u221E",
|
|
336
|
-
int: "\u222B",
|
|
337
|
-
Iota: "\u0399",
|
|
338
|
-
iota: "\u03B9",
|
|
339
|
-
iquest: "\xBF",
|
|
340
|
-
isin: "\u2208",
|
|
341
|
-
Iuml: "\xCF",
|
|
342
|
-
iuml: "\xEF",
|
|
343
|
-
Kappa: "\u039A",
|
|
344
|
-
kappa: "\u03BA",
|
|
345
|
-
Lambda: "\u039B",
|
|
346
|
-
lambda: "\u03BB",
|
|
347
|
-
lang: "\u2329",
|
|
348
|
-
laquo: "\xAB",
|
|
349
|
-
larr: "\u2190",
|
|
350
|
-
lArr: "\u21D0",
|
|
351
|
-
lceil: "\u2308",
|
|
352
|
-
ldquo: "\u201C",
|
|
353
|
-
le: "\u2264",
|
|
354
|
-
lfloor: "\u230A",
|
|
355
|
-
lowast: "\u2217",
|
|
356
|
-
loz: "\u25CA",
|
|
357
|
-
lrm: "\u200E",
|
|
358
|
-
lsaquo: "\u2039",
|
|
359
|
-
lsquo: "\u2018",
|
|
360
|
-
lt: "<",
|
|
361
|
-
macr: "\xAF",
|
|
362
|
-
mdash: "\u2014",
|
|
363
|
-
micro: "\xB5",
|
|
364
|
-
middot: "\xB7",
|
|
365
|
-
minus: "\u2212",
|
|
366
|
-
Mu: "\u039C",
|
|
367
|
-
mu: "\u03BC",
|
|
368
|
-
nabla: "\u2207",
|
|
369
|
-
nbsp: "\xA0",
|
|
370
|
-
ndash: "\u2013",
|
|
371
|
-
ne: "\u2260",
|
|
372
|
-
ni: "\u220B",
|
|
373
|
-
not: "\xAC",
|
|
374
|
-
notin: "\u2209",
|
|
375
|
-
nsub: "\u2284",
|
|
376
|
-
Ntilde: "\xD1",
|
|
377
|
-
ntilde: "\xF1",
|
|
378
|
-
Nu: "\u039D",
|
|
379
|
-
nu: "\u03BD",
|
|
380
|
-
Oacute: "\xD3",
|
|
381
|
-
oacute: "\xF3",
|
|
382
|
-
Ocirc: "\xD4",
|
|
383
|
-
ocirc: "\xF4",
|
|
384
|
-
OElig: "\u0152",
|
|
385
|
-
oelig: "\u0153",
|
|
386
|
-
Ograve: "\xD2",
|
|
387
|
-
ograve: "\xF2",
|
|
388
|
-
oline: "\u203E",
|
|
389
|
-
Omega: "\u03A9",
|
|
390
|
-
omega: "\u03C9",
|
|
391
|
-
Omicron: "\u039F",
|
|
392
|
-
omicron: "\u03BF",
|
|
393
|
-
oplus: "\u2295",
|
|
394
|
-
or: "\u2228",
|
|
395
|
-
ordf: "\xAA",
|
|
396
|
-
ordm: "\xBA",
|
|
397
|
-
Oslash: "\xD8",
|
|
398
|
-
oslash: "\xF8",
|
|
399
|
-
Otilde: "\xD5",
|
|
400
|
-
otilde: "\xF5",
|
|
401
|
-
otimes: "\u2297",
|
|
402
|
-
Ouml: "\xD6",
|
|
403
|
-
ouml: "\xF6",
|
|
404
|
-
para: "\xB6",
|
|
405
|
-
part: "\u2202",
|
|
406
|
-
permil: "\u2030",
|
|
407
|
-
perp: "\u22A5",
|
|
408
|
-
Phi: "\u03A6",
|
|
409
|
-
phi: "\u03C6",
|
|
410
|
-
Pi: "\u03A0",
|
|
411
|
-
pi: "\u03C0",
|
|
412
|
-
piv: "\u03D6",
|
|
413
|
-
plusmn: "\xB1",
|
|
414
|
-
pound: "\xA3",
|
|
415
|
-
prime: "\u2032",
|
|
416
|
-
Prime: "\u2033",
|
|
417
|
-
prod: "\u220F",
|
|
418
|
-
prop: "\u221D",
|
|
419
|
-
Psi: "\u03A8",
|
|
420
|
-
psi: "\u03C8",
|
|
421
|
-
quot: '"',
|
|
422
|
-
radic: "\u221A",
|
|
423
|
-
rang: "\u232A",
|
|
424
|
-
raquo: "\xBB",
|
|
425
|
-
rarr: "\u2192",
|
|
426
|
-
rArr: "\u21D2",
|
|
427
|
-
rceil: "\u2309",
|
|
428
|
-
rdquo: "\u201D",
|
|
429
|
-
real: "\u211C",
|
|
430
|
-
reg: "\xAE",
|
|
431
|
-
rfloor: "\u230B",
|
|
432
|
-
Rho: "\u03A1",
|
|
433
|
-
rho: "\u03C1",
|
|
434
|
-
rlm: "\u200F",
|
|
435
|
-
rsaquo: "\u203A",
|
|
436
|
-
rsquo: "\u2019",
|
|
437
|
-
sbquo: "\u201A",
|
|
438
|
-
Scaron: "\u0160",
|
|
439
|
-
scaron: "\u0161",
|
|
440
|
-
sdot: "\u22C5",
|
|
441
|
-
sect: "\xA7",
|
|
442
|
-
shy: "\xAD",
|
|
443
|
-
Sigma: "\u03A3",
|
|
444
|
-
sigma: "\u03C3",
|
|
445
|
-
sigmaf: "\u03C2",
|
|
446
|
-
sim: "\u223C",
|
|
447
|
-
spades: "\u2660",
|
|
448
|
-
sub: "\u2282",
|
|
449
|
-
sube: "\u2286",
|
|
450
|
-
sum: "\u2211",
|
|
451
|
-
sup: "\u2283",
|
|
452
|
-
sup1: "\xB9",
|
|
453
|
-
sup2: "\xB2",
|
|
454
|
-
sup3: "\xB3",
|
|
455
|
-
supe: "\u2287",
|
|
456
|
-
szlig: "\xDF",
|
|
457
|
-
Tau: "\u03A4",
|
|
458
|
-
tau: "\u03C4",
|
|
459
|
-
there4: "\u2234",
|
|
460
|
-
Theta: "\u0398",
|
|
461
|
-
theta: "\u03B8",
|
|
462
|
-
thetasym: "\u03D1",
|
|
463
|
-
thinsp: "\u2009",
|
|
464
|
-
THORN: "\xDE",
|
|
465
|
-
thorn: "\xFE",
|
|
466
|
-
tilde: "\u02DC",
|
|
467
|
-
times: "\xD7",
|
|
468
|
-
trade: "\u2122",
|
|
469
|
-
Uacute: "\xDA",
|
|
470
|
-
uacute: "\xFA",
|
|
471
|
-
uarr: "\u2191",
|
|
472
|
-
uArr: "\u21D1",
|
|
473
|
-
Ucirc: "\xDB",
|
|
474
|
-
ucirc: "\xFB",
|
|
475
|
-
Ugrave: "\xD9",
|
|
476
|
-
ugrave: "\xF9",
|
|
477
|
-
uml: "\xA8",
|
|
478
|
-
upsih: "\u03D2",
|
|
479
|
-
Upsilon: "\u03A5",
|
|
480
|
-
upsilon: "\u03C5",
|
|
481
|
-
Uuml: "\xDC",
|
|
482
|
-
uuml: "\xFC",
|
|
483
|
-
weierp: "\u2118",
|
|
484
|
-
Xi: "\u039E",
|
|
485
|
-
xi: "\u03BE",
|
|
486
|
-
Yacute: "\xDD",
|
|
487
|
-
yacute: "\xFD",
|
|
488
|
-
yen: "\xA5",
|
|
489
|
-
yuml: "\xFF",
|
|
490
|
-
Yuml: "\u0178",
|
|
491
|
-
Zeta: "\u0396",
|
|
492
|
-
zeta: "\u03B6",
|
|
493
|
-
zwj: "\u200D",
|
|
494
|
-
zwnj: "\u200C"
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
// src/unescape-string-literal-text.ts
|
|
498
|
-
function unescapeStringLiteralText(text) {
|
|
499
|
-
return text.replaceAll(/&(?:#\d+|#x[\da-fA-F]+|[0-9a-zA-Z]+);/g, (entity) => {
|
|
500
|
-
const item = entity.slice(1, -1);
|
|
501
|
-
if (item[0] === "#") {
|
|
502
|
-
const codePoint = item[1] === "x" ? parseInt(item.slice(2), 16) : parseInt(item.slice(1), 10);
|
|
503
|
-
return codePoint > 1114111 ? entity : String.fromCodePoint(codePoint);
|
|
504
|
-
}
|
|
505
|
-
return xhtmlEntities[item] ?? entity;
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementName, hasAnyAttribute, hasAttribute, hasEveryAttribute, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, toString, unescapeStringLiteralText, xhtmlEntities };
|
|
242
|
+
export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementName, hasAnyAttribute, hasAttribute, hasEveryAttribute, isBuiltInElement, isJSXValue, isKeyedElement, isLineBreak, isLiteral, isPaddingSpaces, isUserDefinedElement, isWhiteSpace, toString };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.14",
|
|
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": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@typescript-eslint/types": "^8.20.0",
|
|
38
38
|
"@typescript-eslint/utils": "^8.20.0",
|
|
39
39
|
"ts-pattern": "^5.6.0",
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
42
|
-
"@eslint-react/
|
|
40
|
+
"@eslint-react/eff": "1.24.0-next.14",
|
|
41
|
+
"@eslint-react/var": "1.24.0-next.14",
|
|
42
|
+
"@eslint-react/ast": "1.24.0-next.14"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsup": "^8.3.5",
|