@murky-web/oxlint-plugin-solid 0.0.1 → 0.1.1

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": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "Local Oxlint JS plugin port for Solid rules plus Murky-specific Solid conventions.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -69,7 +69,7 @@ function getImportedName(specifier) {
69
69
  return specifier.imported.value;
70
70
  }
71
71
 
72
- function getPropsParam(functionNode) {
72
+ function getPropsParam(functionNode, sourceCode) {
73
73
  if (functionNode.params.length === NO_PARAMETERS) {
74
74
  return {
75
75
  name: "",
@@ -82,14 +82,21 @@ function getPropsParam(functionNode) {
82
82
  }
83
83
 
84
84
  const [param] = functionNode.params;
85
- if (param.type !== "Identifier") {
86
- return FALSE_SENTINEL;
85
+ if (param.type === "Identifier") {
86
+ return {
87
+ name: param.name,
88
+ text: param.name,
89
+ };
87
90
  }
88
91
 
89
- return {
90
- name: param.name,
91
- text: param.name,
92
- };
92
+ if (param.type === "ObjectPattern") {
93
+ return {
94
+ name: "",
95
+ text: sourceCode.getText(param),
96
+ };
97
+ }
98
+
99
+ return FALSE_SENTINEL;
93
100
  }
94
101
 
95
102
  function getPropsSuffix(typeReference) {
@@ -116,11 +123,14 @@ function getTypeReferenceForProps(functionNode, sourceCode) {
116
123
  }
117
124
 
118
125
  const [param] = functionNode.params;
119
- if (param.type !== "Identifier" || !param.typeAnnotation) {
120
- return FALSE_SENTINEL;
126
+ if (
127
+ (param.type === "Identifier" || param.type === "ObjectPattern") &&
128
+ param.typeAnnotation
129
+ ) {
130
+ return sourceCode.getText(param.typeAnnotation.typeAnnotation);
121
131
  }
122
132
 
123
- return sourceCode.getText(param.typeAnnotation.typeAnnotation);
133
+ return FALSE_SENTINEL;
124
134
  }
125
135
 
126
136
  function findLocalTypeName(importDeclarations, desiredTypeName) {
@@ -359,7 +369,7 @@ export const preferArrowComponentsRule = {
359
369
  return;
360
370
  }
361
371
 
362
- const propsParam = getPropsParam(node);
372
+ const propsParam = getPropsParam(node, sourceCode);
363
373
  const typeReference = getTypeReferenceForProps(
364
374
  node,
365
375
  sourceCode,