This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
snippets.cson
234 lines (221 loc) · 5.7 KB
/
snippets.cson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson
'.source.js':
# Snippet StyleSheet
'style':
'prefix': 'styles'
'description': 'Create react-native Style file'
'body': """
import { StyleSheet } from 'react-native';
const styles = StyleSheet.create({
${1}
});
export default styles;
"""
# Snippet ApiSauce
'apisauce':
'prefix': 'apisauce'
'description': 'Create APISauce Config'
'body': """
import { create } from 'apisauce';
const api = create({
baseURL: '${1:http://localhost:3000}',
});
export default api;
"""
# Snippet Module Resolve
'moduleResolver':
'prefix': 'moduleResolver'
'description': 'Create Module Resolver config'
'body': """
"plugins": [
[
"module-resolver",
{
"root": ["./src"],
"extensions": [".js", ".ios.js", ".android.js"]
}
]
]
"""
# Snippet Component
'component':
'prefix': 'component'
'description': 'Create react-native component'
'body': """
/* Core */
import React, { Component } from 'react';
/* Presentational */
import { View } from 'react-native';
// import styles from './styles';
export default class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}} extends Component {
render() {
return (
<View />
);
}
}
"""
# Snippet Default props
'defaultprops':
'prefix': 'defaultprops'
'description': 'Create component defaultProps'
'body': """
static defaultProps = {
${1}
};
"""
# Snippet Eslint
'eslint':
'prefix': 'eslint'
'description': 'Create eslint file config'
'body': """
{
"parser": "babel-eslint",
"env": {
"browser": true,
"jest": true
},
"plugins": [
"react-native",
"jsx-a11y",
"import"
],
"extends": [
"airbnb",
"plugin:react-native/all"
],
"rules": {
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx"] }],
"global-require": "off",
"no-console": "off",
"import/prefer-default-export": "off",
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}]
},
"settings": {
"import/resolver": {
"babel-module": {}
}
},
"globals": {
"__DEV__": true
}
}
"""
# Snippet Method Render
'render':
'prefix': 'render'
'description': 'Create render method'
'body': """
render() {
return (
${1:<View />}
);
}
"""
# Snippet PropTypes
'proptypes':
'prefix': 'proptypes'
'description': 'Create component propTypes'
'body': """
static propTypes = {
${1}
};
"""
'teste':
'prefix': 'teste'
'description': 'teste de description'
'body': """
teste
"""
# Snippet mapDispatchToProps
'mapdispatchtoprops':
'prefix': 'mapdispatchtoprops'
'description': 'Create redux mapDispatchToProps'
'body': """
const mapDispatchToProps = dispatch => ({
${1}
});
"""
# Snippet mapStateToProps
'mapStateToProps':
'prefix': 'mapStateToProps'
'description': 'Create redux mapStateToProps'
'body': """
const mapStateToProps = state => ({
${1}
});
"""
# Snippet configureStore
'configureStore':
'prefix': 'configureStore'
'description': 'Create configureStore file'
'body': """
import { createStore, applyMiddleware, compose } from 'redux';
export default (rootReducer) => {
const middleware = [];
const enhancers = [];
/* Saga */
// const sagaMonitor = __DEV__ ? console.tron.createSagaMonitor() : null;
// const sagaMiddleware = createSagaMiddleware({ sagaMonitor });
// middleware.push(sagaMiddleware);
enhancers.push(applyMiddleware(...middleware));
/* Store */
const createAppropriateStore = __DEV__ ? console.tron.createStore : createStore;
const store = createAppropriateStore(rootReducer, compose(...enhancers));
/* Run Saga */
// sagaMiddleware.run(rootSaga);
return store;
};
"""
# Snippet reduxSetup
'setupredux':
'prefix': 'setupredux'
'description': 'Create Redux Setup file'
'body': """
import { combineReducers } from 'redux';
/* Reducers */
// import navReducer from 'navigation/reducer';
import configureStore from './configureStore';
// import rootSaga from './sagas';
export default () => {
const rootReducer = combineReducers({
// nav: navReducer,
});
return configureStore(rootReducer, rootSaga);
};
"""
# Snippet reactotronconfig
'reactotronconfig':
'prefix': 'reactotronconfig'
'description': 'Create Redux Setup file'
'body': """
import Reactotron from 'reactotron-react-native';
if (__DEV__) {
const tron = Reactotron
.configure()
.useReactNative()
.connect();
tron.clear();
console.tron = tron;
}
"""