Skip to content

Commit b775c51

Browse files
committed
chore: Remove unused functions
1 parent 5136249 commit b775c51

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

src/ts-ast-util/tag-utils.test.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ts from 'typescript';
2-
import { findAllNodes, findNode } from './utilily-functions';
2+
import { findAllNodes } from './utilily-functions';
33
import type { TagConfig, StrictTagCondition } from './types';
4-
import { parseTagConfig, getTemplateNodeUnder, isTagged, getTagName } from './tag-utils';
4+
import { parseTagConfig, getTemplateNodeUnder, getTagName } from './tag-utils';
55

66
describe(parseTagConfig, () => {
77
test.each([
@@ -190,23 +190,3 @@ describe(getTagName, () => {
190190
expect(actual).toBe(undefined);
191191
});
192192
});
193-
194-
describe(isTagged, () => {
195-
it('should return true when the tag condition is matched', () => {
196-
// prettier-ignore
197-
const text = 'function myTag(...args: any[]) { return "" }' + '\n'
198-
+ 'const x = myTag`query { }`';
199-
const s = ts.createSourceFile('input.ts', text, ts.ScriptTarget.Latest, true);
200-
const node = findNode(s, text.length - 3) as ts.Node;
201-
expect(isTagged(node, 'myTag')).toBeTruthy();
202-
});
203-
204-
it('should return true when the tag condition is not matched', () => {
205-
// prettier-ignore
206-
const text = 'function myTag(...args: any[]) { return "" }' + '\n'
207-
+ 'const x = myTag`query { }`';
208-
const s = ts.createSourceFile('input.ts', text, ts.ScriptTarget.Latest, true);
209-
const node = findNode(s, text.length - 3) as ts.Node;
210-
expect(isTagged(node, 'MyTag')).toBeFalsy();
211-
});
212-
});

src/ts-ast-util/tag-utils.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,3 @@ export function getTagName(
9292
}
9393
return undefined;
9494
}
95-
96-
export function hasTagged(node: ts.Node | undefined, condition: string | undefined, source?: ts.SourceFile) {
97-
if (!node) return;
98-
if (!ts.isTaggedTemplateExpression(node)) return false;
99-
const tagNode = node;
100-
return tagNode.tag.getText(source) === condition;
101-
}
102-
103-
export function isTagged(node: ts.Node | undefined, condition: string | undefined, source?: ts.SourceFile) {
104-
if (!node) return false;
105-
return hasTagged(node.parent, condition, source);
106-
}

0 commit comments

Comments
 (0)