Skip to content

Commit cc48b77

Browse files
authored
fix: neglect use prefix in composables name (#170)
1 parent bb11ae9 commit cc48b77

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@
11091109
"changelogen": "^0.5.7",
11101110
"eslint": "^9.11.0",
11111111
"eslint-config-unjs": "^0.3.2",
1112-
"knip": "^5.30.2",
1112+
"knip": "^5.30.4",
11131113
"nuxi-nightly": "^3.14.0-20240921-193235-ef57bb1",
11141114
"taze": "^0.16.9",
11151115
"terser": "^5.33.0",

pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/composable.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { window } from 'vscode'
22
import { composableTemplate } from '../templates'
33
import { createDir, createFile, createSubFolders, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils'
44

5+
const neglectUsePrefix = (name: string) => name.replace(/^use/i, '')
6+
57
const createComposable = () => {
68
window
79
.showInputBox({
@@ -22,7 +24,7 @@ const createComposable = () => {
2224
name,
2325
subFolders,
2426
commandType: 'composables',
25-
content: composableTemplate(name),
27+
content: composableTemplate(neglectUsePrefix(name)),
2628
})
2729

2830
})
@@ -41,7 +43,7 @@ const directCreateComposable = (path: string) => {
4143

4244
createFile({
4345
fileName: `${name}.ts`,
44-
content: composableTemplate(name),
46+
content: composableTemplate(neglectUsePrefix(name)),
4547
fullPath: filePath,
4648
})
4749
})

0 commit comments

Comments
 (0)