Skip to content

Commit 907dd84

Browse files
authored
fix(cli): Avoid unnecessary interpolation in component template (#145)
No need for `<h2>{'UserProfile'}</h2>`. Just `<h2>UserProfile</h2>` is better.
1 parent 4be195e commit 907dd84

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

packages/cli/src/commands/generate/component/__tests__/__snapshots__/component.test.ts.snap

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ exports[`creates a TS component and test 1`] = `
44
"const TypescriptUser = () => {
55
return (
66
<div>
7-
<h2>{'TypescriptUser'}</h2>
8-
<p>
9-
{'Find me in ./web/src/components/TypescriptUser/TypescriptUser.tsx'}
10-
</p>
7+
<h2>TypescriptUser</h2>
8+
<p>Find me in ./web/src/components/TypescriptUser/TypescriptUser.tsx</p>
119
</div>
1210
)
1311
}
@@ -38,8 +36,8 @@ exports[`creates a multi word component 1`] = `
3836
"const UserProfile = () => {
3937
return (
4038
<div>
41-
<h2>{'UserProfile'}</h2>
42-
<p>{'Find me in ./web/src/components/UserProfile/UserProfile.jsx'}</p>
39+
<h2>UserProfile</h2>
40+
<p>Find me in ./web/src/components/UserProfile/UserProfile.jsx</p>
4341
</div>
4442
)
4543
}
@@ -91,8 +89,8 @@ exports[`creates a single word component 1`] = `
9189
"const User = () => {
9290
return (
9391
<div>
94-
<h2>{'User'}</h2>
95-
<p>{'Find me in ./web/src/components/User/User.jsx'}</p>
92+
<h2>User</h2>
93+
<p>Find me in ./web/src/components/User/User.jsx</p>
9694
</div>
9795
)
9896
}

packages/cli/src/commands/generate/component/templates/component.tsx.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const ${pascalName} = () => {
22
return (
33
<div>
4-
<h2>{'${pascalName}'}</h2>
5-
<p>{'Find me in ${outputPath}'}</p>
4+
<h2>${pascalName}</h2>
5+
<p>Find me in ${outputPath}</p>
66
</div>
77
)
88
}

0 commit comments

Comments
 (0)