pasika 0.10.44 → 0.10.45
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.
|
@@ -5189,7 +5189,7 @@ var preferEnumRule = {
|
|
|
5189
5189
|
schema: [],
|
|
5190
5190
|
type: "problem",
|
|
5191
5191
|
docs: {
|
|
5192
|
-
description: "Require fixed sets of named string/number values to be TypeScript enums instead of `as const` objects or literal-union
|
|
5192
|
+
description: "Require fixed sets of named string/number values to be TypeScript enums instead of `as const` objects, literal-union aliases, or inline literal-union property types."
|
|
5193
5193
|
}
|
|
5194
5194
|
},
|
|
5195
5195
|
create(context) {
|
|
@@ -5214,6 +5214,14 @@ var preferEnumRule = {
|
|
|
5214
5214
|
node,
|
|
5215
5215
|
message: "A named union made only of string or number literals must be a TypeScript enum. See docs/next-codebase-guide/rules/constants-rule.md"
|
|
5216
5216
|
});
|
|
5217
|
+
},
|
|
5218
|
+
TSPropertySignature(node) {
|
|
5219
|
+
const typeAnnotation = node.typeAnnotation?.typeAnnotation;
|
|
5220
|
+
if (!isEnumLiteralUnion(typeAnnotation)) return;
|
|
5221
|
+
context.report({
|
|
5222
|
+
node,
|
|
5223
|
+
message: "A property whose type is a union made only of string or number literals must use a TypeScript enum. See docs/next-codebase-guide/rules/constants-rule.md"
|
|
5224
|
+
});
|
|
5217
5225
|
}
|
|
5218
5226
|
};
|
|
5219
5227
|
}
|