Skip to content

Instantly share code, notes, and snippets.

@cpsubrian
Last active January 6, 2016 21:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpsubrian/f19d47668d4f16938b52 to your computer and use it in GitHub Desktop.
Save cpsubrian/f19d47668d4f16938b52 to your computer and use it in GitHub Desktop.
SublimeText Setup for React Stuff

Using: Sublime Text 3

Packages:

  • Babel: Syntax definitions for ES6 + JSX
  • SublimeLinter: Linter framework for Sublime Text 3
  • SublimeLinter-contrib-standard: Linter supper for the 'standard' code style.

Guide to migrate from Sublime 2 to 3 (I think I referenced this): http://wesbos.com/migrating-to-sublime-text-3/

{
"auto_complete": false,
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai Extended (SL).tmTheme",
"font_face": "Source Code Pro",
"font_size": 13.0,
"ignored_packages":
[
"Vintage"
],
"margin": 2,
"rulers":
[
80
],
"show_full_path": true,
"tab_size": 2,
"theme": "Cola.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true
}
<snippet>
<content><![CDATA[
import React from 'react'
class ${1:${TM_FILENAME/(.?\w*)(?:\.\w+)*$/$1/g}} extends React.Component {
static propTypes = {
}
render () {
return (
${0:<div />}
)
}
}
export default ${1:${TM_FILENAME/(.?\w*)(?:\.\w+)*$/$1/g}}
]]></content>
<tabTrigger>rcc</tabTrigger>
<scope>source.js</scope>
<description>React: component skeleton</description>
</snippet>
<snippet>
<content><![CDATA[
import {
ACTION_CONSTANT,
ACTION_CONSTANT_SUCCESS,
ACTION_CONSTANT_FAILED
} from './'
// Simple action.
export function myAction (data) {
return {type: ACTION_CONSTANT, data}
}
// Thunk for async requests.
export function myThunkAction () {
return (dispatch, getState) => {
dispatch({type: types.ACTION_CONSTANT})
doTheThing((err, data) => {
if (err) {
dispatch({type: types.ACTION_CONSTANT_FAILED, err})
} else {
dispatch({type: types.ACTION_CONSTANT_SUCCESS, data})
}
})
}
}
]]></content>
<tabTrigger>rda</tabTrigger>
<scope>source.js</scope>
<description>Redux: action skeleton</description>
</snippet>
<snippet>
<content><![CDATA[
import {
ACTION_CONSTANT
} from '../actions'
const initialState = {}
const reducers = {
[ACTION_CONSTANT]: (state, action) => {
return state
}
}
export default function (state = initialState, action) {
if (reducers[action.type]) {
return reducers[action.type](state, action)
}
return state
}
]]></content>
<tabTrigger>rdr</tabTrigger>
<scope>source.js</scope>
<description>Redux: reducer skeleton</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment