pasika 0.10.63 → 0.10.65
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/eslint/pasika/index.js +2 -38
- package/package.json +1 -1
|
@@ -5108,9 +5108,7 @@ function canRenameIdentifierProducer(context, node, targetName) {
|
|
|
5108
5108
|
if (targetVariable && targetVariable !== variable) return false;
|
|
5109
5109
|
const definition = variable.defs[0];
|
|
5110
5110
|
if (!definition || variable.defs.length !== 1) return false;
|
|
5111
|
-
if (definition.type
|
|
5112
|
-
if (definition.type === "Variable" && definition.parent.kind !== "const") return false;
|
|
5113
|
-
if (definition.type !== "Variable" && definition.type !== "Parameter") return false;
|
|
5111
|
+
if (definition.type !== "Variable" || definition.parent.kind !== "const") return false;
|
|
5114
5112
|
return variable.references.filter((reference) => reference.isRead()).length === 1;
|
|
5115
5113
|
}
|
|
5116
5114
|
function memberRootIdentifier(node) {
|
|
@@ -5126,40 +5124,6 @@ function canBindMemberExpression(context, node, targetName) {
|
|
|
5126
5124
|
const variable = findVariable(context, root);
|
|
5127
5125
|
return !variable?.defs.some((definition) => definition.type === "ImportBinding");
|
|
5128
5126
|
}
|
|
5129
|
-
function listStatement(node) {
|
|
5130
|
-
let current = node;
|
|
5131
|
-
while (current.parent && current.parent.type !== "Program" && current.parent.type !== "BlockStatement") {
|
|
5132
|
-
current = current.parent;
|
|
5133
|
-
}
|
|
5134
|
-
return current.parent ? current : void 0;
|
|
5135
|
-
}
|
|
5136
|
-
function identifierPropertyFixes(context, node, value, propertyName4, fixer) {
|
|
5137
|
-
if (value.name === propertyName4) return [fixer.replaceText(node, propertyName4)];
|
|
5138
|
-
const variable = findVariable(context, value);
|
|
5139
|
-
if (!variable) return [];
|
|
5140
|
-
return [
|
|
5141
|
-
...variable.identifiers.map((identifier) => fixer.replaceText(identifier, propertyName4)),
|
|
5142
|
-
fixer.replaceText(node, propertyName4)
|
|
5143
|
-
];
|
|
5144
|
-
}
|
|
5145
|
-
function memberPropertyFixes(context, node, value, propertyName4, source, fixer) {
|
|
5146
|
-
const statement = listStatement(node);
|
|
5147
|
-
if (!statement) return [];
|
|
5148
|
-
const root = memberRootIdentifier(value);
|
|
5149
|
-
const rootVariable = root ? findVariable(context, root) : void 0;
|
|
5150
|
-
if (rootVariable?.defs.some((definition) => {
|
|
5151
|
-
const [statementStart, statementEnd] = context.sourceCode.getRange(statement);
|
|
5152
|
-
const [definitionStart, definitionEnd] = context.sourceCode.getRange(definition.node);
|
|
5153
|
-
return definitionStart >= statementStart && definitionEnd <= statementEnd;
|
|
5154
|
-
})) {
|
|
5155
|
-
return [];
|
|
5156
|
-
}
|
|
5157
|
-
return [
|
|
5158
|
-
fixer.insertTextBefore(statement, `const ${propertyName4} = ${source};
|
|
5159
|
-
`),
|
|
5160
|
-
fixer.replaceText(node, propertyName4)
|
|
5161
|
-
];
|
|
5162
|
-
}
|
|
5163
5127
|
var noRedundantAliasRule = {
|
|
5164
5128
|
meta: {
|
|
5165
5129
|
schema: [],
|
|
@@ -5200,7 +5164,7 @@ var noRedundantAliasRule = {
|
|
|
5200
5164
|
node,
|
|
5201
5165
|
message: objectPropertyMessage(propertyName4, source, propertyValue.type === "Identifier"),
|
|
5202
5166
|
fix(fixer) {
|
|
5203
|
-
return propertyValue.type === "Identifier"
|
|
5167
|
+
return propertyValue.type === "Identifier" && propertyValue.name === propertyName4 ? fixer.replaceText(node, propertyName4) : null;
|
|
5204
5168
|
}
|
|
5205
5169
|
});
|
|
5206
5170
|
},
|