mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(lint): ignore !important in font families (#2538)
This commit is contained in:
@@ -178,6 +178,14 @@ describe("font rules", () => {
|
||||
expect(findings).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("does not treat !important as part of a generic font family", async () => {
|
||||
const html = `<div data-composition-id="test" data-width="1920" data-height="1080">
|
||||
<style>body { font-family: 'Inter', cursive !important; }</style>
|
||||
</div>`;
|
||||
const findings = await findByCode(html, "font_family_without_font_face");
|
||||
expect(findings).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("reports multiple missing families in one finding", async () => {
|
||||
const html = `<div data-composition-id="test" data-width="1920" data-height="1080">
|
||||
<style>
|
||||
|
||||
@@ -65,6 +65,7 @@ function extractFontFaceFamilies(styles: Array<{ content: string }>): Set<string
|
||||
function normalizeUsedFontName(part: string): string | null {
|
||||
const name = part
|
||||
.trim()
|
||||
.replace(/\s*!important\s*$/i, "")
|
||||
.replace(/^['"]|['"]$/g, "")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user