Skip to content

Commit c41968e

Browse files
committed
snippets / readme - updates
1 parent 14e6a77 commit c41968e

File tree

3 files changed

+70
-58
lines changed

3 files changed

+70
-58
lines changed

README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,35 @@ Extension for Visual Studio Code to add snippets for React in ECMA Script 6.
99
Type the snippet prefix and press enter.
1010

1111
```javascript
12-
u-ci // console.info
13-
u-ctor // class constructor
14-
u-impt // import module statement
15-
u-rfc // functional component (stateless)
16-
u-rcc // class component (statefull)
17-
u-it // Jest test `it`
18-
u-desc // Jest test `describe`
19-
u-suite // Jest test suite (with imports)
20-
u-pt // Generic PropType
21-
u-pts // String PropType
22-
u-ptn // Number PropType
23-
u-ptb // Bool PropType
24-
u-ptf // Func PropType
25-
u-pta // Array PropType
26-
u-pto // Object PropType
27-
u-pty // Symbol PropType
28-
u-pte // Element PropType
29-
u-ptd // Node PropType
30-
u-ptio // Instance Of (PropType)
31-
u-ptof // One Of (PropType)
32-
u-ptoft // One Of Type (PropType)
33-
u-ptao // Array Of (PropType)
34-
u-ptoo // Object Of (PropType)
35-
u-ptsh // Shape (PropType)
36-
u-ptany // Any PropType
37-
u-ptcustom // Custom PropType
38-
u-actions // Redux actions
39-
u-action // Redux action
12+
u-ci // console.info
13+
u-ctor // class constructor
14+
u-impt // import module statement
15+
u-rfc // functional component (stateless)
16+
u-rcc // class component (statefull)
17+
u-it // Jest test `it`
18+
u-desc // Jest test `describe`
19+
u-suite // Jest test suite (with imports)
20+
u-pt // Generic PropType
21+
u-pts // String PropType
22+
u-ptn // Number PropType
23+
u-ptb // Bool PropType
24+
u-ptf // Func PropType
25+
u-pta // Array PropType
26+
u-pto // Object PropType
27+
u-ptsymbol // Symbol PropType
28+
u-pte // Element PropType
29+
u-ptnode // Node PropType
30+
u-ptinstanceof // Instance Of (PropType)
31+
u-ptoneof // One Of (PropType)
32+
u-ptoneoftype // One Of Type (PropType)
33+
u-ptarrayof // Array Of (PropType)
34+
u-ptobjectof // Object Of (PropType)
35+
u-ptshape // Shape (PropType)
36+
u-ptany // Any PropType
37+
u-ptcustom // Custom PropType
38+
u-ptcustomarrayof // Custom ArrayOf PropType
39+
u-actions // Redux actions
40+
u-action // Redux action
4041
```
4142

4243
## Installation

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
2-
"name": "uruit-react-snippets",
3-
"displayName": "Uruit React Snippets",
4-
"description": "",
5-
"version": "0.0.1",
6-
"publisher": "UruIT",
7-
"icon": "./images/uruit-logo.png",
8-
"engines": {
9-
"vscode": "^1.13.0"
10-
},
11-
"categories": [
12-
"Snippets"
13-
],
14-
"contributes": {
15-
"snippets": [
16-
{
17-
"language": "javascript",
18-
"path": "./snippets/snippets.json"
19-
}
20-
]
21-
}
22-
}
2+
"name": "uruit-react-snippets",
3+
"displayName": "Uruit React Snippets",
4+
"description": "",
5+
"version": "0.0.1",
6+
"publisher": "UruIT",
7+
"icon": "./images/uruit-logo.png",
8+
"engines": {
9+
"vscode": "^1.13.0"
10+
},
11+
"categories": [
12+
"Snippets"
13+
],
14+
"contributes": {
15+
"snippets": [
16+
{
17+
"language": "javascript",
18+
"path": "./snippets/snippets.json"
19+
}
20+
]
21+
}
22+
}

snippets/snippets.json

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"description": "React PropType Object"
148148
},
149149
"PropTypes.Symbol": {
150-
"prefix": "u-pty",
150+
"prefix": "u-ptsymbol",
151151
"body": [
152152
"$1: PropTypes.symbol.isRequired$2"
153153
],
@@ -161,49 +161,49 @@
161161
"description": "React PropType Element"
162162
},
163163
"PropTypes.Node": {
164-
"prefix": "u-ptd",
164+
"prefix": "u-ptnode",
165165
"body": [
166166
"$1: PropTypes.node.isRequired$2"
167167
],
168168
"description": "React PropType Node"
169169
},
170170
"PropTypes.InstanceOf": {
171-
"prefix": "u-ptio",
171+
"prefix": "u-ptinstanceof",
172172
"body": [
173173
"$1: PropTypes.instanceOf($2)$3"
174174
],
175175
"description": "React PropType InstanceOf"
176176
},
177177
"PropTypes.OneOf": {
178-
"prefix": "u-ptof",
178+
"prefix": "u-ptoneof",
179179
"body": [
180180
"$1: PropTypes.oneOf([$2])$3"
181181
],
182182
"description": "React PropType OneOf"
183183
},
184184
"PropTypes.OneOfType": {
185-
"prefix": "u-ptoft",
185+
"prefix": "u-ptoneoftype",
186186
"body": [
187187
"$1: PropTypes.oneOfType([PropTypes.$2])$3"
188188
],
189189
"description": "React PropType OneOfType"
190190
},
191191
"PropTypes.ArrayOf": {
192-
"prefix": "u-ptao",
192+
"prefix": "u-ptarrayof",
193193
"body": [
194194
"$1: PropTypes.arrayOf(PropTypes.$2).isRequired$3"
195195
],
196196
"description": "React PropType ArrayOf"
197197
},
198198
"PropTypes.ObjectOf": {
199-
"prefix": "u-ptoo",
199+
"prefix": "u-ptobjectof",
200200
"body": [
201201
"$1: PropTypes.objectOf(PropTypes.$2).isRequired$3"
202202
],
203203
"description": "React PropType Object"
204204
},
205205
"PropTypes.Shape": {
206-
"prefix": "u-ptsh",
206+
"prefix": "u-ptshape",
207207
"body": [
208208
"$1: PropTypes.shape({$2}).isRequired$3"
209209
],
@@ -220,13 +220,24 @@
220220
"prefix": "u-ptcustom",
221221
"body": [
222222
"function (props, propName, componentName) {",
223-
"\tif (!/$1/.test(props[propName]) {",
223+
"\tif (!/$1/.test(props[propName])) {",
224224
"\t\treturn new Error(`Invalid prop '${propName}' supplied to '${componentName}'. Validation $2`);",
225225
"\t}",
226226
"}"
227227
],
228228
"description": "React PropType Any"
229229
},
230+
"PropTypes.CustomArrayProp": {
231+
"prefix": "u-ptcustomarrayof",
232+
"body": [
233+
"PropTypes.arrayOf(function (propValue, key, componentName, location, propFullName) {",
234+
"\tif (!/$1/.test(propValue[key])) {",
235+
"\t\treturn new Error(`Invalid prop '${propFullName}' supplied to '${componentName}'. Validation $2`);",
236+
"\t}",
237+
"})"
238+
],
239+
"description": "React PropType Any"
240+
},
230241
"Redux actions": {
231242
"prefix": "u-actions",
232243
"body": [

0 commit comments

Comments
 (0)