Update rules

This commit is contained in:
Alex
2024-08-25 16:28:34 -04:00
parent b0cc4a1525
commit 0138cabb27
18 changed files with 325 additions and 236 deletions

View File

@ -29,8 +29,6 @@ export default createRule<Option[], MessageId>({
type: 'problem',
docs: {
description: 'Enforce template literal expressions to be of `string` type',
recommended: 'recommended',
requiresTypeChecking: true,
},
messages: {
invalidType: 'Invalid type "{{type}}" of template literal expression.',
@ -55,6 +53,8 @@ export default createRule<Option[], MessageId>({
defaultOptions: [defaultOption],
create(context, [options]) {
const services = getParserServices(context);
if (!services.program) return {};
const checker = services.program.getTypeChecker();
const allowed = new Set(options.allow);