Skip to content

Commit

Permalink
build(deps-dev): bump xo from 0.54.2 to 0.57.0 (#880)
Browse files Browse the repository at this point in the history
* build(deps-dev): bump xo from 0.54.2 to 0.57.0

Bumps [xo](https://github.com/xojs/xo) from 0.54.2 to 0.57.0.
- [Release notes](https://github.com/xojs/xo/releases)
- [Commits](xojs/xo@v0.54.2...v0.57.0)

---
updated-dependencies:
- dependency-name: xo
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Disable a couple of new xo rules for now

* Autofix

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
  • Loading branch information
dependabot[bot] and XhmikosR committed Feb 19, 2024
1 parent 37636d9 commit 816e7ad
Show file tree
Hide file tree
Showing 11 changed files with 3,197 additions and 3,514 deletions.
20 changes: 15 additions & 5 deletions lib/svg-sprite/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,27 +326,37 @@ module.exports = class SVGSpriterConfig {

if (!Array.isArray(this.spacing[property])) {
spacing = Math.max(0, Number.parseInt(this.spacing[property] || 0, 10));
this.spacing[property] = { top: spacing, right: spacing, bottom: spacing, left: spacing };
this.spacing[property] = {
top: spacing, right: spacing, bottom: spacing, left: spacing
};
} else {
spacing = this.spacing[property].map(n => Math.max(0, n));
switch (spacing.length) {
case 1: {
spacing = { top: spacing[0], right: spacing[0], bottom: spacing[0], left: spacing[0] };
spacing = {
top: spacing[0], right: spacing[0], bottom: spacing[0], left: spacing[0]
};
break;
}

case 2: {
spacing = { top: spacing[0], right: spacing[1], bottom: spacing[0], left: spacing[1] };
spacing = {
top: spacing[0], right: spacing[1], bottom: spacing[0], left: spacing[1]
};
break;
}

case 3: {
spacing = { top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[1] };
spacing = {
top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[1]
};
break;
}

default: {
spacing = { top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[3] };
spacing = {
top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[3]
};
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/svg-sprite/layouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const defaultMustacheVariables = {
},
classname() {
return (str, render) => {
const classname = render(str).replace(/\s+/g, ' ').split(' ').pop();
const classname = render(str).replaceAll(/\s+/g, ' ').split(' ').pop();
return classname.startsWith('.') ? classname.substr(1) : classname;
};
},
Expand Down
10 changes: 6 additions & 4 deletions lib/svg-sprite/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const createIdGenerator = template => {
*/
const generator = function(name) {
const pathname = this.separator ? name.split(path.sep).join(this.separator) : name;
return format(template || '%s', path.basename(pathname.replace(/\s+/g, this.whitespace), '.svg'));
return format(template || '%s', path.basename(pathname.replaceAll(/\s+/g, this.whitespace), '.svg'));
};

return generator;
Expand Down Expand Up @@ -124,7 +124,9 @@ const defaultConfig = {
*
* @type {number | Array}
*/
padding: { top: 0, right: 0, bottom: 0, left: 0 },
padding: {
top: 0, right: 0, bottom: 0, left: 0
},
/**
* Box sizing strategy
*
Expand Down Expand Up @@ -790,7 +792,7 @@ SVGShape.prototype.resetNamespace = function() {
SVGShape.prototype._replaceIdAndClassnameReferences = function(str, substIds, substClassnames, selectors) {
// If ID replacement is to be applied: Replace url()-style ID references
if (substIds !== null) {
str = str.replace(/url\s*\(\s*["']?([^\s"')]+)["']?\s*\)/g, (match, id) => {
str = str.replaceAll(/url\s*\(\s*["']?([^\s"')]+)["']?\s*\)/g, (match, id) => {
return `url(${id in substIds ? `#${substIds[id]}` : id})`;
});
}
Expand Down Expand Up @@ -826,7 +828,7 @@ SVGShape.prototype._replaceIdAndClassnameReferencesInCssSelectors = function(str

// Else: Recursively process rule content
} else if (Array.isArray(rule.cssRules)) {
css += str.substring(rule.__starts, rule.cssRules[0].__starts) + this._replaceIdAndClassnameReferencesInCssSelectors(str, rule.cssRules, substIds, substClassnames) + str.substring(rule.cssRules[rule.cssRules.length - 1].__ends, rule.__ends);
css += str.substring(rule.__starts, rule.cssRules[0].__starts) + this._replaceIdAndClassnameReferencesInCssSelectors(str, rule.cssRules, substIds, substClassnames) + str.substring(rule.cssRules.at(-1).__ends, rule.__ends);
}

// Regular selector
Expand Down
2 changes: 1 addition & 1 deletion lib/svg-sprite/utils/fix-xml-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = svgString => {
const fixedSVG = new DOMParser({ errorHandler })
.parseFromString(svgString)
.toString()
.replace(/(\s)(\s+)/g, ' ');
.replaceAll(/(\s)(\s+)/g, ' ');

if (!domParserError) {
return fixedSVG;
Expand Down
Loading

0 comments on commit 816e7ad

Please sign in to comment.