@blumintinc/eslint-plugin-blumint 1.20.165 → 1.20.166
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
CHANGED
|
@@ -822,12 +822,55 @@ function isPropertyComplex(prop, checker, tsNode, ts, treatAnyAsComplex, parentT
|
|
|
822
822
|
}
|
|
823
823
|
return shouldTreatAnyAsComplex(prop, propType, ts, treatAnyAsComplex, parentTypeFlags, checker);
|
|
824
824
|
}
|
|
825
|
+
/**
|
|
826
|
+
* Returns true when `declaration` was written by a dependency rather than by the
|
|
827
|
+
* component's author: a declaration file, or any file under `node_modules`.
|
|
828
|
+
* Keys on the same `getSourceFile().fileName` inspection the React and DOM
|
|
829
|
+
* origin gates use.
|
|
830
|
+
*/
|
|
831
|
+
function isExternalDeclaration(declaration) {
|
|
832
|
+
const sourceFile = declaration.getSourceFile?.();
|
|
833
|
+
if (!sourceFile)
|
|
834
|
+
return false;
|
|
835
|
+
const fileName = sourceFile.fileName ?? '';
|
|
836
|
+
return (sourceFile.isDeclarationFile === true ||
|
|
837
|
+
/\.d\.[cm]?ts$/.test(fileName) ||
|
|
838
|
+
/[/\\]node_modules[/\\]/.test(fileName));
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Returns true when every declaration site of `prop` lives in a dependency.
|
|
842
|
+
*
|
|
843
|
+
* `checker.getPropertiesOfType` returns INHERITED members, so a props type that
|
|
844
|
+
* extends or intersects a library interface (MUI's `TypographyProps`, React's
|
|
845
|
+
* `HTMLAttributes`, …) surfaces that library's entire surface. Demanding the
|
|
846
|
+
* author name those in `compareDeeply` prescribes a remedy nobody can act on —
|
|
847
|
+
* the component neither declares nor receives them, and the lists run past a
|
|
848
|
+
* hundred names — so the only available exit is a blanket rule disable.
|
|
849
|
+
*
|
|
850
|
+
* The gate is `every` rather than "first declaration", so a prop the author
|
|
851
|
+
* redeclares alongside the library's (the intersection of two same-named
|
|
852
|
+
* members yields one symbol carrying BOTH declarations) still counts as
|
|
853
|
+
* authored and is still reported.
|
|
854
|
+
*
|
|
855
|
+
* A prop with no declarations at all is treated as authored. Synthesized
|
|
856
|
+
* symbols reach here from mapped and generic types over the component's own
|
|
857
|
+
* props, and reporting them preserves the rule's core behaviour; a missing
|
|
858
|
+
* declaration is not evidence of a dependency.
|
|
859
|
+
*/
|
|
860
|
+
function isExternallyDeclaredProperty(prop) {
|
|
861
|
+
const declarations = prop.declarations;
|
|
862
|
+
if (!declarations || declarations.length === 0)
|
|
863
|
+
return false;
|
|
864
|
+
return declarations.every(isExternalDeclaration);
|
|
865
|
+
}
|
|
825
866
|
function getComplexPropertiesFromType(type, checker, tsNode, ts, treatAnyAsComplex = false, parentTypeFlags = 0) {
|
|
826
867
|
const properties = checker.getPropertiesOfType(type);
|
|
827
868
|
const complexProps = [];
|
|
828
869
|
for (const prop of properties) {
|
|
829
870
|
if (isReservedReactPropName(prop.name))
|
|
830
871
|
continue;
|
|
872
|
+
if (isExternallyDeclaredProperty(prop))
|
|
873
|
+
continue;
|
|
831
874
|
if (isPropertyComplex(prop, checker, tsNode, ts, treatAnyAsComplex, parentTypeFlags)) {
|
|
832
875
|
complexProps.push(prop.name);
|
|
833
876
|
}
|
package/package.json
CHANGED
package/release-manifest.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "1.20.166",
|
|
4
|
+
"date": "2026-08-18T03:18:38.188Z",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "memo-compare-deeply-complex-props",
|
|
8
|
+
"changeType": "fix",
|
|
9
|
+
"issues": [
|
|
10
|
+
2037
|
|
11
|
+
],
|
|
12
|
+
"summary": "exempt props declared by a dependency (closes #2037)"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"version": "1.20.165",
|
|
4
18
|
"date": "2026-08-18T00:07:35.027Z",
|