Skip to content

Commit

Permalink
feat: Add pinia snippets (#13)
Browse files Browse the repository at this point in the history
* Add pinia snippets #4
Snippets list:
- pstore

Co-authored-by: Daniel Kelly <me@danielkelly.io>
  • Loading branch information
ExEr7um and danielkellyio committed Aug 7, 2022
1 parent 765a428 commit 927cced
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
{
"language": "typescript",
"path": "./snippets/vue-script.code-snippets"
},
{
"language": "javascript",
"path": "./snippets/pinia.code-snippets"
},
{
"language": "typescript",
"path": "./snippets/pinia.code-snippets"
}
]
}
Expand Down
22 changes: 22 additions & 0 deletions snippets/pinia.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Pinia Store Base": {
"prefix": "pstore",
"body": [
"import { defineStore, acceptHMRUpdate } from \"pinia\"",
"",
"export const use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store = defineStore(\"$TM_FILENAME_BASE\", {",
"\tstate: () => ({",
"\t\t$0",
"\t}),",
"\tgetters: {},",
"\tactions: {},",
"})",
"",
"if (import.meta.hot) {",
"\timport.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store, import.meta.hot))",
"}",
""
],
"description": "Base code needed for a Pinia store file"
}
}

0 comments on commit 927cced

Please sign in to comment.