@murky-web/oxlint-plugin-solid 1.4.0 → 1.5.0
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@murky-web/oxlint-plugin-solid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Local Oxlint JS plugin port for Solid rules plus Murky-specific Solid conventions.",
|
|
6
6
|
"homepage": "https://github.com/MurkyTheMurloc/web_dev_tools/tree/main/packages/oxlint-plugin-solid",
|
|
@@ -22,7 +22,6 @@ export default {
|
|
|
22
22
|
"Disallow Solid's removed JSX attribute namespaces. Solid 2.0 dropped `on:`, `oncapture:`, `use:`, `prop:`, `attr:`, `bool:`, `class:` and `style:`.",
|
|
23
23
|
url: "https://docs.solidjs.com/",
|
|
24
24
|
},
|
|
25
|
-
hasSuggestions: true,
|
|
26
25
|
schema: [
|
|
27
26
|
{
|
|
28
27
|
type: "object",
|
|
@@ -34,7 +33,17 @@ export default {
|
|
|
34
33
|
items: {
|
|
35
34
|
type: "string",
|
|
36
35
|
},
|
|
37
|
-
|
|
36
|
+
minItems: 1,
|
|
37
|
+
uniqueItems: true,
|
|
38
|
+
},
|
|
39
|
+
allowedNamespacedProps: {
|
|
40
|
+
description:
|
|
41
|
+
"an array of exact namespaced prop names to allow, such as `client:visible`",
|
|
42
|
+
type: "array",
|
|
43
|
+
items: {
|
|
44
|
+
type: "string",
|
|
45
|
+
pattern: "^[^:]+:[^:]+$",
|
|
46
|
+
},
|
|
38
47
|
minItems: 1,
|
|
39
48
|
uniqueItems: true,
|
|
40
49
|
},
|
|
@@ -48,44 +57,41 @@ export default {
|
|
|
48
57
|
unknown:
|
|
49
58
|
"'{{namespace}}:' is not a namespace Solid understands. Solid 2.0 has no special JSX prefixes.",
|
|
50
59
|
component: "Namespaced props have no effect on components.",
|
|
51
|
-
"component-suggest":
|
|
52
|
-
"Replace {{namespace}}:{{name}} with {{name}}.",
|
|
53
60
|
},
|
|
54
61
|
},
|
|
55
62
|
defaultOptions: [],
|
|
56
63
|
create(context) {
|
|
57
64
|
const explicitlyAllowedNamespaces =
|
|
58
65
|
context.options?.[0]?.allowedNamespaces;
|
|
66
|
+
const explicitlyAllowedProps =
|
|
67
|
+
context.options?.[0]?.allowedNamespacedProps;
|
|
59
68
|
return {
|
|
60
69
|
"JSXAttribute > JSXNamespacedName": (node) => {
|
|
70
|
+
const namespace = node.namespace?.name;
|
|
71
|
+
// Both allow lists cover every element: a framework can give a
|
|
72
|
+
// namespace meaning on components (`<Island client:visible>`).
|
|
73
|
+
// `allowedNamespacedProps` names single props, so a typo or an
|
|
74
|
+
// unsupported prop of the same namespace is still reported.
|
|
75
|
+
if (
|
|
76
|
+
explicitlyAllowedNamespaces?.includes(namespace) ||
|
|
77
|
+
explicitlyAllowedProps?.includes(
|
|
78
|
+
`${namespace}:${node.name?.name}`,
|
|
79
|
+
)
|
|
80
|
+
) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
61
83
|
const openingElement = node.parent.parent;
|
|
62
84
|
if (
|
|
63
85
|
openingElement.name.type === "JSXIdentifier" &&
|
|
64
86
|
!isDOMElementName(openingElement.name.name)
|
|
65
87
|
) {
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
suggest: [
|
|
71
|
-
{
|
|
72
|
-
messageId: "component-suggest",
|
|
73
|
-
data: {
|
|
74
|
-
namespace: node.namespace.name,
|
|
75
|
-
name: node.name.name,
|
|
76
|
-
},
|
|
77
|
-
fix: (fixer) =>
|
|
78
|
-
fixer.replaceText(node, node.name.name),
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
});
|
|
88
|
+
// Solid itself gives a namespaced prop on a component no
|
|
89
|
+
// meaning. No suggestion: deleting the prefix changes the
|
|
90
|
+
// prop's name, and the rule cannot know which one is meant.
|
|
91
|
+
context.report({ node, messageId: "component" });
|
|
82
92
|
return;
|
|
83
93
|
}
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
xmlNamespaces.includes(namespace) ||
|
|
87
|
-
explicitlyAllowedNamespaces?.includes(namespace)
|
|
88
|
-
) {
|
|
94
|
+
if (xmlNamespaces.includes(namespace)) {
|
|
89
95
|
return;
|
|
90
96
|
}
|
|
91
97
|
const replacement = replacements[namespace];
|