Skip to content

Commit 101d02d

Browse files
committed
ci: add spellcheck
1 parent d06fffb commit 101d02d

File tree

8 files changed

+76
-14
lines changed

8 files changed

+76
-14
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: false

cspell.jsonc

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3+
"version": "0.2",
4+
"words": [
5+
"André", // Name
6+
"beziers",
7+
"csstree", // https://www.npmjs.com/package/css-tree
8+
"csswhat", // https://www.npmjs.com/package/css-what
9+
"currentcolor", // SVG keyword
10+
"deoptimized",
11+
"elems", // Abbreviation for "elements"
12+
"fontawesome",
13+
"Fontello",
14+
"Fonticons",
15+
"frontends",
16+
"grunt-svgmin",
17+
"hkern",
18+
"hrefs",
19+
"Inkscape", // https://inkscape.org/
20+
"inlines",
21+
"panose",
22+
"stemh",
23+
"stemv",
24+
"subselector",
25+
"SVGOMG", // https://jakearchibald.github.io/svgomg/
26+
"unenc", // Abbreviation for "unencoded"
27+
"viewbox", // SVG keyword
28+
"vkern",
29+
"xast",
30+
"Xlink",
31+
],
32+
"ignorePaths": ["*.svg.txt", "*.svg"],
33+
"ignoreRegExpList": [
34+
"-moz", // Mozilla Firefox CSS prefix
35+
"'.+?.svg',", // path to file with .svg extension
36+
"[a-z]+: '#[a-f\\d]+',", // Color names in _collection.js
37+
"[a-z]+…", // Words that have been cut off by an ellipsis
38+
"@author .+", // JSDoc author tag line, usually names
39+
"\"name\": .+", // package.json author name property
40+
"\\*\\*SVG O\\*\\*ptimizer", // README
41+
"&.+?;", // HTML entity
42+
"<svg.+>", // Inline SVG in code
43+
"Atrule", // At-rule
44+
"data:image/.+", // Data URI
45+
"datauri", // Data URI
46+
"descs", // Abbreviation of "descriptions"
47+
"id=([\"']).+?\\1", // ID attribute of inline SVG
48+
"import .+", // Import statements in Javascript
49+
"nums", // Abbreviation of "numbers"
50+
"onwarn", // Rollup API,
51+
"QRAB|QRCD",
52+
"rrggbb",
53+
"sax\\..+", // Any properties of the sax API
54+
"shorthex", // Parameter of convertColors plugin
55+
"sodipodi(?::[a-z]+)?", // https://wikipedia.org/wiki/Sodipodi
56+
],
57+
}

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
---

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.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) => {

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/minifyStyles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const fn = (_root, { usage, ...params }) => {
5858
return {
5959
element: {
6060
enter: (node, parentNode) => {
61-
// detect deoptimisations
61+
// detect deoptimizations
6262
if (hasScripts(node)) {
6363
deoptimized = true;
6464
}
@@ -115,7 +115,7 @@ export const fn = (_root, { usage, ...params }) => {
115115
}
116116

117117
// preserve cdata if necessary
118-
// TODO split cdata -> text optimisation into separate plugin
118+
// TODO split cdata -> text optimization into separate plugin
119119
if (cssText.indexOf('>') >= 0 || cssText.indexOf('<') >= 0) {
120120
styleNode.children[0].type = 'cdata';
121121
styleNode.children[0].value = minified;

plugins/plugins-types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ type DefaultPlugins = {
108108

109109
minifyStyles: {
110110
/**
111-
* Disable or enable a structure optimisations.
111+
* Disable or enable a structure optimizations.
112112
* @default true
113113
*/
114114
restructure?: boolean;
115115
/**
116116
* Enables merging of @media rules with the same media query split by other rules.
117-
* The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
117+
* The optimization is unsafe in general, but should work fine in most cases. Use it on your own risk.
118118
* @default false
119119
*/
120120
forceMediaMerge?: boolean;

0 commit comments

Comments
 (0)