Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created February 12, 2020 05:16
Show Gist options
  • Save jsmanifest/51fec66e521af051728902cd622aff2f to your computer and use it in GitHub Desktop.
Save jsmanifest/51fec66e521af051728902cd622aff2f to your computer and use it in GitHub Desktop.
{
"eslint disable line": {
"prefix": "eds",
"body": "// eslint-disable-line"
},
"eslint disable next line": {
"prefix": "ednl",
"body": "// eslint-disable-next-line"
},
"// @ts-ignore": {
"prefix": "tsg",
"body": "// @ts-ignore"
},
"beforeEach(() => {})": {
"prefix": "bfe",
"body": ["beforeEach(() => {", " $1", "})"]
},
"dispatch": {
"prefix": "dispatch",
"body": "dispatch({ type: '$1'$2 })"
},
"import react": {
"prefix": "reaa",
"body": "import React from 'react'"
},
"comment section": {
"prefix": "cs",
"body": [
"/* -------------------------------------------------------",
" ---- $1",
"-------------------------------------------------------- */"
]
},
"@param": {
"prefix": "@param",
"body": ["/**", " * @param { $1 } $2 - $3", " */"]
},
"ref": {
"prefix": "ref",
"body": "const $1 = React.useRef<any$2>()"
},
"const initialState = {}; reducer = (state, action)": {
"prefix": "rsr",
"body": [
"const initialState = {",
" //$1",
"}",
"",
"function reducer(state = initialState, action) {",
" switch (action.type) {",
" default:",
" return state",
" }",
"}"
]
},
"Form": {
"prefix": "rform",
"body": [
"<Form",
" onSubmit={onSubmit}",
" subscription={{",
" submitError: true,",
" }}",
" render={({ handleSubmit, submitError }) => (",
" <form onSubmit={handleSubmit}>",
" $1",
" </form>",
" )}",
"/>"
]
},
"immer": {
"prefix": "immer",
"body": ["import { useImmer } from 'use-immer'"]
},
"React.useState": {
"prefix": "ustate",
"body": ["const [$1, $2] = React.useState($3)"]
},
"React.useEffect": {
"prefix": "eff",
"body": ["React.useEffect(() => {", " $1", "}, [$2])"]
},
"React.useContext": {
"prefix": "ctx",
"body": ["const $1 = React.useContext($2)"]
},
"context": {
"prefix": "context",
"body": [
"import React from 'react'",
"// import { $1 } from './$1'",
"",
"const context = React.createContext<undefined | any>(undefined)",
"",
"export default context"
]
},
"context provider": {
"prefix": "provider",
"body": [
"import React from 'react'",
"import $1 from './$1'",
"",
"function $2({ children }: { children: React.ReactNode }) {",
" const ctx = {",
" // $3",
" }",
" return (",
" <$1.Provider value={undefined}>",
" {children}",
" </$1.Provider>",
" )",
"}",
"",
"export default $2"
]
},
"react-final-form": {
"prefix": "rff",
"body": ["import { Form, Field } from 'react-final-form'"]
},
"classnames": {
"prefix": "cx",
"body": "import cx from 'clsx'"
},
"typeof window !== 'undefined'": {
"prefix": "isbrowser",
"body": ["if (typeof window !== 'undefined') {", " $1", "}"]
},
"process.env.NODE_ENV === 'development'": {
"prefix": "isdev",
"body": ["if (process.env.NODE_ENV === 'development') {", " $1", "}"]
},
"import { useSelector, useDispatch } from 'react-redux'": {
"prefix": "rsd",
"body": "import { useSelector, useDispatch } from 'react-redux'"
},
"import isString from lodash/isString": {
"prefix": "isstr",
"body": "import isString from 'lodash/isString'"
},
"import isFunction from lodash/": {
"prefix": "isfnc",
"body": "import isFunction from 'lodash/isFunction'"
},
"import isUndefined from lodash/isUndefined": {
"prefix": "isund",
"body": "import isUndefined from 'lodash/isUndefined'"
},
"import isArray from lodash/isArray": {
"prefix": "isarr",
"body": "import isArray from 'lodash/isArray'"
},
"import isNaN from lodash/isNaN": {
"prefix": "isnan",
"body": "import isNaN from 'lodash/isNaN'"
},
"import isNumber": {
"prefix": "isnum",
"body": "import isNumber from 'lodash/isNumber'"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment