pasika 0.10.59 → 0.10.60
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 +19 -1
- package/package.json +1 -1
|
@@ -5020,12 +5020,19 @@ function aliasMessage(alias, source) {
|
|
|
5020
5020
|
const sourceName = source ?? "the original symbol";
|
|
5021
5021
|
return `"${aliasName}" only renames "${sourceName}". Use "${sourceName}" directly or rename the original symbol and its consumers. ${DOC4}`;
|
|
5022
5022
|
}
|
|
5023
|
+
function objectPropertyMessage(propertyName4, source, identifierValue) {
|
|
5024
|
+
if (!identifierValue) {
|
|
5025
|
+
return `"${propertyName4}" maps "${source}" inline. Bind it as "${propertyName4}" before this object and use property shorthand. ${DOC4}`;
|
|
5026
|
+
}
|
|
5027
|
+
if (source === propertyName4) return `Use property shorthand for "${propertyName4}". ${DOC4}`;
|
|
5028
|
+
return `"${propertyName4}" maps the local "${source}" inline. Rename the producer to "${propertyName4}" and use property shorthand. ${DOC4}`;
|
|
5029
|
+
}
|
|
5023
5030
|
var noRedundantAliasRule = {
|
|
5024
5031
|
meta: {
|
|
5025
5032
|
schema: [],
|
|
5026
5033
|
type: "problem",
|
|
5027
5034
|
docs: {
|
|
5028
|
-
description: "Disallow
|
|
5035
|
+
description: "Disallow redundant aliases and inline identifier/member-expression object mappings."
|
|
5029
5036
|
}
|
|
5030
5037
|
},
|
|
5031
5038
|
create(context) {
|
|
@@ -5042,6 +5049,17 @@ var noRedundantAliasRule = {
|
|
|
5042
5049
|
message: aliasMessage(node.id.name, node.init.name)
|
|
5043
5050
|
});
|
|
5044
5051
|
},
|
|
5052
|
+
Property(node) {
|
|
5053
|
+
if (node.parent.type !== "ObjectExpression" || node.computed || node.key.type !== "Identifier") return;
|
|
5054
|
+
if (node.value.type !== "Identifier" && node.value.type !== "MemberExpression") return;
|
|
5055
|
+
const propertyName4 = node.key.name;
|
|
5056
|
+
const source = context.sourceCode.getText(node.value);
|
|
5057
|
+
if (node.value.type === "Identifier" && node.shorthand) return;
|
|
5058
|
+
context.report({
|
|
5059
|
+
node,
|
|
5060
|
+
message: objectPropertyMessage(propertyName4, source, node.value.type === "Identifier")
|
|
5061
|
+
});
|
|
5062
|
+
},
|
|
5045
5063
|
TSTypeAliasDeclaration(node) {
|
|
5046
5064
|
if (node.typeParameters) return;
|
|
5047
5065
|
const annotation = node.typeAnnotation;
|