Skip to content

Commit

Permalink
Merge pull request #21 from walaura/dev
Browse files Browse the repository at this point in the history
eslinted everything
  • Loading branch information
Lau Bismaquer authored Mar 2, 2017
2 parents 2db2a99 + f02a9e5 commit 73f9a90
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 84 deletions.
32 changes: 32 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"env": {
"browser": true,
"commonjs": true,
"mocha": true,
"phantomjs": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-console": 0
}
}
20 changes: 10 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const uglify = require('gulp-uglify');
const header = require('gulp-header');
const path = require('path');
const fs = require('fs-extra');
const WrapperPlugin = require('wrapper-webpack-plugin');

const config = require('./src/conf.js');

Expand Down Expand Up @@ -39,7 +38,7 @@ gulp.task('clean', () => {
['dist','temp','temp/screenshots'].map((dir)=>{
fs.removeSync(dir);
fs.mkdirSync(dir);
})
});
});


Expand Down Expand Up @@ -75,7 +74,7 @@ gulp.task('test', ['make'], function () {
if(uploadCount >= screenshots.length) {
cb(null, chunk);
}
}
};

screenshots.map((screenshot)=>{

Expand All @@ -87,13 +86,13 @@ gulp.task('test', ['make'], function () {
]);

child.stdout.on('data', (buffer) => {
gutil.log('Look at it!!!', gutil.colors.magenta(buffer.toString().replace("\n",'')));
gutil.log('Look at it!!!', gutil.colors.magenta(buffer.toString().replace('\n','')));
});
child.stdout.on('end', isDoneMaybe);

});

}))
}));
});


Expand All @@ -113,7 +112,7 @@ gulp.task('default', function() {
root: path.resolve('./src')
}
}))
.pipe(header(config.webpack.header+"\n"))
.pipe(header(config.webpack.header+'\n'))
.pipe(gulp.dest('dist/'));
});

Expand All @@ -133,9 +132,9 @@ gulp.task('make', ['clean'], function() {
}
}))
.pipe(uglify())
.pipe(header(config.webpack.header+"\n"))
.pipe(gulp.dest('dist/'))
})
.pipe(header(config.webpack.header+'\n'))
.pipe(gulp.dest('dist/'));
});


gulp.task('release', function(){
Expand All @@ -146,7 +145,8 @@ gulp.task('release', function(){
.pipe(release({
manifest: require('./package.json')
}).on('error',function(e){
console.error(e);
this.emit('end');
}))
}));

});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"wrapper-webpack-plugin": "0.1.11"
},
"devDependencies": {
"eslint": "^3.16.1",
"gulp-github-release": "^1.2.0",
"mocha": "^3.2.0",
"mocha-phantomjs": "^4.1.0",
Expand All @@ -49,6 +50,7 @@
"scripts": {
"gulp": "./node_modules/.bin/gulp",
"install": "gulp make",
"eslint": "eslint --ignore-path .gitignore .",
"release": "npm publish && npm install && gulp release",
"test": "gulp test"
}
Expand Down
16 changes: 8 additions & 8 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const constellation = function ({
} = {}) {


if(padding[0] === 0 && padding[1] === 0) padding = [fuzziness,fuzziness]
if(padding[0] === 0 && padding[1] === 0) padding = [fuzziness,fuzziness];
style = Object.assign({}, config.defaults.style, style);
speed = Object.assign({}, config.defaults.speed, speed);

Expand All @@ -40,7 +40,7 @@ const constellation = function ({
);


const onDOMReady = (resolve,reject) => {
const onDOMReady = (resolve) => {

let isJiggling = true;
let pointerPosition = [0,0];
Expand All @@ -62,7 +62,7 @@ const constellation = function ({
isJiggling = false;
pointerPosition = [x,y];
});
canvas.addEventListener('mouseout',(ev)=>{
canvas.addEventListener('mouseout',()=>{
isJiggling = true;
});

Expand All @@ -79,10 +79,10 @@ const constellation = function ({
pointerPosition: pointerPosition,
isJiggling: isJiggling
}
)
}
);
};

puppis.addEventListener('message', (msg)=>{
puppis.addEventListener('message', msg => {
text.is(
msg,'updateComplete',
(payload) => {
Expand All @@ -92,9 +92,9 @@ const constellation = function ({
lines: payload.lines
});
repaint();
})
});
}
)
);
});

repaint();
Expand Down
24 changes: 12 additions & 12 deletions src/class/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ export default class Canvas {
ctx.strokeStyle = style.lineColor;
ctx.globalCompositeOperation = 'source-over';
for (let i = 0, len = objects.lines.length; i < len; i++) {
let line = objects.lines[i]
let line = objects.lines[i];
if(onDraw.line) {
onDraw.line(ctx,style,line);
}
else {
ctx.beginPath();
ctx.moveTo(line.pos[0],line.pos[1]);
ctx.lineTo(line.pos[2],line.pos[3]);
ctx.stroke();
ctx.closePath();
ctx.moveTo(line.pos[0],line.pos[1]);
ctx.lineTo(line.pos[2],line.pos[3]);
ctx.stroke();
ctx.closePath();
}
if(onDraw.afterLine) onDraw.afterLine(ctx,style,line);
}
Expand All @@ -43,13 +43,13 @@ export default class Canvas {
ctx.fillStyle = '#f0f';
ctx.globalCompositeOperation = 'destination-out';
for (let i = 0, len = objects.stars.length; i < len; i++) {
let star = objects.stars[i]
let star = objects.stars[i];
ctx.beginPath();
ctx.arc(
ctx.arc(
star.pos[0], star.pos[1],
(style.starSize + style.starPadding),
0, 2 * Math.PI);
ctx.fill();
ctx.fill();
ctx.closePath();
}
}
Expand All @@ -58,20 +58,20 @@ export default class Canvas {
ctx.fillStyle = style.starColor;
ctx.globalCompositeOperation = 'source-over';
for (let i = 0, len = objects.stars.length; i < len; i++) {
let star = objects.stars[i]
let star = objects.stars[i];
if(onDraw.star) {
onDraw.star(ctx,style,star);
}
else {
ctx.beginPath();
ctx.arc(
ctx.arc(
star.pos[0], star.pos[1], style.starSize,0, 2 * Math.PI
);
ctx.fill();
ctx.fill();
ctx.closePath();
}
if(onDraw.afterStar) onDraw.afterStar(ctx,style,star);
};
}
ctx.closePath();

if(onDraw.afterFrame) onDraw.afterFrame(ctx,style,objects);
Expand Down
2 changes: 1 addition & 1 deletion src/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ module.exports = {
passive: .075
}
}
}
};
2 changes: 1 addition & 1 deletion src/lib/random.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default (arr) => {
return arr[Math.floor(Math.random() * arr.length)];
}
};
4 changes: 2 additions & 2 deletions src/lib/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
},
is: (msg,body,cb) => {
if(msg.data.body === body) {
cb(msg.data.payload)
cb(msg.data.payload);
}
}
}
};
Loading

0 comments on commit 73f9a90

Please sign in to comment.