@murky-web/oxlint-plugin-solid 0.1.1 → 0.1.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/package.json
CHANGED
|
@@ -15,18 +15,44 @@ function isAstNode(value) {
|
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
18
|
+
function hasJsxElementReturnType(node) {
|
|
19
|
+
const rt = node.returnType?.typeAnnotation;
|
|
20
|
+
if (!rt) return false;
|
|
21
|
+
// JSX.Element
|
|
22
|
+
if (
|
|
23
|
+
rt.type === "TSTypeReference" &&
|
|
24
|
+
rt.typeName?.type === "TSQualifiedName" &&
|
|
25
|
+
rt.typeName.left?.name === "JSX" &&
|
|
26
|
+
rt.typeName.right?.name === "Element"
|
|
27
|
+
) return true;
|
|
28
|
+
// JSX.Element via plain identifier (rare but possible)
|
|
29
|
+
if (rt.type === "TSTypeReference" && rt.typeName?.name === "JSXElement") return true;
|
|
30
|
+
return false;
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
function isFunctionComponent(node) {
|
|
34
|
+
if (
|
|
35
|
+
node.type !== "FunctionDeclaration" ||
|
|
36
|
+
node.async === true ||
|
|
37
|
+
node.generator === true ||
|
|
38
|
+
node.typeParameters
|
|
39
|
+
) return false;
|
|
40
|
+
|
|
41
|
+
if (node.id?.type !== "Identifier") return false;
|
|
42
|
+
|
|
43
|
+
// exported PascalCase — classic component
|
|
44
|
+
const isExported = node.parent?.type === "ExportNamedDeclaration";
|
|
45
|
+
if (isExported && isPascalCaseComponentName(node.id.name)) return true;
|
|
46
|
+
|
|
47
|
+
// has JSX.Element return type annotation — intent is clear regardless of export/casing
|
|
48
|
+
if (hasJsxElementReturnType(node)) return true;
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Keep old name as alias so call sites don't need changing
|
|
54
|
+
const isExportedFunctionComponent = isFunctionComponent;
|
|
55
|
+
|
|
30
56
|
function isJsxLikeNode(node) {
|
|
31
57
|
return node?.type === "JSXElement" || node?.type === "JSXFragment";
|
|
32
58
|
}
|