Skip to content

Commit 9c8768f

Browse files
authored
ci: add spellcheck (#2101)
1 parent d06fffb commit 9c8768f

19 files changed

+125
-34
lines changed

.github/workflows/spellcheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check spelling
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
spellcheck:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: streetsidesoftware/cspell-action@v6
12+
with:
13+
incremental_files_only: true

cspell.jsonc

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3+
"version": "0.2",
4+
"words": [
5+
"Bézier",
6+
"crosspoint",
7+
"deoptimizations",
8+
"deoptimize",
9+
"deoptimized",
10+
"fontawesome",
11+
"Fontello",
12+
"Fonticons",
13+
"frontends",
14+
"inlines",
15+
"opencollective",
16+
"subpoint",
17+
"subselector",
18+
"xast",
19+
"Xlink",
20+
// Abbreviations
21+
"elems", // elements
22+
"unenc", // unencoded
23+
// SVG Keywords
24+
"currentcolor",
25+
// SVG Nodes / Attributes and CSS Properties, including plurals
26+
"bbox",
27+
"hkern",
28+
"horiz",
29+
"hrefs",
30+
"mpath",
31+
"onbegin",
32+
"onrepeat",
33+
"panose",
34+
"stemh",
35+
"stemv",
36+
"vkern",
37+
// Software
38+
"grunt-svgmin",
39+
"Inkscape",
40+
"SVGOMG",
41+
// NPM Packages
42+
"csstree",
43+
"csswhat",
44+
// Names
45+
"André",
46+
"Baranovskiy",
47+
"Dmitry",
48+
"Keerthi",
49+
],
50+
"ignorePaths": ["*.svg.txt", "*.svg", "cspell.jsonc", "LICENSE"],
51+
"ignoreRegExpList": [
52+
"-moz", // Mozilla Firefox CSS prefix
53+
"'.+?.svg',", // path to file with .svg extension
54+
"(?:xlink|sodipodi)(?::[a-z]+)?", // Common SVG namespaces
55+
"[a-z]+: '#[a-f\\d]+',", // Color names in _collection.js
56+
"[a-z]+…", // Words that have been cut off by an ellipsis
57+
"@author .+", // JSDoc author tag line, usually names
58+
"\"name\": .+", // package.json author name property
59+
"\\*\\*SVG O\\*\\*ptimizer", // README
60+
"\\b[aprs]data\\b",
61+
"&.+?;", // HTML entity
62+
"^svgo .+", // Command-line example of SVGO
63+
"<svg.+>", // Inline SVG in code
64+
"Atrule", // At-rule
65+
"data:image/.+", // Data URI
66+
"datauri", // Data URI
67+
"descs", // Abbreviation of "descriptions"
68+
"ENOCLS|ENOATTRS",
69+
"id=([\"']).+?\\1", // ID attribute of inline SVG
70+
"import .+", // Import statements in Javascript
71+
"newres",
72+
"nums", // Abbreviation of "numbers"
73+
"onwarn", // Rollup API,
74+
"QRAB|QRCD",
75+
"rrggbb",
76+
"sax\\..+", // Any properties of the sax API
77+
"shorthex", // Parameter of convertColors plugin
78+
],
79+
}

docs/04-plugins/cleanupIds.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ svgo:
1616
description: Elements with an ID that starts with one of these prefixes will be ignored.
1717
default: []
1818
force:
19-
description: This plugin normally does nothing if a `<script>` or `<style>` element is found. Setting this to true will bypass that behaviour, which may result in destructive changes.
19+
description: This plugin normally does nothing if a `<script>` or `<style>` element is found. Setting this to true will bypass that behavior, which may result in destructive changes.
2020
default: false
2121
defaultPlugin: true
2222
---

docs/04-plugins/convertPathData.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ svgo:
1616
description: If to convert curve commands that are effectively straight lines to line commands.
1717
default: true
1818
convertToQ:
19-
description: If to convert cubic beziers to quadratic beziers when they effectively are.
19+
description: If to convert cubic Bézier curves to quadratic Bézier curves when they effectively are.
2020
default: true
2121
lineShorthands:
2222
description: If to convert regular lines to an explicit horizontal or vertical line where possible.
@@ -63,7 +63,7 @@ You can get more context on path commands on [MDN Web Docs](https://developer.mo
6363
This plugin uses multiple techniques to either reduce the number of instructions or reduce the attribute length:
6464

6565
- Convert between relative or absolute coordinates, whichever is shortest.
66-
- Convert between commands. For example, a bézier curve that behaves like a straight line might as well use a line instruction.
66+
- Convert between commands. For example, a Bézier curve that behaves like a straight line might as well use a line instruction.
6767
- Remove redundant commands. For example, a command that moves to the current position can be removed.
6868
- Trim redundant delimiters and leading zeros.
6969
- Round numeric values using conventional rounding rules.

lib/parser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* @typedef {import('./types.js').XastChild} XastChild
1212
*/
1313

14-
// @ts-ignore sax will be replaced with something else later
1514
import SAX from 'sax';
1615
import { textElems } from '../plugins/_collections.js';
1716

lib/svgo.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export declare const builtinPlugins: Array<
6767
>;
6868

6969
export type Config = {
70-
/** Can be used by plugins, for example prefixids */
70+
/** Can be used by plugins, for example prefixIds */
7171
path?: string;
7272
/** Pass over SVGs multiple times to ensure all optimizations are applied. */
7373
multipass?: boolean;

lib/svgo.test.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { jest } from '@jest/globals';
22
import { optimize } from './svgo.js';
33

4-
/**
5-
* @typedef {import('../lib/types.js').Plugin} Plugin
6-
*/
7-
84
test('allow to setup default preset', () => {
95
const svg = `
106
<?xml version="1.0" encoding="utf-8"?>
@@ -353,9 +349,6 @@ test('slices long line in error code snippet', () => {
353349
test('multipass option should trigger plugins multiple times', () => {
354350
const svg = `<svg id="abcdefghijklmnopqrstuvwxyz"></svg>`;
355351
const list = [];
356-
/**
357-
* @type {Plugin<void>}
358-
*/
359352
const testPlugin = {
360353
name: 'testPlugin',
361354
fn: (_root, _params, info) => {

lib/svgo/tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const cleanupOutData = (data, params, command) => {
8989
// no extra space in front of first number
9090
if (i == 0) delimiter = '';
9191

92-
// no extra space after 'arcto' command flags(large-arc and sweep flags)
92+
// no extra space after arc command flags (large-arc and sweep flags)
9393
// a20 60 45 0 1 30 20 → a20 60 45 0130 20
9494
if (params.noSpaceAfterFlags && (command == 'A' || command == 'a')) {
9595
var pos = i % 7;

plugins/_collections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ export const pseudoClasses = {
23972397
'disabled',
23982398
'enabled',
23992399
'in-range',
2400-
'indetermined',
2400+
'indeterminate',
24012401
'invalid',
24022402
'optional',
24032403
'out-of-range',

plugins/_path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ function gatherPoints(pathData) {
564564

565565
case 'A':
566566
if (basePoint != null) {
567-
// Convert the arc to bezier curves and use the same approximation
567+
// Convert the arc to Bézier curves and use the same approximation
568568
// @ts-ignore no idea what's going on here
569569
var curves = a2c.apply(0, basePoint.concat(data));
570570
for (

0 commit comments

Comments
 (0)