Skip to content

Commit

Permalink
Fix code lint errors in plugin code.
Browse files Browse the repository at this point in the history
  • Loading branch information
strarsis committed Aug 29, 2024
1 parent 58697fd commit eed23f1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plugins/dereferenceUses.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const fn = (root, params) => {
// "Only the attributes x, y, width, height and href on the use element will override those set on the referenced element.
// However, any other attributes not set on the referenced element will be applied to the use element."
const insertElementAttributeNames = Object.keys(
insertElement.attributes
insertElement.attributes,
);
for (const attributeName in useElement.node.attributes) {
// don't remove attributes from the referenced element that, by spec, override the one of the <use> element
Expand Down Expand Up @@ -129,26 +129,26 @@ export const fn = (root, params) => {
if (useElementStyles) {
const useElementStylesAst = csstree.parse(
useElementStyles,
styleParseOpts
styleParseOpts,
);
if (useElementStylesAst.type !== 'DeclarationList') {
continue;
}

const insertElementStylesAst = csstree.parse(
insertElementStyles,
styleParseOpts
styleParseOpts,
);
if (insertElementStylesAst.type !== 'DeclarationList') {
continue;
}

insertElementStylesAst.children.appendList(
useElementStylesAst.children
useElementStylesAst.children,
);

const insertElementStylesAppended = csstree.generate(
insertElementStylesAst
insertElementStylesAst,
);
insertElement.attributes.style = insertElementStylesAppended; // append styles (styles from <use/> have higher priority)
}
Expand All @@ -157,13 +157,13 @@ export const fn = (root, params) => {

// position of <use/> in parent
const useElementPosition = useElement.parentNode.children.indexOf(
useElement.node
useElement.node,
);

useElement.parentNode.children.splice(
useElementPosition,
1,
insertElement
insertElement,
);
}
},
Expand Down

0 comments on commit eed23f1

Please sign in to comment.