pasika 0.10.62 → 0.10.63
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 +52 -0
- package/package.json +1 -1
|
@@ -4988,6 +4988,54 @@ var noMixedConcernsRule = {
|
|
|
4988
4988
|
import path39 from "path";
|
|
4989
4989
|
var DOC4 = "See docs/next-codebase-guide/rules/redundant-aliases-rule.md";
|
|
4990
4990
|
var VALUE_SENTINELS = /* @__PURE__ */ new Set(["undefined", "NaN", "Infinity"]);
|
|
4991
|
+
var RESERVED_LOCAL_NAMES = /* @__PURE__ */ new Set([
|
|
4992
|
+
"await",
|
|
4993
|
+
"break",
|
|
4994
|
+
"case",
|
|
4995
|
+
"catch",
|
|
4996
|
+
"class",
|
|
4997
|
+
"const",
|
|
4998
|
+
"continue",
|
|
4999
|
+
"debugger",
|
|
5000
|
+
"default",
|
|
5001
|
+
"delete",
|
|
5002
|
+
"do",
|
|
5003
|
+
"else",
|
|
5004
|
+
"enum",
|
|
5005
|
+
"export",
|
|
5006
|
+
"extends",
|
|
5007
|
+
"false",
|
|
5008
|
+
"finally",
|
|
5009
|
+
"for",
|
|
5010
|
+
"function",
|
|
5011
|
+
"if",
|
|
5012
|
+
"implements",
|
|
5013
|
+
"import",
|
|
5014
|
+
"in",
|
|
5015
|
+
"instanceof",
|
|
5016
|
+
"interface",
|
|
5017
|
+
"let",
|
|
5018
|
+
"new",
|
|
5019
|
+
"null",
|
|
5020
|
+
"package",
|
|
5021
|
+
"private",
|
|
5022
|
+
"protected",
|
|
5023
|
+
"public",
|
|
5024
|
+
"return",
|
|
5025
|
+
"static",
|
|
5026
|
+
"super",
|
|
5027
|
+
"switch",
|
|
5028
|
+
"this",
|
|
5029
|
+
"throw",
|
|
5030
|
+
"true",
|
|
5031
|
+
"try",
|
|
5032
|
+
"typeof",
|
|
5033
|
+
"var",
|
|
5034
|
+
"void",
|
|
5035
|
+
"while",
|
|
5036
|
+
"with",
|
|
5037
|
+
"yield"
|
|
5038
|
+
]);
|
|
4991
5039
|
var HTTP_METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
4992
5040
|
var PRIMITIVE_TYPE_NAMES = {
|
|
4993
5041
|
TSBigIntKeyword: "bigint",
|
|
@@ -5041,6 +5089,9 @@ function isExportedVariable2(context, variable) {
|
|
|
5041
5089
|
(definition) => definition.type === "Variable" && context.sourceCode.getAncestors(definition.parent).at(-1)?.type === "ExportNamedDeclaration"
|
|
5042
5090
|
);
|
|
5043
5091
|
}
|
|
5092
|
+
function canUsePropertyNameAsLocal(name) {
|
|
5093
|
+
return /^[a-z][A-Za-z0-9]*$/u.test(name) && !RESERVED_LOCAL_NAMES.has(name);
|
|
5094
|
+
}
|
|
5044
5095
|
function visibleVariable(context, node, name) {
|
|
5045
5096
|
let scope = context.sourceCode.getScope(node);
|
|
5046
5097
|
while (scope) {
|
|
@@ -5136,6 +5187,7 @@ var noRedundantAliasRule = {
|
|
|
5136
5187
|
if (node.parent.type !== "ObjectExpression" || node.computed || node.key.type !== "Identifier") return;
|
|
5137
5188
|
if (node.value.type !== "Identifier" && node.value.type !== "MemberExpression") return;
|
|
5138
5189
|
const propertyName4 = node.key.name;
|
|
5190
|
+
if (!canUsePropertyNameAsLocal(propertyName4)) return;
|
|
5139
5191
|
const propertyValue = node.value;
|
|
5140
5192
|
const source = context.sourceCode.getText(propertyValue);
|
|
5141
5193
|
if (propertyValue.type === "Identifier") {
|