-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linting): Added linting checks to the JS files to the repo (#169)
* chore(lint): Added ES Lint and configuration for it * chore(lint): Added ES2019 support to linter * chore(lint): Added ignore file for eslint to remove submodules * chore(lint): Added lint recipes to makefile and package * fix(linting): Updated tests with fixes for linting errors * fix(linting): Bring linting up to spec * fix(linting): Removed some ambiguity from pixel setup * fix(linting): Updated examples to use standard linting rules * fix(linting): Added default case for colour swapping * fix(linting): Updated function positions * fix(linting): Updated boards file to bring into linting standards
- Loading branch information
Showing
23 changed files
with
2,739 additions
and
2,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coverage/* | ||
firmware/src/libs/firmata/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2019, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"eqeqeq": 0, | ||
"no-var": 2, | ||
"prefer-const": 2, | ||
"no-shadow": 2, | ||
"no-shadow-restricted-names": 2, | ||
"no-use-before-define": 2, | ||
"comma-dangle": [2, "never"], | ||
"no-cond-assign": [2, "always"], | ||
"no-constant-condition": 1, | ||
"no-dupe-keys": 2, | ||
"no-duplicate-case": 2, | ||
"no-ex-assign": 2, | ||
"no-extra-boolean-cast": 1, | ||
"no-extra-semi": 2, | ||
"no-func-assign": 2, | ||
"no-irregular-whitespace": 2, | ||
"default-case": 2, | ||
"guard-for-in": 2, | ||
"no-floating-decimal": 2, | ||
"no-self-compare": 2, | ||
"no-sequences": 2, | ||
"no-throw-literal": 2, | ||
"radix": 2, | ||
"quotes": [2, "single", "avoid-escape"], | ||
"indent": [2, 2, { "SwitchCase": 1 }], | ||
"brace-style": [2, "1tbs", { "allowSingleLine": true }], | ||
"comma-style": [2, "last"], | ||
"no-multiple-empty-lines": 2, | ||
"no-nested-ternary": 2, | ||
"one-var": [2, "never"], | ||
"padded-blocks": [2, "never"], | ||
"keyword-spacing": 2, | ||
"no-console": 0, | ||
"space-before-blocks": 2, | ||
"space-before-function-paren": [2, "never"], | ||
"spaced-comment": 2, | ||
"valid-jsdoc": [2, { "requireReturn": false }], | ||
"no-unreachable": 2, | ||
"no-unexpected-multiline": 2, | ||
"no-else-return": 2, | ||
"constructor-super": 2, | ||
"no-this-before-super": 2, | ||
"object-shorthand": [2, "always"], | ||
"no-loop-func": 0, | ||
"no-param-reassign": 0, | ||
"no-empty": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ install: clean | |
npm install | ||
|
||
lint: | ||
@echo "Not implemented" | ||
npm run lint | ||
|
||
test: | ||
npm run test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,41 @@ | ||
// This example shows how to use node-pixel using firmata as the | ||
// hook for the board. | ||
|
||
var firmata = require("firmata"); | ||
var pixel = require("../lib/pixel.js"); | ||
const firmata = require('firmata'); | ||
const pixel = require('../lib/pixel.js'); | ||
|
||
var opts = {}; | ||
const opts = {}; | ||
if (process.argv[2] == undefined) { | ||
console.log("Please supply a device port to connect to"); | ||
process.exit(); | ||
console.log('Please supply a device port to connect to'); | ||
process.exit(); | ||
} | ||
|
||
opts.port = process.argv[2]; | ||
|
||
var strip = null; | ||
let strip = null; | ||
|
||
var board = new firmata.Board(opts.port, function() { | ||
const board = new firmata.Board(opts.port, function() { | ||
console.log('Firmata ready, lets add light'); | ||
|
||
console.log("Firmata ready, lets add light"); | ||
strip = new pixel.Strip({ | ||
data: 6, | ||
length: 4, | ||
firmata: board | ||
}); | ||
|
||
strip = new pixel.Strip({ | ||
data: 6, | ||
length: 4, | ||
firmata: board, | ||
}); | ||
let pos = 0; | ||
const colors = ['red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'white']; | ||
let current_color = 0; | ||
|
||
var pos = 0; | ||
var colors = ["red", "green", "blue", "yellow", "cyan", "magenta", "white"]; | ||
var current_color = 0; | ||
const blinker = setInterval(function() { | ||
strip.color('#000'); // blanks it out | ||
|
||
var blinker = setInterval(function() { | ||
if (++pos >= strip.length) { | ||
pos = 0; | ||
if (++current_color>= colors.length) current_color = 0; | ||
} | ||
strip.pixel(pos).color(colors[current_color]); | ||
|
||
strip.color("#000"); // blanks it out | ||
|
||
if (++pos >= strip.length) { | ||
pos = 0; | ||
if (++current_color>= colors.length) current_color = 0; | ||
} | ||
strip.pixel(pos).color(colors[current_color]); | ||
|
||
strip.show(); | ||
}, 1000/2); | ||
strip.show(); | ||
}, 1000/2); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,44 @@ | ||
// This example shows how to use node-pixel using Johnny Five as the | ||
// hook for the board. | ||
var five = require("johnny-five"); | ||
var pixel = require("../lib/pixel.js"); | ||
|
||
var opts = {}; | ||
opts.port = process.argv[2] || ""; | ||
|
||
var board = new five.Board(opts); | ||
var strip = null; | ||
|
||
var fps = 1; // how many frames per second do you want to try? | ||
|
||
board.on("ready", function() { | ||
|
||
console.log("Board ready, lets add light"); | ||
|
||
strip = new pixel.Strip({ | ||
color_order: pixel.COLOR_ORDER.GRB, | ||
board: this, | ||
controller: "I2CBACKPACK", | ||
strips: [8], | ||
}); | ||
|
||
strip.on("ready", function() { | ||
|
||
console.log("Strip ready, let's go"); | ||
|
||
var colors = ["red", "green", "blue", "yellow", "cyan", "magenta", "white"]; | ||
var current_colors = [0,1,2,3,4]; | ||
var current_pos = [0,1,2,3,4]; | ||
var blinker = setInterval(function() { | ||
|
||
strip.color("#000"); // blanks it out | ||
|
||
for (var i=0; i< current_pos.length; i++) { | ||
if (++current_pos[i] >= strip.length) { | ||
current_pos[i] = 0; | ||
if (++current_colors[i] >= colors.length) current_colors[i] = 0; | ||
} | ||
strip.pixel(current_pos[i]).color(colors[current_colors[i]]); | ||
} | ||
|
||
strip.show(); | ||
}, 1000/fps); | ||
}); | ||
const five = require('johnny-five'); | ||
const pixel = require('../lib/pixel.js'); | ||
|
||
const opts = {}; | ||
opts.port = process.argv[2] || ''; | ||
|
||
const board = new five.Board(opts); | ||
let strip = null; | ||
|
||
const fps = 1; // how many frames per second do you want to try? | ||
|
||
board.on('ready', function() { | ||
console.log('Board ready, lets add light'); | ||
|
||
strip = new pixel.Strip({ | ||
color_order: pixel.COLOR_ORDER.GRB, | ||
board: this, | ||
controller: 'I2CBACKPACK', | ||
strips: [8] | ||
}); | ||
|
||
strip.on('ready', function() { | ||
console.log("Strip ready, let's go"); | ||
|
||
const colors = ['red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'white']; | ||
const current_colors = [0,1,2,3,4]; | ||
const current_pos = [0,1,2,3,4]; | ||
const blinker = setInterval(function() { | ||
strip.color('#000'); // blanks it out | ||
|
||
for (let i=0; i< current_pos.length; i++) { | ||
if (++current_pos[i] >= strip.length) { | ||
current_pos[i] = 0; | ||
if (++current_colors[i] >= colors.length) current_colors[i] = 0; | ||
} | ||
strip.pixel(current_pos[i]).color(colors[current_colors[i]]); | ||
} | ||
|
||
strip.show(); | ||
}, 1000/fps); | ||
}); | ||
}); |
Oops, something went wrong.