@blumintinc/eslint-plugin-blumint 1.19.13 → 1.19.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/lib/index.js +1 -1
- package/lib/rules/require-props-composition.js +19 -1
- package/package.json +1 -1
- package/release-manifest.json +14 -0
package/lib/index.js
CHANGED
|
@@ -118,6 +118,13 @@ function getTypeReferenceName(node) {
|
|
|
118
118
|
function typeNodeComposesWithProps(typeNode, propsTypeName) {
|
|
119
119
|
switch (typeNode.type) {
|
|
120
120
|
case utils_1.AST_NODE_TYPES.TSTypeReference: {
|
|
121
|
+
// A direct reference to the child's whole props type (bare `ChildProps`
|
|
122
|
+
// or generic-instantiated `ChildProps<T>`) is the maximal form of
|
|
123
|
+
// composition: the entire surface is inherited verbatim, strictly
|
|
124
|
+
// stronger than Pick/Omit, so no duplication/drift is possible.
|
|
125
|
+
if (getTypeReferenceName(typeNode) === propsTypeName) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
121
128
|
if (typeReferenceContainsPickOrOmit(typeNode, propsTypeName)) {
|
|
122
129
|
return true;
|
|
123
130
|
}
|
|
@@ -313,6 +320,16 @@ function findComponentFunction(program, name, seen = new Set()) {
|
|
|
313
320
|
}
|
|
314
321
|
return null;
|
|
315
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* A rendered child that resolves in-file to a component function taking no
|
|
325
|
+
* parameters has no props surface to compose with, so it is not a composition
|
|
326
|
+
* dependency (same category as a decorative icon). Only in-file resolution is
|
|
327
|
+
* used; imported children are left to the normal composition check.
|
|
328
|
+
*/
|
|
329
|
+
function isZeroPropComponent(program, name) {
|
|
330
|
+
const fn = findComponentFunction(program, name);
|
|
331
|
+
return fn !== null && fn.params.length === 0;
|
|
332
|
+
}
|
|
316
333
|
/**
|
|
317
334
|
* Resolve the type node that defines a rendered dependency's props: its
|
|
318
335
|
* `{Dep}Props` alias if one exists, otherwise the dependency component's
|
|
@@ -446,7 +463,8 @@ exports.requirePropsComposition = (0, createRule_1.createRule)({
|
|
|
446
463
|
// Filter to non-excluded custom components
|
|
447
464
|
const depComponents = Array.from(allJsxNames).filter((name) => !excludeComponents.has(name) &&
|
|
448
465
|
!isDecorativeIcon(name) &&
|
|
449
|
-
name !== componentName
|
|
466
|
+
name !== componentName &&
|
|
467
|
+
!isZeroPropComponent(prog, name));
|
|
450
468
|
if (depComponents.length < minDependencyCount) {
|
|
451
469
|
return;
|
|
452
470
|
}
|
package/package.json
CHANGED
package/release-manifest.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "1.19.14",
|
|
4
|
+
"date": "2026-07-17T21:35:22.880Z",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "require-props-composition",
|
|
8
|
+
"changeType": "fix",
|
|
9
|
+
"issues": [
|
|
10
|
+
1316
|
|
11
|
+
],
|
|
12
|
+
"summary": "recognize direct whole-props refs and skip zero-prop children (closes #1316)"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"version": "1.19.13",
|
|
4
18
|
"date": "2026-07-17T21:25:11.513Z",
|