Skip to content

Commit 92e8ffa

Browse files
author
Nick Plekhanov
committed
Initial commit
0 parents commit 92e8ffa

File tree

6 files changed

+302
-0
lines changed

6 files changed

+302
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
indent_style = space
11+
indent_size = 2
12+
trim_trailing_whitespace = true
13+
insert_final_newline = true
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
node_modules
3+
npm-debug.log

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Nick S. Plekhanov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Mighty React & Redux Snippets
2+
3+
Atom editor snippets for React and Redux. Made to be compliant with the latest & hottest ES6 and ES7 standards.
4+
5+
**Add the Airbnb's ESLint config to your project (optional)**
6+
7+
```sh
8+
npm install --save-dev eslint-config-airbnb babel-eslint eslint-plugin-react eslint
9+
echo '\''{ extends: [airbnb], }'\'' > .eslintrc'
10+
```
11+
12+
## Installation
13+
14+
```sh
15+
apm install mighty-react-snippets
16+
```
17+
18+
## Features
19+
20+
- [x] React Snippets
21+
- [ ] React Router Snippets
22+
- [ ] Redux Snippets
23+
24+
## Contributing
25+
26+
1. Fork repo
27+
1. Create your feature branch: `git checkout -b my-cool-feature`
28+
1. Commit your changes: `git commit -m 'Add cool feature'`
29+
1. Push changes: `git push origin my-cool-feature`
30+
1. Submit a pull request
31+
32+
## Usage
33+
34+
After install just type one of the shortcuts below and hit tab to expand the snippet in your editor. Only works on files already saved as `.js` or `.jsx`.
35+
36+
Continue hitting tab to cycle through and highlight common editing points in a snippet. The `${N}` syntax in the examples below denote the highlight points.
37+
38+
## Available Commands
39+
40+
This section is in progress. Will come out soon.
41+
42+
## License
43+
44+
[MIT License](http://choosealicense.com/licenses/mit/) © Nick S. Plekhanov

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "mighty-react-snippets",
3+
"author": "Nick S. Plekhanov <nick.plekhanov@gmail.com>",
4+
"version": "0.1.0",
5+
"description": "Crafty React and Redux ES6 snippets for Atom Editor",
6+
"main": "./lib/mighty-react-snippets",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/nicksp/mighty-react-snippets"
10+
},
11+
"keywords": [
12+
"react",
13+
"redux",
14+
"es6",
15+
"atom",
16+
"snippets"
17+
],
18+
"license": "MIT",
19+
"bugs": {
20+
"url": "https://github.com/nicksp/mighty-react-snippets/issues"
21+
},
22+
"engines": {
23+
"atom": ">=1.0.0 <2.0.0"
24+
},
25+
"dependencies": {}
26+
}
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
'.source.js, .source.jsx':
2+
3+
# React Core
4+
'React: New component':
5+
'prefix': 'rnc'
6+
'description': 'React: New component'
7+
'body': """
8+
import React, { Component, PropTypes } from 'react';
9+
10+
export default class ${1:NewComponent} extends Component {
11+
static propTypes = {
12+
13+
};
14+
15+
render() {
16+
return (
17+
${2:<div>${1:NewComponent} Content</div>}
18+
);
19+
}
20+
}
21+
"""
22+
23+
'React: Stateless component':
24+
'prefix': 'rnsc'
25+
'description': 'React: Stateless component'
26+
'body': """
27+
import React, { PropTypes } from 'react';
28+
29+
const ${1:NewComponent} = (props) => {
30+
return (
31+
<div>${3:${1:NewComponent} Content}</div>
32+
);
33+
};
34+
35+
${1:NewComponent}.propTypes = {
36+
propName: PropTypes.$2
37+
};
38+
39+
export default ${1:NewComponent};
40+
"""
41+
42+
'React: constructor() method':
43+
'prefix': 'rctr'
44+
'description': 'React: constructor() method'
45+
'body': """
46+
constructor(props) {
47+
super(props);
48+
${1}
49+
}
50+
"""
51+
52+
'React: Bind method to this':
53+
'prefix': 'rbm'
54+
'description': 'React: Bind method to this'
55+
'body': 'this.${1} = this.${1}.bind(this);'
56+
57+
# Lifecycle Methods
58+
'React: componentWillMount() lifecycle method':
59+
'prefix': 'rlcwm'
60+
'description': 'React Lifecycle Methods: componentWillMount() method'
61+
'body': """
62+
componentWillMount() {
63+
$1
64+
}
65+
"""
66+
67+
'React: componentDidMount() lifecycle method':
68+
'prefix': 'rlcdm'
69+
'description': 'React Lifecycle Methods: componentDidMount() method'
70+
'body': """
71+
componentDidMount() {
72+
$1
73+
}
74+
"""
75+
76+
'React: componentWillReceiveProps() lifecycle method':
77+
'prefix': 'rlcwrp'
78+
'description': 'React Lifecycle Methods: componentWillReceiveProps() method'
79+
'body': """
80+
componentWillReceiveProps() {
81+
$1
82+
}
83+
"""
84+
85+
'React: componentWillUnmount() lifecycle method':
86+
'prefix': 'rlcwun'
87+
'description': 'React Lifecycle Methods: componentWillUnmount() method'
88+
'body': """
89+
componentWillUnmount() {
90+
$1
91+
}
92+
"""
93+
94+
'React: shouldComponentUpdate() lifecycle method':
95+
'prefix': 'rlscup'
96+
'description': 'React Lifecycle Methods: shouldComponentUpdate() method'
97+
'body': """
98+
shouldComponentUpdate() {
99+
$1
100+
}
101+
"""
102+
103+
# Prop Validation
104+
'React: PropTypes.string':
105+
'prefix': 'rps'
106+
'description': 'React PropTypes: string'
107+
'body': '${1:myProp}: PropTypes.string${2:,}'
108+
109+
'React: PropTypes.string.isRequired':
110+
'prefix': 'rpsr'
111+
'description': 'React PropTypes: required string'
112+
'body': '${1:myProp}: PropTypes.string.isRequired${2:,}'
113+
114+
'React: PropTypes.number':
115+
'prefix': 'rpn'
116+
'description': 'React PropTypes: number'
117+
'body': '${1:myProp}: PropTypes.number${2:,}'
118+
119+
'React: PropTypes.number.isRequired':
120+
'prefix': 'rpnr'
121+
'description': 'React PropTypes: required number'
122+
'body': '${1:myProp}: PropTypes.number.isRequired${2:,}'
123+
124+
'React: PropTypes.object':
125+
'prefix': 'rpo'
126+
'description': 'React PropTypes: object'
127+
'body': '${1:myProp}: PropTypes.object${2:,}'
128+
129+
'React: PropTypes.object.isRequired':
130+
'prefix': 'rpor'
131+
'description': 'React PropTypes: required object'
132+
'body': '${1:myProp}: PropTypes.object.isRequired${2:,}'
133+
134+
'React: PropTypes.array':
135+
'prefix': 'rpa'
136+
'description': 'React PropTypes: array'
137+
'body': '${1:myProp}: PropTypes.array${2:,}'
138+
139+
'React: PropTypes.array.isRequired':
140+
'prefix': 'rpar'
141+
'description': 'React PropTypes: required array'
142+
'body': '${1:myProp}: PropTypes.array.isRequired${2:,}'
143+
144+
'React: PropTypes.bool':
145+
'prefix': 'rpb'
146+
'description': 'React PropTypes: bool'
147+
'body': '${1:myProp}: PropTypes.bool${2:,}'
148+
149+
'React: PropTypes.bool.isRequired':
150+
'prefix': 'rpbr'
151+
'description': 'React PropTypes: required bool'
152+
'body': '${1:myProp}: PropTypes.bool.isRequired${2:,}'
153+
154+
'React: PropTypes.element':
155+
'prefix': 'rpe'
156+
'description': 'React PropTypes: element'
157+
'body': '${1:myProp}: PropTypes.element${2:,}'
158+
159+
'React: PropTypes.element.isRequired':
160+
'prefix': 'rper'
161+
'description': 'React PropTypes: required element'
162+
'body': '${1:myProp}: PropTypes.element.isRequired${2:,}'
163+
164+
'React: PropTypes.func':
165+
'prefix': 'rpf'
166+
'description': 'React PropTypes: function'
167+
'body': '${1:myProp}: PropTypes.func${2:,}'
168+
169+
'React: PropTypes.func.isRequired':
170+
'prefix': 'rpfr'
171+
'description': 'React PropTypes: required function'
172+
'body': '${1:myProp}: PropTypes.func.isRequired${2:,}'
173+
174+
'React: PropTypes.oneOf':
175+
'prefix': 'rpoo'
176+
'description': 'React PropTypes: enum'
177+
'body': '${1:myProp}: PropTypes.oneOf([$2])${3:,}'
178+
179+
'React: PropTypes.oneOf.isRequired':
180+
'prefix': 'rpoor'
181+
'description': 'React PropTypes: required enum'
182+
'body': '${1:myProp}: PropTypes.oneOf([$2]).isRequired${3:,}'
183+
184+
'React: PropTypes.oneOfType':
185+
'prefix': 'rpoot'
186+
'description': 'React PropTypes: unions'
187+
'body': '${1:myProp}: PropTypes.oneOfType([$2])${3:,}'
188+
189+
'React: PropTypes.oneOfType.isRequired':
190+
'prefix': 'rpootr'
191+
'description': 'React PropTypes: required unions'
192+
'body': '${1:myProp}: PropTypes.oneOfType([$2]).isRequired${3:,}'

0 commit comments

Comments
 (0)