vim-ultisnips-react

Vim UltiSnips snippets for React using modern ES6 syntax

You must follow the convention: MyComponent's source file is MyComponent.js and the test for it is MyComponent.spec.js or MyComponent.test.js in the same directory. This allows to generate variables and classes

Snippets r...

Snippets for react components

  • rc - boilerplate for React Component
  • rcf - boilerplate for React Component as pure Function
  • rfdn - React.findDOMNode
  • rpt... - PropTypes records
    • rptr - PropTypes.[$1].isRequired
    • rptar - PropTypes.array.isRequired
    • rptbr - PropTypes.bool.isRequired
    • rptfr - PropTypes.func.isRequired
    • rptnr - PropTypes.nnumber.isRequired
    • rptor - PropTypes.object.isRequired
    • rptsr - PropTypes.string.isRequired
    • rpter - PropTypes.element.isRequired

Other types will be (or won't be) implemented soon. Pull requests are welcome

Snippets rt...

Snippets for react tests.

  • rtc - creates test boilerplate for Component
  • rtr - TestUtils.renderIntoDocument
  • rtfrdct - TestUtils.findRenderedDOMComponentWithTag
  • rtfrdcc - TestUtils.findRenderedDOMComponentWithClass
  • rtfrct - TestUtils.findRenderedComponentWithType
  • rtsrdct - TestUtils.scryRenderedDOMComponentsWithTag
  • rtsrdcc - TestUtils.scryRenderedDOMComponentsWithClass
  • rtsrct - TestUtils.scryRenderedComponentsWithType

Installation

Using Vundle:

" install UltiSnips
Plugin 'SirVer/ultisnips'
"let g:UltiSnipsExpandTrigger="<C-J>" "(optional) CTRL-J instead of TAB to avoid conflicts with YCM
Plugin 'alexbyk/vim-ultisnips-react'