@pobammer-ts/eslint-cease-nonsense-rules 1.5.2 → 1.5.3
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/dist/build-metadata.json +3 -3
- package/dist/index.js +47 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/build-metadata.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -17858,6 +17858,50 @@ function isNonPatternExpression(value) {
|
|
|
17858
17858
|
function isNonPrivateExpression(value) {
|
|
17859
17859
|
return value.type !== AST_NODE_TYPES3.PrivateIdentifier;
|
|
17860
17860
|
}
|
|
17861
|
+
function objectHasFromAndTo(objectExpr) {
|
|
17862
|
+
let hasFrom = false;
|
|
17863
|
+
let hasTo = false;
|
|
17864
|
+
for (const property of objectExpr.properties) {
|
|
17865
|
+
if (property.type !== AST_NODE_TYPES3.Property)
|
|
17866
|
+
continue;
|
|
17867
|
+
if (property.computed)
|
|
17868
|
+
continue;
|
|
17869
|
+
if (property.key.type !== AST_NODE_TYPES3.Identifier)
|
|
17870
|
+
continue;
|
|
17871
|
+
if (property.key.name === "from")
|
|
17872
|
+
hasFrom = true;
|
|
17873
|
+
if (property.key.name === "to")
|
|
17874
|
+
hasTo = true;
|
|
17875
|
+
if (hasFrom && hasTo)
|
|
17876
|
+
return true;
|
|
17877
|
+
}
|
|
17878
|
+
return false;
|
|
17879
|
+
}
|
|
17880
|
+
function hasFromAndToProperties(context, expression) {
|
|
17881
|
+
const unwrapped = unwrapExpression(expression);
|
|
17882
|
+
if (unwrapped.type === AST_NODE_TYPES3.ObjectExpression)
|
|
17883
|
+
return objectHasFromAndTo(unwrapped);
|
|
17884
|
+
if (unwrapped.type === AST_NODE_TYPES3.Identifier) {
|
|
17885
|
+
const variable = findVariable(context, unwrapped);
|
|
17886
|
+
if (variable === undefined)
|
|
17887
|
+
return false;
|
|
17888
|
+
if (!isModuleLevelScope(variable.scope))
|
|
17889
|
+
return false;
|
|
17890
|
+
if (isImport(variable))
|
|
17891
|
+
return false;
|
|
17892
|
+
for (const def of variable.defs) {
|
|
17893
|
+
const initializer = getConstInitializer(def);
|
|
17894
|
+
if (initializer === undefined)
|
|
17895
|
+
continue;
|
|
17896
|
+
const normalizedInitializer = unwrapExpression(initializer);
|
|
17897
|
+
if (normalizedInitializer.type !== AST_NODE_TYPES3.ObjectExpression)
|
|
17898
|
+
continue;
|
|
17899
|
+
if (objectHasFromAndTo(normalizedInitializer))
|
|
17900
|
+
return true;
|
|
17901
|
+
}
|
|
17902
|
+
}
|
|
17903
|
+
return false;
|
|
17904
|
+
}
|
|
17861
17905
|
function isStaticObjectLikeConfig(context, expression, seen, options3) {
|
|
17862
17906
|
const unwrapped = unwrapExpression(expression);
|
|
17863
17907
|
if (unwrapped.type === AST_NODE_TYPES3.ObjectExpression)
|
|
@@ -17993,6 +18037,8 @@ var noUselessUseSpring = {
|
|
|
17993
18037
|
const seen = new Set;
|
|
17994
18038
|
if (!isStaticObjectLikeConfig(context, configArgument, seen, normalized))
|
|
17995
18039
|
return;
|
|
18040
|
+
if (hasFromAndToProperties(context, configArgument))
|
|
18041
|
+
return;
|
|
17996
18042
|
const depsKind = classifyDependencies(context, node.arguments[1], seen, normalized);
|
|
17997
18043
|
if (!depsAreNonUpdating(depsKind, normalized))
|
|
17998
18044
|
return;
|
|
@@ -21062,4 +21108,4 @@ export {
|
|
|
21062
21108
|
createBanInstancesOptions
|
|
21063
21109
|
};
|
|
21064
21110
|
|
|
21065
|
-
//# debugId=
|
|
21111
|
+
//# debugId=736A57F0AC33510764756E2164756E21
|