Skip to content

Commit 4e46a5d

Browse files
committed
feat: remove "svgAttributes" option
BREAKING CHANGE: `svgAttributes` has been removed, please use `svgProps` instead. Closes #173
1 parent cbee51c commit 4e46a5d

14 files changed

Lines changed: 0 additions & 244 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ Options:
109109
--ref forward ref to SVG root element
110110
--no-dimensions remove width and height from root SVG tag
111111
--no-expand-props disable props expanding
112-
--svg-attributes <property=value> add attributes to the svg element (deprecated)
113112
--svg-props <property=value> add props to the svg element
114113
--replace-attr-values <old=new> replace an attribute value
115114
--template <file> specify a custom template to use

packages/cli/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Options:
2828
--ref forward ref to SVG root element
2929
--no-dimensions remove width and height from root SVG tag
3030
--no-expand-props disable props expanding
31-
--svg-attributes <property=value> add attributes to the svg element (deprecated)
3231
--svg-props <property=value> add props to the svg element
3332
--replace-attr-values <old=new> replace an attribute value
3433
--template <file> specify a custom template to use

packages/cli/src/__snapshots__/index.test.js.snap

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -313,20 +313,6 @@ export default SvgFile
313313
"
314314
`;
315315

316-
exports[`cli should support various args: --svg-attributes "focusable=false" 1`] = `
317-
"import React from 'react'
318-
319-
const SvgFile = props => (
320-
<svg focusable=\\"false\\" width={48} height={1} {...props}>
321-
<path d=\\"M0 0h48v1H0z\\" fill=\\"#063855\\" fillRule=\\"evenodd\\" />
322-
</svg>
323-
)
324-
325-
export default SvgFile
326-
327-
"
328-
`;
329-
330316
exports[`cli should support various args: --svg-props "hidden={true}" 1`] = `
331317
"import React from 'react'
332318

packages/cli/src/index.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ program
5454
.option('--ref', 'forward ref to SVG root element')
5555
.option('--no-dimensions', 'remove width and height from root SVG tag')
5656
.option('--no-expand-props', 'disable props expanding')
57-
.option(
58-
'--svg-attributes <property=value>',
59-
'add attributes to the svg element (deprecated)',
60-
parseObject,
61-
)
6257
.option(
6358
'--svg-props <property=value>',
6459
'add props to the svg element',
@@ -146,15 +141,6 @@ async function run() {
146141
}
147142
}
148143

149-
// TODO remove in v3
150-
if (program.outDir && program.svgAttributes) {
151-
console.log(
152-
chalk.yellow(
153-
'--svg-attributes option is deprecated an will be removed in v3, please use --svg-props instead',
154-
),
155-
)
156-
}
157-
158144
const command = program.outDir ? dirCommand : fileCommand
159145
await command(program, filenames, config)
160146
}

packages/cli/src/index.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ describe('cli', () => {
126126
['--native --ref'],
127127
['--ref'],
128128
['--replace-attr-values "#063855=currentColor"'],
129-
['--svg-attributes "focusable=false"'],
130129
[`--svg-props "hidden={true}"`],
131130
['--no-svgo'],
132131
['--no-prettier'],

packages/core/src/__snapshots__/convert.test.js.snap

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -227,27 +227,6 @@ export default SvgComponent
227227
"
228228
`;
229229

230-
exports[`convert config should support options { svgAttributes: { focusable: false } } 1`] = `
231-
"import React from 'react'
232-
233-
const SvgComponent = props => (
234-
<svg focusable=\\"false\\" width={88} height={88} {...props}>
235-
<g
236-
stroke=\\"#063855\\"
237-
strokeWidth={2}
238-
fill=\\"none\\"
239-
fillRule=\\"evenodd\\"
240-
strokeLinecap=\\"square\\"
241-
>
242-
<path d=\\"M51 37L37 51M51 51L37 37\\" />
243-
</g>
244-
</svg>
245-
)
246-
247-
export default SvgComponent
248-
"
249-
`;
250-
251230
exports[`convert config should support options { svgo: false } 1`] = `
252231
"import React from 'react'
253232
@@ -310,19 +289,6 @@ export default SvgComponent
310289
"
311290
`;
312291

313-
exports[`convert config svgAttribute 1`] = `
314-
"import React from 'react'
315-
316-
const SvgComponent = props => (
317-
<svg {...props}>
318-
<path d=\\"M0 0h24v24H0z\\" fill=\\"none\\" />
319-
</svg>
320-
)
321-
322-
export default SvgComponent
323-
"
324-
`;
325-
326292
exports[`convert config titleProp 1`] = `
327293
"import React from 'react'
328294

packages/core/src/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const DEFAULT_CONFIG = {
1010
prettierConfig: null,
1111
ref: false,
1212
replaceAttrValues: null,
13-
svgAttributes: null,
1413
svgProps: null,
1514
svgo: true,
1615
svgoConfig: null,

packages/core/src/config.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ Object {
4949
"ref": false,
5050
"replaceAttrValues": null,
5151
"runtimeConfig": true,
52-
"svgAttributes": null,
5352
"svgProps": null,
5453
"svgo": true,
5554
"svgoConfig": null,
@@ -82,7 +81,6 @@ Object {
8281
],
8382
],
8483
"runtimeConfig": true,
85-
"svgAttributes": null,
8684
"svgProps": null,
8785
"svgo": true,
8886
"svgoConfig": null,
@@ -115,7 +113,6 @@ Object {
115113
],
116114
],
117115
"runtimeConfig": true,
118-
"svgAttributes": null,
119116
"svgProps": null,
120117
"svgo": true,
121118
"svgoConfig": null,
@@ -149,7 +146,6 @@ Object {
149146
],
150147
],
151148
"runtimeConfig": true,
152-
"svgAttributes": null,
153149
"svgProps": null,
154150
"svgo": true,
155151
"svgoConfig": null,

packages/core/src/convert.test.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ describe('convert', () => {
220220
[{ native: true, ref: true }],
221221
[{ ref: true }],
222222
[{ replaceAttrValues: { none: 'black' } }],
223-
[{ svgAttributes: { focusable: false } }],
224223
[{ svgo: false }],
225224
[{ prettier: false }],
226225
[{ template: () => 'nothing' }],
@@ -232,14 +231,6 @@ describe('convert', () => {
232231
expect(result).toMatchSnapshot()
233232
})
234233

235-
it('svgAttribute', async () => {
236-
const svg = `<svg><path d="M0 0h24v24H0z" fill="none" /></svg>`
237-
238-
expect(
239-
await convert(svg, { svgAttribute: { focusable: false } }),
240-
).toMatchSnapshot()
241-
})
242-
243234
it('titleProp', async () => {
244235
const svg = `
245236
<svg width="0" height="0" style="position:absolute">

packages/core/src/h2x/__snapshots__/svgAttributes.test.js.snap

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)