Skip to content

Commit a31ac4c

Browse files
committed
remove react prop types snippets
Hopefully no one is writing these anymore
1 parent 2a098b5 commit a31ac4c

File tree

7 files changed

+39
-335
lines changed

7 files changed

+39
-335
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"workbench.colorCustomizations": {}
2+
"workbench.colorCustomizations": {},
3+
"cSpell.words": [
4+
"desctructured"
5+
]
36
}

README.md

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ async (${1:arguments}) => {
270270

271271
#### `aiife⇥` async immediately-invoked function expression
272272

273-
very useful when you don't have top level await(node 16 and lower)
273+
very useful when you don't have top level await(node 16 and lower)
274274

275275
```js
276276
;(async (${1:arguments}) => {
@@ -284,6 +284,12 @@ very useful when you don't have top level await(node 16 and lower)
284284
(${1:arguments}) => ${2:statement}
285285
```
286286

287+
#### `afi⇥` arrow function identity
288+
289+
```js
290+
;(v) => v
291+
```
292+
287293
#### `fd⇥` arrow function with destructuring
288294

289295
```js
@@ -312,6 +318,14 @@ very useful when you don't have top level await(node 16 and lower)
312318
}
313319
```
314320

321+
#### `fro⇥` arrow function with single returned object
322+
323+
```js
324+
(${1:arguments}) => ({
325+
${0}
326+
})
327+
```
328+
315329
#### `gf⇥` generator function (ES6)
316330

317331
```js
@@ -346,6 +360,12 @@ ${1:iterable}.map((${2:item}) => {
346360
})
347361
```
348362

363+
#### `mapsd⇥` map single desctructured argument
364+
365+
```js
366+
${1:iterable}.map((${2:item}) => ${2:item})
367+
```
368+
349369
#### `reduce⇥` reduce function
350370

351371
```js
@@ -915,7 +935,6 @@ ${1:emitter}.on('${2:event}', (${3:arguments}) => {
915935

916936
```js
917937
'use strict'
918-
919938
```
920939

921940
#### `js⇥` JSON Stringify
@@ -1055,39 +1074,3 @@ There are also snippets to be triggered with a text selection(trigger via insert
10551074
```
10561075
jsx element wrap selection
10571076
```
1058-
1059-
The following table lists all the snippets that can be used for prop types.
1060-
Every snippet regarding prop types begins with `pt` so it's easy to group it all together and explore all the available options.
1061-
On top of that each prop type snippets has one equivalent when we need to declare that this property is also required.
1062-
For example `pta` creates the `PropTypes.array` and `ptar` creates the `PropTypes.array.isRequired`
1063-
1064-
| Trigger | Content |
1065-
| ------- | ------------------------------------------------------------------------------------ |
1066-
| `pta` | `PropTypes.array,` |
1067-
| `ptar` | `PropTypes.array.isRequired,` |
1068-
| `ptb` | `PropTypes.bool,` |
1069-
| `ptbr` | `PropTypes.bool.isRequired,` |
1070-
| `ptf` | `PropTypes.func,` |
1071-
| `ptfr` | `PropTypes.func.isRequired,` |
1072-
| `ptn` | `PropTypes.number,` |
1073-
| `ptnr` | `PropTypes.number.isRequired,` |
1074-
| `pto` | `PropTypes.object.,` |
1075-
| `ptor` | `PropTypes.object.isRequired,` |
1076-
| `pts` | `PropTypes.string,` |
1077-
| `ptsr` | `PropTypes.string.isRequired,` |
1078-
| `ptnd` | `PropTypes.node,` |
1079-
| `ptndr` | `PropTypes.node.isRequired,` |
1080-
| `ptel` | `PropTypes.element,` |
1081-
| `ptelr` | `PropTypes.element.isRequired,` |
1082-
| `pti` | `PropTypes.instanceOf(ClassName),` |
1083-
| `ptir` | `PropTypes.instanceOf(ClassName).isRequired,` |
1084-
| `pte` | `PropTypes.oneOf(['News', 'Photos']),` |
1085-
| `pter` | `PropTypes.oneOf(['News', 'Photos']).isRequired,` |
1086-
| `ptet` | `PropTypes.oneOfType([PropTypes.string, PropTypes.number]),` |
1087-
| `ptetr` | `PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,` |
1088-
| `ptao` | `PropTypes.arrayOf(PropTypes.number),` |
1089-
| `ptaor` | `PropTypes.arrayOf(PropTypes.number).isRequired,` |
1090-
| `ptoo` | `PropTypes.objectOf(PropTypes.number),` |
1091-
| `ptoor` | `PropTypes.objectOf(PropTypes.number).isRequired,` |
1092-
| `ptsh` | `PropTypes.shape({color: PropTypes.string, fontSize: PropTypes.number}),` |
1093-
| `ptshr` | `PropTypes.shape({color: PropTypes.string, fontSize: PropTypes.number}).isRequired,` |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "JavaScript standardjs styled snippets",
44
"publisher": "capaj",
55
"icon": "images/javascript.png",
6-
"version": "0.8.15",
6+
"version": "0.9.0",
77
"description": "standardjs styled javascript snippets for visual studio code",
88
"repository": {
99
"type": "git",

snippets/apollo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"prefix": "uq",
44
"body": ["const { data, loading } = use${1:query}Query()"],
55
"description": "useQuery"
6-
},
6+
},
77
"useQuery for component": {
88
"prefix": "uqc",
99
"body": ["const { data, loading } = use${TM_FILENAME_BASE}Query()"],
@@ -12,7 +12,7 @@
1212
"useMutation": {
1313
"prefix": "um",
1414
"body": [
15-
"const [${1:mutationName}, {loading}] = use${1:mutationName}Mutation()"
15+
"const [${1:mutationName}, {loading}] = use${1:/upcase}Mutation()"
1616
],
1717
"description": "useMutation"
1818
},

snippets/javascript.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@
215215
"prefix": "map",
216216
"body": "${1:iterable}.map((${2:item}) => {\n\t${0}\n})"
217217
},
218+
"map single desctructured argument": {
219+
"prefix": "mapsd",
220+
"body": "${1:iterable}.map(({${2:item}}) => ${2:item})"
221+
},
218222
"reduce": {
219223
"prefix": "reduce",
220224
"body": "${1:iterable}.reduce((${2:previous}, ${3:current}) => {\n\t${0}\n}${4:, initial})"
@@ -336,7 +340,7 @@
336340
"body": "import ${2:*} as ${3:name} from '${1:module}'"
337341
},
338342
"import module destructured": {
339-
"prefix": "id",
343+
"prefix": "imd",
340344
"body": "import {$2} from '${1:module}'"
341345
},
342346
"typeof": {
@@ -439,6 +443,10 @@
439443
"prefix": "af",
440444
"body": "(${1:arguments}) => ${2:statement}"
441445
},
446+
"identity arrow function": {
447+
"prefix": "afi",
448+
"body": "(v) => v"
449+
},
442450
"arrow function with destructuring": {
443451
"prefix": "fd",
444452
"body": "({${1:arguments}}) => ${2:statement}"

snippets/react-ts.json

Lines changed: 1 addition & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -112,151 +112,6 @@
112112
"body": "this.state.$0",
113113
"description": "Access component's state"
114114
},
115-
"propTypes": {
116-
"prefix": "rpt",
117-
"body": "$1.propTypes = {\n\t$2\n}",
118-
"description": "Creates empty propTypes declaration"
119-
},
120-
"propTypeArray": {
121-
"prefix": "pta",
122-
"body": "PropTypes.array,",
123-
"description": "Array prop type"
124-
},
125-
"propTypeArrayRequired": {
126-
"prefix": "ptar",
127-
"body": "PropTypes.array.isRequired,",
128-
"description": "Array prop type required"
129-
},
130-
"propTypeBool": {
131-
"prefix": "ptb",
132-
"body": "PropTypes.bool,",
133-
"description": "Bool prop type"
134-
},
135-
"propTypeBoolRequired": {
136-
"prefix": "ptbr",
137-
"body": "PropTypes.bool.isRequired,",
138-
"description": "Bool prop type required"
139-
},
140-
"propTypeFunc": {
141-
"prefix": "ptf",
142-
"body": "PropTypes.func,",
143-
"description": "Func prop type"
144-
},
145-
"propTypeFuncRequired": {
146-
"prefix": "ptfr",
147-
"body": "PropTypes.func.isRequired,",
148-
"description": "Func prop type required"
149-
},
150-
"propTypeNumber": {
151-
"prefix": "ptn",
152-
"body": "PropTypes.number,",
153-
"description": "Number prop type"
154-
},
155-
"propTypeNumberRequired": {
156-
"prefix": "ptnr",
157-
"body": "PropTypes.number.isRequired,",
158-
"description": "Number prop type required"
159-
},
160-
"propTypeObject": {
161-
"prefix": "pto",
162-
"body": "PropTypes.object,",
163-
"description": "Object prop type"
164-
},
165-
"propTypeObjectRequired": {
166-
"prefix": "ptor",
167-
"body": "PropTypes.object.isRequired,",
168-
"description": "Object prop type required"
169-
},
170-
"propTypeString": {
171-
"prefix": "pts",
172-
"body": "PropTypes.string,",
173-
"description": "String prop type"
174-
},
175-
"propTypeStringRequired": {
176-
"prefix": "ptsr",
177-
"body": "PropTypes.string.isRequired,",
178-
"description": "String prop type required"
179-
},
180-
"propTypeNode": {
181-
"prefix": "ptnd",
182-
"body": "PropTypes.node,",
183-
"description": "Anything that can be rendered: numbers, strings, elements or an array"
184-
},
185-
"propTypeNodeRequired": {
186-
"prefix": "ptndr",
187-
"body": "PropTypes.node.isRequired,",
188-
"description": "Anything that can be rendered: numbers, strings, elements or an array required"
189-
},
190-
"propTypeElement": {
191-
"prefix": "ptel",
192-
"body": "PropTypes.element,",
193-
"description": "React element prop type"
194-
},
195-
"propTypeElementRequired": {
196-
"prefix": "ptelr",
197-
"body": "PropTypes.element.isRequired,",
198-
"description": "React element prop type required"
199-
},
200-
"propTypeInstanceOf": {
201-
"prefix": "pti",
202-
"body": "PropTypes.instanceOf($0),",
203-
"description": "Is an instance of a class prop type"
204-
},
205-
"propTypeInstanceOfRequired": {
206-
"prefix": "ptir",
207-
"body": "PropTypes.instanceOf($0).isRequired,",
208-
"description": "Is an instance of a class prop type required"
209-
},
210-
"propTypeEnum": {
211-
"prefix": "pte",
212-
"body": "PropTypes.oneOf(['$0']),",
213-
"description": "Prop type limited to specific values by treating it as an enum"
214-
},
215-
"propTypeEnumRequired": {
216-
"prefix": "pter",
217-
"body": "PropTypes.oneOf(['$0']).isRequired,",
218-
"description": "Prop type limited to specific values by treating it as an enum required"
219-
},
220-
"propTypeOneOfType": {
221-
"prefix": "ptet",
222-
"body": "PropTypes.oneOfType([\n\t$0\n]),",
223-
"description": "An object that could be one of many types"
224-
},
225-
"propTypeOneOfTypeRequired": {
226-
"prefix": "ptetr",
227-
"body": "PropTypes.oneOfType([\n\t$0\n]).isRequired,",
228-
"description": "An object that could be one of many types required"
229-
},
230-
"propTypeArrayOf": {
231-
"prefix": "ptao",
232-
"body": "PropTypes.arrayOf($0),",
233-
"description": "An array of a certain type"
234-
},
235-
"propTypeArrayOfRequired": {
236-
"prefix": "ptaor",
237-
"body": "PropTypes.arrayOf($0).isRequired,",
238-
"description": "An array of a certain type required"
239-
},
240-
"propTypeObjectOf": {
241-
"prefix": "ptoo",
242-
"body": "PropTypes.objectOf($0),",
243-
"description": "An object with property values of a certain type"
244-
},
245-
"propTypeObjectOfRequired": {
246-
"prefix": "ptoor",
247-
"body": "PropTypes.objectOf($0).isRequired,",
248-
"description": "An object with property values of a certain type required"
249-
},
250-
"propTypeShape": {
251-
"prefix": "ptsh",
252-
"body": "PropTypes.shape({\n\t$0\n}),",
253-
"description": "An object taking on a particular shape"
254-
},
255-
"propTypeShapeRequired": {
256-
"prefix": "ptshr",
257-
"body": "PropTypes.shape({\n\t$0\n}).isRequired,",
258-
"description": "An object taking on a particular shape required"
259-
},
260115
"jsx element": {
261116
"prefix": "j",
262117
"body": "<${1:elementName}>\n\t$0\n</${1}>",
@@ -284,7 +139,7 @@
284139
},
285140
"useState": {
286141
"prefix": "us",
287-
"body": "const [${0:val}, set${1:setterName}] = useState(${2:defVal})",
142+
"body": "const [${1}, set${1/(^[a-zA-Z])(.*)/${1:/upcase}${2}/}] = useState(${2:default${1/(^[a-zA-Z])(.*)/${1:/upcase}${2}/}});",
288143
"description": "use state hook"
289144
},
290145
"useEffect": {

0 commit comments

Comments
 (0)