Skip to content

Instantly share code, notes, and snippets.

@Zyst
Created April 26, 2018 15:20
Show Gist options
  • Save Zyst/45d55d2be34ca4110ab0bf336b0f3964 to your computer and use it in GitHub Desktop.
Save Zyst/45d55d2be34ca4110ab0bf336b0f3964 to your computer and use it in GitHub Desktop.
My JS VS Code snippets
{
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
},
"i18n entry": {
"prefix": "i18n",
"body": [
"$1: {",
" id: '${2:parent}.${3:feature}.$1',",
" defaultMessage: '$5'",
"},$0"
]
},
"Formatted Message": {
"prefix": "fm",
"body": "<FormattedMessage {...i18n.targeting.$1} />,$0"
},
"jest describe": {
"prefix": "desc",
"body": [
"describe('${1:Describe}', () => {",
" $0",
"});"
]
},
"jest it": {
"prefix": "it",
"body": [
"it('${1:Should}', () => {",
" $0",
"});"
]
},
"Create test": {
"prefix": "crte",
"body": [
"import React from 'react';",
"import { shallow } from 'enzyme';",
"import $1 from './$1';",
"",
"describe('<$1 />', () => {",
" it('Should render as expected', () => {",
" const wrapper = shallow(<$1 $0 />);",
"",
" expect(wrapper).toMatchSnapshot();",
" });",
"});"
]
},
"const {} = require();": {
"prefix": "cdr",
"body": "const { $2 } = require('$1');$0"
},
"route": {
"prefix": "rou",
"body": [
"{",
" prop: 'vehicle.$1',",
" route: $2",
"},$0"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment