Skip to content

Commit 47ba8f2

Browse files
committed
Merge pull request #1 from TechnologyAdvice/structure
Structure
2 parents cf83098 + d02bd5c commit 47ba8f2

File tree

9 files changed

+357
-0
lines changed

9 files changed

+357
-0
lines changed

.eslintrc

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*eslint-env node, mocha */
2+
{
3+
"env": {
4+
"node": true,
5+
"mocha": true,
6+
"browser": true
7+
},
8+
"ecmaFeatures": {
9+
"arrowFunctions": false,
10+
"blockBindings": false,
11+
"classes": false,
12+
"defaultParams": false,
13+
"destructuring": false,
14+
"forOf": false,
15+
"generators": false,
16+
"modules": false,
17+
"objectLiteralComputedProperties": false,
18+
"objectLiteralDuplicateProperties": false,
19+
"objectLiteralShorthandMethods": false,
20+
"objectLiteralShorthandProperties": false,
21+
"spread": false,
22+
"superInFunctions": false,
23+
"templateStrings": false,
24+
"jsx": true
25+
},
26+
"rules": {
27+
/**
28+
* Strict mode
29+
*/
30+
"strict": [2, "never"],
31+
32+
/**
33+
* ES6
34+
*/
35+
"no-var": 0, // http://eslint.org/docs/rules/no-var
36+
37+
/**
38+
* Variables
39+
*/
40+
"no-shadow": 0, // http://eslint.org/docs/rules/no-shadow
41+
"no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
42+
"no-unused-vars": [2, { // http://eslint.org/docs/rules/no-unused-vars
43+
"vars": "local",
44+
"args": "after-used"
45+
}],
46+
"no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
47+
48+
/**
49+
* Possible errors
50+
*/
51+
"comma-dangle": [2, "never"], // http://eslint.org/docs/rules/comma-dangle
52+
"no-cond-assign": [2, "always"], // http://eslint.org/docs/rules/no-cond-assign
53+
"no-console": 0, // http://eslint.org/docs/rules/no-console
54+
"no-debugger": 1, // http://eslint.org/docs/rules/no-debugger
55+
"no-alert": 1, // http://eslint.org/docs/rules/no-alert
56+
"no-constant-condition": 1, // http://eslint.org/docs/rules/no-constant-condition
57+
"no-dupe-keys": 2, // http://eslint.org/docs/rules/no-dupe-keys
58+
"no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case
59+
"no-empty": 2, // http://eslint.org/docs/rules/no-empty
60+
"no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign
61+
"no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
62+
"no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi
63+
"no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign
64+
"no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations
65+
"no-invalid-regexp": 2, // http://eslint.org/docs/rules/no-invalid-regexp
66+
"no-irregular-whitespace": 2, // http://eslint.org/docs/rules/no-irregular-whitespace
67+
"no-obj-calls": 2, // http://eslint.org/docs/rules/no-obj-calls
68+
"no-reserved-keys": 2, // http://eslint.org/docs/rules/no-reserved-keys
69+
"no-sparse-arrays": 2, // http://eslint.org/docs/rules/no-sparse-arrays
70+
"no-unreachable": 2, // http://eslint.org/docs/rules/no-unreachable
71+
"use-isnan": 2, // http://eslint.org/docs/rules/use-isnan
72+
"block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var
73+
"no-path-concat": 0, // http://eslint.org/docs/rules/no-path-concat
74+
75+
/**
76+
* Best practices
77+
*/
78+
"consistent-return": 2, // http://eslint.org/docs/rules/consistent-return
79+
"curly": [2, "multi-line"], // http://eslint.org/docs/rules/curly
80+
"default-case": 2, // http://eslint.org/docs/rules/default-case
81+
"dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation
82+
"allowKeywords": true
83+
}],
84+
"eqeqeq": 2, // http://eslint.org/docs/rules/eqeqeq
85+
"guard-for-in": 2, // http://eslint.org/docs/rules/guard-for-in
86+
"no-caller": 2, // http://eslint.org/docs/rules/no-caller
87+
"no-else-return": 2, // http://eslint.org/docs/rules/no-else-return
88+
"no-eq-null": 2, // http://eslint.org/docs/rules/no-eq-null
89+
"no-eval": 2, // http://eslint.org/docs/rules/no-eval
90+
"no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native
91+
"no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind
92+
"no-fallthrough": 2, // http://eslint.org/docs/rules/no-fallthrough
93+
"no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal
94+
"no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval
95+
"no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks
96+
"no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func
97+
"no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str
98+
"no-native-reassign": 2, // http://eslint.org/docs/rules/no-native-reassign
99+
"no-new": 2, // http://eslint.org/docs/rules/no-new
100+
"no-new-func": 2, // http://eslint.org/docs/rules/no-new-func
101+
"no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers
102+
"no-octal": 2, // http://eslint.org/docs/rules/no-octal
103+
"no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape
104+
"no-param-reassign": 2, // http://eslint.org/docs/rules/no-param-reassign
105+
"no-proto": 2, // http://eslint.org/docs/rules/no-proto
106+
"no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare
107+
"no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign
108+
"no-script-url": 2, // http://eslint.org/docs/rules/no-script-url
109+
"no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare
110+
"no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
111+
"no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
112+
"no-with": 2, // http://eslint.org/docs/rules/no-with
113+
"radix": 2, // http://eslint.org/docs/rules/radix
114+
"vars-on-top": 0, // http://eslint.org/docs/rules/vars-on-top
115+
"wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife
116+
"yoda": 2, // http://eslint.org/docs/rules/yoda
117+
118+
/**
119+
* Style
120+
*/
121+
"max-len": [2, 79, 2], // http://eslint.org/docs/rules/max-len
122+
"indent": [2, 2], // http://eslint.org/docs/rules/
123+
"brace-style": [2, // http://eslint.org/docs/rules/brace-style
124+
"1tbs", {
125+
"allowSingleLine": true
126+
}],
127+
"quotes": [
128+
2, "single", "avoid-escape" // http://eslint.org/docs/rules/quotes
129+
],
130+
"camelcase": [2, { // http://eslint.org/docs/rules/camelcase
131+
"properties": "never"
132+
}],
133+
"comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing
134+
"before": false,
135+
"after": true
136+
}],
137+
"comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style
138+
"eol-last": 2, // http://eslint.org/docs/rules/eol-last
139+
"func-names": 0, // http://eslint.org/docs/rules/func-names
140+
"key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing
141+
"beforeColon": false,
142+
"afterColon": true
143+
}],
144+
"new-cap": [2, { // http://eslint.org/docs/rules/new-cap
145+
"newIsCap": true
146+
}],
147+
"no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
148+
"max": 2
149+
}],
150+
"no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary
151+
"no-new-object": 2, // http://eslint.org/docs/rules/no-new-object
152+
"no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func
153+
"no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces
154+
"no-wrap-func": 2, // http://eslint.org/docs/rules/no-wrap-func
155+
"no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle
156+
"one-var": [2, "never"], // http://eslint.org/docs/rules/one-var
157+
"padded-blocks": [2, "never"], // http://eslint.org/docs/rules/padded-blocks
158+
"semi": [2, "always"], // http://eslint.org/docs/rules/semi
159+
"semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing
160+
"before": false,
161+
"after": true
162+
}],
163+
"space-after-keywords": 2, // http://eslint.org/docs/rules/space-after-keywords
164+
"space-before-blocks": 2, // http://eslint.org/docs/rules/space-before-blocks
165+
"space-before-function-paren": [2, "never"], // http://eslint.org/docs/rules/space-before-function-paren
166+
"space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops
167+
"space-return-throw-case": 2, // http://eslint.org/docs/rules/space-return-throw-case
168+
"spaced-line-comment": 2 // http://eslint.org/docs/rules/spaced-line-comment
169+
}
170+
}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea
2+
.DS_STORE
3+
node_modules
4+
bower_components
5+
bundle.js

components/App.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var React = require('react');
2+
var Title = require('./Title/Title');
3+
var App = React.createClass({
4+
render: function() {
5+
return (
6+
<div>
7+
<Title title="Stardust."/>
8+
</div>
9+
)
10+
}
11+
});
12+
13+
React.render(
14+
<App />,
15+
document.getElementById('app')
16+
)

components/Title/Title.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var React = require('react');
2+
3+
var Title = React.createClass({
4+
render: function() {
5+
return (
6+
<div>
7+
<h1>{this.props.title}</h1>
8+
</div>
9+
)
10+
}
11+
});
12+
13+
module.exports = Title;

gulpfile.js

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var $ = require('gulp-load-plugins')();
4+
5+
var paths = {
6+
root: __dirname + '/',
7+
node_modules: __dirname + '/node_modules/',
8+
modules: './modules/',
9+
tapFluxDist: '../../dist/'
10+
};
11+
12+
13+
//
14+
// Build
15+
//
16+
17+
gulp.task('build', function() {
18+
var webpackOpts = {
19+
output: {
20+
filename: 'bundle.js'
21+
},
22+
module: {
23+
loaders: [
24+
{
25+
test: /\.js$/,
26+
loader: 'jsx-loader'
27+
}
28+
]
29+
},
30+
resolveLoader: {
31+
root: paths.node_modules
32+
}
33+
};
34+
35+
return gulp.src(paths.root + 'components/App.js')
36+
.pipe($.webpack(webpackOpts))
37+
.pipe(gulp.dest(paths.root));
38+
});
39+
40+
41+
//
42+
// Serve
43+
//
44+
45+
gulp.task('serve', function() {
46+
return gulp.src(paths.root)
47+
.pipe($.webserver({
48+
host: 'localhost',
49+
port: 8080,
50+
livereload: true,
51+
fallback: 'index.html',
52+
open: false
53+
}));
54+
});
55+
56+
57+
//
58+
// Watch
59+
//
60+
61+
gulp.task('watch', function() {
62+
return gulp.watch([
63+
paths.tapFluxDist + '*.js',
64+
paths.root + 'app/**/*.js',
65+
'!' + paths.node_modules + '**/*'
66+
], ['build']);
67+
});
68+
69+
70+
//
71+
// Default
72+
//
73+
74+
gulp.task('default', function(cb) {
75+
runSequence(
76+
'build',
77+
'watch',
78+
'serve',
79+
cb
80+
);
81+
});

index.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>CHANGE_THIS</title>
5+
</head>
6+
<body>
7+
<div id='app'></div>
8+
<script src='bundle.js'></script>
9+
</body>
10+
</html>

package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "CHANGE_THIS",
3+
"version": "0.1.0",
4+
"description": "CHANGE_THIS",
5+
"scripts": {
6+
"prestart": "npm i",
7+
"start": "gulp"
8+
},
9+
"dependencies": {
10+
"eslint-plugin-react": "^2.5.0",
11+
"flux": "^2.0.0",
12+
"gulp-webpack": "^1.4.0",
13+
"gulp-webserver": "^0.9.1",
14+
"jsx-loader": "^0.13.2",
15+
"keymirror": "~0.1.0",
16+
"lodash": "^3.9.3",
17+
"object-assign": "^1.0.0",
18+
"react": "^0.12.0",
19+
"tap-flux": "^0.9.0"
20+
},
21+
"devDependencies": {
22+
"chai": "^3.0.0",
23+
"eslint": "^0.23.0",
24+
"eslint-plugin-react": "^2.5.2",
25+
"gulp": "^3.8.11",
26+
"gulp-load-plugins": "^1.0.0-rc.1",
27+
"istanbul": "^0.3.15",
28+
"jest-cli": "^0.4.3",
29+
"live-server": "^0.7.1",
30+
"mocha": "^2.2.5",
31+
"run-sequence": "^1.1.0",
32+
"sinon": "^1.15.3",
33+
"sinon-chai": "^2.8.0"
34+
},
35+
"jest": {
36+
"rootDir": "./js"
37+
}
38+
}

test/.eslintrc

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"mocha": true
5+
},
6+
"rules": {
7+
"no-console": 0, // http://eslint.org/docs/rules/no-console
8+
"new-cap": 0, // http://eslint.org/docs/rules/new-cap
9+
"no-shadow": 0 // http://eslint.org/docs/rules/no-shadow
10+
11+
},
12+
"globals": {
13+
"sinon": false,
14+
"chai": false,
15+
"sinonChai": false,
16+
"expect": false,
17+
"should": false,
18+
"_": false
19+
}
20+
}

test/mocha.opts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--recursive
2+
--require ./test/default-require.js
3+
--ui bdd
4+
--colors

0 commit comments

Comments
 (0)