fix Prettier issue

pull/14601/head
Mateusz Kadlubowski 2 years ago
parent e185e1ac28
commit abc2a7e056
No known key found for this signature in database
GPG Key ID: AAED58FCEFE941BB

@ -69,7 +69,11 @@ export function prune(stylesheet, element) {
seen.clear();
if (
apply_selector(selectors, /** @type {Compiler.AST.CSS.Rule} */ (node.metadata.rule), element)
apply_selector(
selectors,
/** @type {Compiler.AST.CSS.Rule} */ (node.metadata.rule),
element
)
) {
node.metadata.used = true;
}

@ -1,8 +1,8 @@
/** @import { Visitors } from 'zimmerframe' */
/** @import { AST } from '#compiler' */
import { walk } from "zimmerframe";
import * as w from "../../../warnings.js";
import { is_keyframes_node } from "../../css.js";
import { walk } from 'zimmerframe';
import * as w from '../../../warnings.js';
import { is_keyframes_node } from '../../css.js';
/**
* @param {AST.CSS.StyleSheet} stylesheet
@ -19,7 +19,7 @@ const visitors = {
}
},
PseudoClassSelector(node, context) {
if (node.name === "is" || node.name === "where") {
if (node.name === 'is' || node.name === 'where') {
context.next();
}
},
@ -27,15 +27,11 @@ const visitors = {
if (
!node.metadata.used &&
// prevent double-marking of `.unused:is(.unused)`
(context.path.at(-2)?.type !== "PseudoClassSelector" ||
/** @type {AST.CSS.ComplexSelector} */ (context.path.at(-4))?.metadata
.used)
(context.path.at(-2)?.type !== 'PseudoClassSelector' ||
/** @type {AST.CSS.ComplexSelector} */ (context.path.at(-4))?.metadata.used)
) {
const content = context.state.stylesheet.content;
const text = content.styles.substring(
node.start - content.start,
node.end - content.start,
);
const text = content.styles.substring(node.start - content.start, node.end - content.start);
w.css_unused_selector(node, text);
}
@ -47,5 +43,5 @@ const visitors = {
} else {
context.next();
}
},
}
};

Loading…
Cancel
Save