Skip to content

Commit 141c24c

Browse files
scaffolding and j5 blink
1 parent ed790e8 commit 141c24c

12 files changed

+309
-17
lines changed

app/reducers/game.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
3+
};

app/reducers/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { combineReducers } from 'redux-immutable';
2+
3+
export default combineReducers({
4+
led: require('./led'),
5+
piezo: require('./piezo'),
6+
game: require('./game'),
7+
});

app/reducers/led.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
3+
};

app/reducers/piezo.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
3+
};

app/store/configureStore.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { redux } from 'redux';
2+
var createStore = redux.createStore;
3+
var applyMiddleware = redux.applyMiddleware;
4+
import rootReducer from '../reducers';
5+
6+
module.exports = function configureStore(initialState) {
7+
return createStore(rootReducer, initialState, applyMiddleware());
8+
};

app/store/defaultState.js

Whitespace-only changes.

app/store/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var configureStore = require('./configureStore');
2+
var defaultState = {
3+
led_on: false,
4+
blink: false,
5+
start_game: false,
6+
end_game: false,
7+
}
8+
module.exports = configureStore(defaultState);

eslint/eslint-defaults.yml

+255
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
---
2+
rules:
3+
4+
# Possible Errors
5+
6+
no-cond-assign:
7+
- 2
8+
- except-parens
9+
no-console: 0
10+
no-constant-condition: 1
11+
no-control-regex: 2
12+
no-debugger: 1
13+
no-dupe-args: 2
14+
no-dupe-keys: 2
15+
no-duplicate-case: 2
16+
no-empty-character-class: 2
17+
no-empty: 1
18+
no-ex-assign: 2
19+
no-extra-boolean-cast: 2
20+
no-extra-parens:
21+
- 2
22+
- functions
23+
no-extra-semi: 2
24+
no-func-assign: 2
25+
no-inner-declarations: 2
26+
no-invalid-regexp: 2
27+
no-irregular-whitespace: 2
28+
no-negated-in-lhs: 2
29+
no-obj-calls: 2
30+
no-regex-spaces: 2
31+
no-sparse-arrays: 2
32+
no-unreachable: 1
33+
use-isnan: 2
34+
valid-jsdoc:
35+
- 2
36+
- prefer:
37+
return: returns
38+
valid-typeof: 2
39+
no-unexpected-multiline: 2
40+
41+
# Best Practices
42+
43+
accessor-pairs: 2
44+
block-scoped-var: 2
45+
complexity: 0
46+
curly:
47+
- 2
48+
- all
49+
default-case: 2
50+
dot-notation: 2
51+
dot-location:
52+
- 2
53+
- property
54+
eqeqeq:
55+
- 2
56+
- "allow-null"
57+
guard-for-in: 0
58+
no-alert: 2
59+
no-caller: 2
60+
no-div-regex: 0
61+
no-else-return: 2
62+
no-eq-null: 0
63+
no-eval: 2
64+
no-extend-native: 0
65+
no-extra-bind: 2
66+
no-fallthrough: 2
67+
no-floating-decimal: 2
68+
no-implicit-coercion: 0
69+
no-implied-eval: 2
70+
no-invalid-this: 0
71+
no-iterator: 2
72+
no-labels: 0
73+
no-lone-blocks: 2
74+
no-loop-func: 2
75+
no-multi-spaces: 2
76+
no-multi-str: 2
77+
no-native-reassign: 2
78+
no-new-func: 0
79+
no-new-wrappers: 2
80+
no-new: 2
81+
no-octal-escape: 2
82+
no-octal: 2
83+
no-param-reassign: 0
84+
no-process-env: 0
85+
no-proto: 2
86+
no-redeclare:
87+
- 2
88+
- builtinGlobals: false
89+
no-return-assign: 2
90+
no-script-url: 2
91+
no-self-compare: 2
92+
no-sequences: 2
93+
no-throw-literal: 2
94+
no-unused-expressions: 2
95+
no-useless-call: 2
96+
no-void: 2
97+
no-warning-comments: 1
98+
no-with: 2
99+
radix: 2
100+
vars-on-top: 0
101+
wrap-iife:
102+
- 2
103+
- inside
104+
yoda:
105+
- 2
106+
- never
107+
108+
# Strict Mode
109+
110+
strict:
111+
- 2
112+
- global
113+
114+
# Variables
115+
116+
init-declarations: 0
117+
no-catch-shadow: 0
118+
no-delete-var: 2
119+
no-label-var: 2
120+
no-shadow-restricted-names: 2
121+
no-shadow: 2
122+
no-undef-init: 2
123+
no-undef: 2
124+
no-undefined: 0
125+
no-unused-vars:
126+
- 2
127+
- vars: all
128+
args: none
129+
no-use-before-define: 2
130+
131+
# Stylistic Issues
132+
133+
array-bracket-spacing:
134+
- 2
135+
- never
136+
brace-style:
137+
- 2
138+
- 1tbs
139+
- allowSingleLine: false
140+
camelcase:
141+
- 2
142+
- properties: never
143+
comma-spacing:
144+
- 2
145+
- before: false
146+
after: true
147+
comma-style:
148+
- 2
149+
- last
150+
computed-property-spacing:
151+
- 2
152+
- never
153+
consistent-this:
154+
- 2
155+
- that
156+
eol-last: 0
157+
func-names: 0
158+
func-style: 0
159+
id-length: 0
160+
id-match: 0
161+
indent:
162+
- 2
163+
- 2
164+
- SwitchCase: 1
165+
VariableDeclarator: {
166+
let: 2,
167+
var: 2,
168+
const: 3
169+
}
170+
key-spacing:
171+
- 2
172+
- beforeColon: false
173+
afterColon: true
174+
lines-around-comment:
175+
- 2
176+
- beforeBlockComment: true
177+
linebreak-style:
178+
- 2
179+
- unix
180+
max-len:
181+
- 1
182+
- 120
183+
- 4
184+
max-nested-callbacks: 0
185+
new-cap:
186+
- 2
187+
- newIsCap: true
188+
capIsNew: true
189+
new-parens: 0
190+
newline-after-var: 0
191+
no-array-constructor: 2
192+
no-continue: 0
193+
no-inline-comments: 0
194+
no-lonely-if: 2
195+
no-mixed-spaces-and-tabs: 2
196+
no-multiple-empty-lines:
197+
- 2
198+
- max: 2
199+
no-nested-ternary: 2
200+
no-new-object: 2
201+
no-spaced-func: 2
202+
no-ternary: 0
203+
no-trailing-spaces: 2
204+
no-underscore-dangle: 0
205+
no-unneeded-ternary: 2
206+
object-curly-spacing:
207+
- 2
208+
- never
209+
operator-assignment:
210+
- 2
211+
- always
212+
operator-linebreak:
213+
- 2
214+
- after
215+
padded-blocks: 0
216+
quote-props:
217+
- 2
218+
- as-needed
219+
- {keywords: false, numbers: true}
220+
quotes:
221+
- 2
222+
- single
223+
- avoid-escape
224+
semi-spacing:
225+
- 2
226+
- before: false
227+
after: true
228+
semi:
229+
- 2
230+
- always
231+
sort-vars: 0
232+
space-after-keywords:
233+
- 2
234+
- always
235+
space-before-blocks:
236+
- 2
237+
- always
238+
space-before-function-paren:
239+
- 2
240+
- never
241+
space-in-parens:
242+
- 2
243+
- never
244+
space-infix-ops:
245+
- 2
246+
- int32Hint: false
247+
space-return-throw-case: 2
248+
space-unary-ops:
249+
- 2
250+
- words: true
251+
nonwords: false
252+
spaced-comment:
253+
- 2
254+
- always
255+
wrap-regex: 0

eslint/eslint-mocha.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
# Globally permitting mocha constructs reduces the eslint configuration
3+
# needed within test files
4+
env:
5+
mocha: true

index.js

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
// Import the interface to Tessel hardware
2-
var tessel = require('tessel');
3-
4-
// Turn one of the LEDs on to start.
5-
tessel.led[2].on();
6-
7-
// Blink!
8-
setInterval(function () {
9-
tessel.led[2].toggle();
10-
tessel.led[3].toggle();
11-
}, 100);
12-
13-
console.log("I'm blinking! (Press CTRL + C to stop)");
1+
var five = require("johnny-five");
2+
var Tessel = require("tessel-io");
3+
var board = new five.Board({
4+
io: new Tessel()
5+
});
6+
// 5
7+
board.on("ready", function() {
8+
var led = new five.Led("a0");
9+
led.blink(500);
10+
});

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "mocha --compilers js:babel-register --recursive",
8-
"blah": "babel-node blah.js"
8+
"start": "babel-node index.js",
9+
"lint": "eslint --ext .js app"
910
},
1011
"repository": "https://github.com/deathbearbrown/simon.git",
1112
"keywords": [
@@ -15,14 +16,16 @@
1516
"readme": "A bare bones Tessel 2 blinky script.",
1617
"devDependencies": {
1718
"babel-cli": "^6.10.1",
19+
"babel-eslint": "^5.0.4",
1820
"babel-preset-es2015": "^6.9.0",
1921
"babel-register": "^6.9.0",
2022
"chai": "^3.5.0",
23+
"eslint": "^1.10.3",
2124
"install": "^0.8.1",
2225
"johnny-five": "^0.9.56",
23-
"jshint": "^2.9.2",
2426
"mocha": "^2.5.3",
2527
"npm": "^3.9.5",
26-
"redux": "^3.5.2"
28+
"redux": "^3.5.2",
29+
"tessel-io": "^0.6.1"
2730
}
2831
}

test/led.actions.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var expect = require('chai').expect;
1+
import { expect } from 'chai';
22
import * as actions from '../app/actions/ledActions'
33
import types from '../app/constants/actionTypes'
44

0 commit comments

Comments
 (0)