Skip to content

Commit

Permalink
fix Prettier issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xeho91 committed Dec 10, 2024
1 parent e185e1a commit abc2a7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 8 additions & 12 deletions packages/svelte/src/compiler/phases/2-analyze/css/css-warn.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,23 +19,19 @@ const visitors = {
}
},
PseudoClassSelector(node, context) {
if (node.name === "is" || node.name === "where") {
if (node.name === 'is' || node.name === 'where') {
context.next();
}
},
ComplexSelector(node, context) {
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);
}

Expand All @@ -47,5 +43,5 @@ const visitors = {
} else {
context.next();
}
},
}
};

0 comments on commit abc2a7e

Please sign in to comment.