From d6ff70baf96bd0c7801b809aeaef6764ff2b6b73 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 3 Dec 2023 10:02:22 -0800 Subject: [PATCH] chore: fix several typos (#1868) --- CHANGELOG-old.md | 2 +- README.md | 2 +- docs/02-preset-default.mdx | 2 +- docs/03-plugins/add-classes-to-svg-element.mdx | 4 ++-- docs/03-plugins/convert-transform.mdx | 2 +- docs/03-plugins/index.mdx | 2 +- docs/03-plugins/minify-styles.mdx | 2 +- docs/03-plugins/remove-attrs.mdx | 2 +- lib/path.js | 2 +- lib/path.test.js | 2 +- lib/svgo.d.ts | 2 +- plugins/cleanupAttrs.js | 2 +- plugins/collapseGroups.js | 2 +- plugins/convertPathData.js | 4 ++-- plugins/convertShapeToPath.js | 2 +- plugins/convertStyleToAttrs.js | 2 +- plugins/convertTransform.js | 4 ++-- plugins/inlineStyles.js | 2 +- plugins/plugins-types.d.ts | 2 +- plugins/removeXlink.js | 2 +- test/svgo/_index.test.js | 2 +- 21 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CHANGELOG-old.md b/CHANGELOG-old.md index 7632139c7..cf12974c9 100644 --- a/CHANGELOG-old.md +++ b/CHANGELOG-old.md @@ -468,7 +468,7 @@ Some goodness from pull-requests. * plugins/convertPathData: do not remove very first M from the path data (fix [#24](https://github.com/svg/svgo/issues/24)) * plugins/convertPathData: optimize path data in <glyph> and <missing-glyph> (close [#20](https://github.com/svg/svgo/issues/20)) * plugins/convertTransform: add patternTransform attribute to the process (close [#15](https://github.com/svg/svgo/issues/15)) -* plugins/convertTransform: Firefox: removing extra space in front of negative number is alowed only in path data, but not in transform (fix [#12](https://github.com/svg/svgo/issues/12)) +* plugins/convertTransform: Firefox: removing extra space in front of negative number is allowed only in path data, but not in transform (fix [#12](https://github.com/svg/svgo/issues/12)) * plugins/removeXMLProcInst: remove only 'xml' but not 'xml-stylesheet' (fix [#21](https://github.com/svg/svgo/issues/15)) * plugins/collapseGroups: merge split-level transforms (fix [#13](https://github.com/svg/svgo/issues/13)) * jsdoc corrections diff --git a/README.md b/README.md index ee48f557d..1ac3d59c6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ SVG files, especially those exported from vector editors, usually contain a lot ## Installation -You can install SVGO globablly through npm, yarn, or pnpm. Alternatively, drop the global flag (`global`/`-g`) to use it in your Node.js project. +You can install SVGO globally through npm, yarn, or pnpm. Alternatively, drop the global flag (`global`/`-g`) to use it in your Node.js project. ```sh # npm diff --git a/docs/02-preset-default.mdx b/docs/02-preset-default.mdx index 1b3fdd6f6..f8d45c72c 100644 --- a/docs/02-preset-default.mdx +++ b/docs/02-preset-default.mdx @@ -71,7 +71,7 @@ module.exports = { }; ``` -Alternatively, you can also drop `default-preset` entirely, and configure your own plugin pipeline from scratch, with only the desireable plugins: +Alternatively, you can also drop `default-preset` entirely, and configure your own plugin pipeline from scratch, with only the desirable plugins: ```js module.exports = { diff --git a/docs/03-plugins/add-classes-to-svg-element.mdx b/docs/03-plugins/add-classes-to-svg-element.mdx index 121c58ea6..4b6b71d60 100644 --- a/docs/03-plugins/add-classes-to-svg-element.mdx +++ b/docs/03-plugins/add-classes-to-svg-element.mdx @@ -18,9 +18,9 @@ If there is no `class` attribute to begin with, it will be added. However, if th ::: -If you have a standalone SVG, this is not an optimization and will increase the size of the SVG document. This plugin is only relavent when considering multiple SVGs that may be inlined a parent document. +If you have a standalone SVG, this is not an optimization and will increase the size of the SVG document. This plugin is only relevant when considering multiple SVGs that may be inlined a parent document. -By adding classes, if the parent document is aware, you can share styles across all inlined SVG elements. +By adding classes, if the parent document is aware, you can share styles across all inlined SVG elements. ## Usage diff --git a/docs/03-plugins/convert-transform.mdx b/docs/03-plugins/convert-transform.mdx index 91e56ce84..3aa4d8c8a 100644 --- a/docs/03-plugins/convert-transform.mdx +++ b/docs/03-plugins/convert-transform.mdx @@ -8,7 +8,7 @@ svgo: description: Convert transforms to their shorthand alternatives. default: true degPrecision: - description: Number of decimal places to round degress values to, using conventional rounding rules. Used for rotate and skew. + description: Number of decimal places to round degrees values to, using conventional rounding rules. Used for rotate and skew. floatPrecision: description: Number of decimal places to round to, using conventional rounding rules. default: 3 diff --git a/docs/03-plugins/index.mdx b/docs/03-plugins/index.mdx index faf70a1ea..8ca0a1c1f 100644 --- a/docs/03-plugins/index.mdx +++ b/docs/03-plugins/index.mdx @@ -4,7 +4,7 @@ title: Plugins All optimizations performed by SVGO are through the various plugins that are either built-in, or provided in your SVGO config. -Built-in plugins are focused around either optimzations or compatibility. However, the plugin architecure is very flexible, so plugins can be made to do effectively anything. +Built-in plugins are focused around either optimizations or compatibility. However, the plugin architecture is very flexible, so plugins can be made to do effectively anything. ## Presets diff --git a/docs/03-plugins/minify-styles.mdx b/docs/03-plugins/minify-styles.mdx index f6f4fb4d3..d8ca28222 100644 --- a/docs/03-plugins/minify-styles.mdx +++ b/docs/03-plugins/minify-styles.mdx @@ -5,7 +5,7 @@ svgo: defaultPlugin: true parameters: usage: - description: If to collect usage data such as tags, classes, and IDs to pass to CSSO. This is an object with four properties, which are each configured with a boolean, tags, ids, classes, and force. By default, if a script is found this does not pass usage data to CSSO, but this can be overriden with force, which may yield destructive changes. + description: If to collect usage data such as tags, classes, and IDs to pass to CSSO. This is an object with four properties, which are each configured with a boolean, tags, ids, classes, and force. By default, if a script is found this does not pass usage data to CSSO, but this can be overridden with force, which may yield destructive changes. default: true --- diff --git a/docs/03-plugins/remove-attrs.mdx b/docs/03-plugins/remove-attrs.mdx index 6446c438d..096041498 100644 --- a/docs/03-plugins/remove-attrs.mdx +++ b/docs/03-plugins/remove-attrs.mdx @@ -7,7 +7,7 @@ svgo: description: A selector that matches attributes. default: null elemSeparator: - description: The pattern syntax used by this plugin is element:attribute:value, this changes the delimeter from : to another string. + description: The pattern syntax used by this plugin is element:attribute:value, this changes the delimiter from : to another string. default: ":" preserveCurrentColor: description: If to ignore the attribute if it's set to currentColor. diff --git a/lib/path.js b/lib/path.js index c8782ce80..1e383dd98 100644 --- a/lib/path.js +++ b/lib/path.js @@ -228,7 +228,7 @@ const parsePathData = (string) => { // flush arguments when necessary count is reached if (args.length === argsCount) { pathData.push({ command, args }); - // subsequent moveto coordinates are threated as implicit lineto commands + // subsequent moveto coordinates are treated as implicit lineto commands if (command === 'M') { command = 'L'; } diff --git a/lib/path.test.js b/lib/path.test.js index dc0e976c5..c7d4e69a4 100644 --- a/lib/path.test.js +++ b/lib/path.test.js @@ -33,7 +33,7 @@ describe('parse path data', () => { { command: 'M', args: [0, 10] }, ]); }); - it('should forbid multipe commas in a row', () => { + it('should forbid multiple commas in a row', () => { expect(parsePathData('M0 , , 10')).toEqual([]); }); it('should stop when unknown char appears', () => { diff --git a/lib/svgo.d.ts b/lib/svgo.d.ts index b5770f957..d98d12931 100644 --- a/lib/svgo.d.ts +++ b/lib/svgo.d.ts @@ -30,7 +30,7 @@ export type Config = { path?: string; /** Pass over SVGs multiple times to ensure all optimizations are applied. */ multipass?: boolean; - /** Precision of floating point numbers. Will be passed to each plugin that suppors this param. */ + /** Precision of floating point numbers. Will be passed to each plugin that supports this param. */ floatPrecision?: number; /** * Plugins configuration diff --git a/plugins/cleanupAttrs.js b/plugins/cleanupAttrs.js index 399de1940..af66193a4 100644 --- a/plugins/cleanupAttrs.js +++ b/plugins/cleanupAttrs.js @@ -22,7 +22,7 @@ exports.fn = (root, params) => { enter: (node) => { for (const name of Object.keys(node.attributes)) { if (newlines) { - // new line which requires a space instead of themselve + // new line which requires a space instead of themself node.attributes[name] = node.attributes[name].replace( regNewlinesNeedSpace, (match, p1, p2) => p1 + ' ' + p2 diff --git a/plugins/collapseGroups.js b/plugins/collapseGroups.js index ff38caff6..6042a01ce 100644 --- a/plugins/collapseGroups.js +++ b/plugins/collapseGroups.js @@ -63,7 +63,7 @@ exports.fn = () => { return; } - // move group attibutes to the single child element + // move group attributes to the single child element if ( Object.keys(node.attributes).length !== 0 && node.children.length === 1 diff --git a/plugins/convertPathData.js b/plugins/convertPathData.js index c100dd263..6229d9f76 100644 --- a/plugins/convertPathData.js +++ b/plugins/convertPathData.js @@ -593,7 +593,7 @@ function filters( } } - // Rounding relative coordinates, taking in account accummulating error + // Rounding relative coordinates, taking in account accumulating error // to get closer to absolute coordinates. Sum of rounded value remains same: // l .25 3 .25 2 .25 3 .25 2 -> l .3 3 .2 2 .3 3 .2 2 if (precision !== false) { @@ -975,7 +975,7 @@ function getIntersection(coords) { c2 = coords[4] * coords[7] - coords[5] * coords[6], // x1 * y2 - x2 * y1 denom = a1 * b2 - a2 * b1; - if (!denom) return; // parallel lines havn't an intersection + if (!denom) return; // parallel lines haven't an intersection /** * @type {Point} diff --git a/plugins/convertShapeToPath.js b/plugins/convertShapeToPath.js index 7705fa97d..8a3b5a1f4 100644 --- a/plugins/convertShapeToPath.js +++ b/plugins/convertShapeToPath.js @@ -139,7 +139,7 @@ exports.fn = (root, params) => { delete node.attributes.r; } - // optionally covert ellipse + // optionally convert ellipse if (node.name === 'ellipse' && convertArcs) { const ecx = Number(node.attributes.cx || '0'); const ecy = Number(node.attributes.cy || '0'); diff --git a/plugins/convertStyleToAttrs.js b/plugins/convertStyleToAttrs.js index 5d5107d6f..662119e48 100644 --- a/plugins/convertStyleToAttrs.js +++ b/plugins/convertStyleToAttrs.js @@ -19,7 +19,7 @@ const rSingleQuotes = "'(?:[^'\\n\\r\\\\]|" + rEscape + ")*?(?:'|$)"; // string const rQuotes = '"(?:[^"\\n\\r\\\\]|' + rEscape + ')*?(?:"|$)'; // string in double quotes: "smth" const rQuotedString = new RegExp('^' + g(rSingleQuotes, rQuotes) + '$'); // Parentheses, E.g.: url(data:image/png;base64,iVBO...). -// ':' and ';' inside of it should be threated as is. (Just like in strings.) +// ':' and ';' inside of it should be treated as is. (Just like in strings.) const rParenthesis = '\\(' + g('[^\'"()\\\\]+', rEscape, rSingleQuotes, rQuotes) + '*?' + '\\)'; // The value. It can have strings and parentheses (see above). Fallbacks to anything in case of unexpected input. diff --git a/plugins/convertTransform.js b/plugins/convertTransform.js index 60e0214f5..b69e17a3f 100644 --- a/plugins/convertTransform.js +++ b/plugins/convertTransform.js @@ -131,7 +131,7 @@ const convertTransform = (item, attrName, params) => { * Defines precision to work with certain parts. * transformPrecision - for scale and four first matrix parameters (needs a better precision due to multiplying), * floatPrecision - for translate including two last matrix and rotate parameters, - * degPrecision - for rotate and skew. By default it's equal to (rougly) + * degPrecision - for rotate and skew. By default it's equal to (roughly) * transformPrecision - 2 or floatPrecision whichever is lower. Can be set in params. * * @type {(data: Array, params: TransformParams) => TransformParams} @@ -294,7 +294,7 @@ const convertToShorts = (transforms, params) => { /** * Remove useless transforms. * - * @type {(trasforms: Array) => Array} + * @type {(transforms: Array) => Array} */ const removeUseless = (transforms) => { return transforms.filter((transform) => { diff --git a/plugins/inlineStyles.js b/plugins/inlineStyles.js index a416f6e45..1cdcebe75 100644 --- a/plugins/inlineStyles.js +++ b/plugins/inlineStyles.js @@ -370,7 +370,7 @@ exports.fn = (root, params) => { // csstree v2 changed this type if (style.cssAst.children.isEmpty) { - // remove emtpy style element + // remove empty style element detachNodeFromParent(style.node, style.parentNode); } else { // update style element if any styles left diff --git a/plugins/plugins-types.d.ts b/plugins/plugins-types.d.ts index 8e3972c1c..0499f627f 100644 --- a/plugins/plugins-types.d.ts +++ b/plugins/plugins-types.d.ts @@ -110,7 +110,7 @@ type DefaultPlugins = { */ restructure?: boolean; /** - * Enables merging of @media rules with the same media query by splitted by other rules. + * Enables merging of @media rules with the same media query split by other rules. * The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk. * @default false */ diff --git a/plugins/removeXlink.js b/plugins/removeXlink.js index db55ab50b..d341b673e 100644 --- a/plugins/removeXlink.js +++ b/plugins/removeXlink.js @@ -72,7 +72,7 @@ exports.fn = (_, params) => { const xlinkPrefixes = []; /** - * Namespace prefixes that exist in {@link xlinkPrefixes} but were overriden + * Namespace prefixes that exist in {@link xlinkPrefixes} but were overridden * in a child element to point to another namespace, and so is not treated as * an XLink attribute. * diff --git a/test/svgo/_index.test.js b/test/svgo/_index.test.js index 5ac5013b6..e9a596d76 100644 --- a/test/svgo/_index.test.js +++ b/test/svgo/_index.test.js @@ -35,7 +35,7 @@ describe('svgo', () => { const result = optimize('', { input: 'file', path: 'input.svg' }); expect(result.data).toEqual(''); }); - it('should preserve style specifity over attributes', async () => { + it('should preserve style specificity over attributes', async () => { const [original, expected] = await parseFixture('style-specifity.svg'); const result = optimize(original, { input: 'file',