Skip to content
This repository was archived by the owner on Jul 5, 2022. It is now read-only.

Commit be0b789

Browse files
authored
added prettier to eslint (#1989)
1 parent 9ce9148 commit be0b789

File tree

457 files changed

+3536
-4307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+3536
-4307
lines changed

.eslintrc.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ module.exports = {
88
plugins: ['prettier'],
99
rules: {
1010

11-
// 'prettier/prettier': ['error', {
12-
// singleQuote: true
13-
// }],
11+
'prettier/prettier': ['error', {
12+
singleQuote: true
13+
}],
1414

1515
'no-cond-assign': ['error', 'except-parens'],
1616

CodingChallenges/CC_001_StarField/P5/Star.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Star() {
1717
this.y = random(-height, height);
1818
this.pz = this.z;
1919
}
20-
}
20+
};
2121

2222
this.show = function() {
2323
fill(255);
@@ -36,6 +36,5 @@ function Star() {
3636

3737
stroke(255);
3838
line(px, py, sx, sy);
39-
40-
}
39+
};
4140
}

CodingChallenges/CC_002_MengerSponge/P5/box.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,33 @@
66
function Box(x, y, z, r) {
77
this.pos = createVector(x, y, z);
88
this.r = r;
9-
10-
this.generate = function () {
9+
10+
this.generate = function() {
1111
let boxes = [];
1212
for (let x = -1; x < 2; x++) {
1313
for (let y = -1; y < 2; y++) {
1414
for (let z = -1; z < 2; z++) {
1515
let sum = abs(x) + abs(y) + abs(z);
16-
let newR = this.r / 3;
16+
let newR = this.r / 3;
1717
if (sum > 1) {
18-
let b = new Box(this.pos.x + x * newR, this.pos.y + y * newR, this.pos.z + z * newR, newR);
18+
let b = new Box(
19+
this.pos.x + x * newR,
20+
this.pos.y + y * newR,
21+
this.pos.z + z * newR,
22+
newR
23+
);
1924
boxes.push(b);
2025
}
2126
}
2227
}
2328
}
2429
return boxes;
25-
}
30+
};
2631

27-
this.show = function () {
32+
this.show = function() {
2833
push();
2934
translate(this.pos.x, this.pos.y, this.pos.z);
3035
box(this.r);
3136
pop();
32-
}
37+
};
3338
}

CodingChallenges/CC_003_Snake_game/P5/sketch.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ function setup() {
1515
}
1616

1717
function pickLocation() {
18-
let cols = floor(width/scl);
19-
let rows = floor(height/scl);
18+
let cols = floor(width / scl);
19+
let rows = floor(height / scl);
2020
food = createVector(floor(random(cols)), floor(random(rows)));
2121
food.mult(scl);
2222
}

CodingChallenges/CC_003_Snake_game/P5/snake.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ function Snake() {
1111
this.total = 0;
1212
this.tail = [];
1313

14-
this.eat = function (pos) {
14+
this.eat = function(pos) {
1515
let d = dist(this.x, this.y, pos.x, pos.y);
1616
if (d < 1) {
1717
this.total++;
1818
return true;
1919
} else {
2020
return false;
2121
}
22-
}
22+
};
2323

24-
this.dir = function (x, y) {
24+
this.dir = function(x, y) {
2525
this.xspeed = x;
2626
this.yspeed = y;
27-
}
27+
};
2828

29-
this.death = function () {
29+
this.death = function() {
3030
for (let i = 0; i < this.tail.length; i++) {
3131
let pos = this.tail[i];
3232
let d = dist(this.x, this.y, pos.x, pos.y);
@@ -36,9 +36,9 @@ function Snake() {
3636
this.tail = [];
3737
}
3838
}
39-
}
39+
};
4040

41-
this.update = function () {
41+
this.update = function() {
4242
for (let i = 0; i < this.tail.length - 1; i++) {
4343
this.tail[i] = this.tail[i + 1];
4444
}
@@ -51,14 +51,13 @@ function Snake() {
5151

5252
this.x = constrain(this.x, 0, width - scl);
5353
this.y = constrain(this.y, 0, height - scl);
54-
}
54+
};
5555

56-
this.show = function () {
56+
this.show = function() {
5757
fill(255);
5858
for (let i = 0; i < this.tail.length; i++) {
5959
rect(this.tail[i].x, this.tail[i].y, scl, scl);
6060
}
6161
rect(this.x, this.y, scl, scl);
62-
63-
}
62+
};
6463
}

CodingChallenges/CC_004_PurpleRain/P5/drop.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
// http://patreon.com/codingtrain
44
// Code for: https://youtu.be/KkyIDI6rQJI
55

6-
76
function Drop() {
87
this.x = random(width);
98
this.y = random(-500, -50);
109
this.z = random(0, 20);
1110
this.len = map(this.z, 0, 20, 10, 20);
1211
this.yspeed = map(this.z, 0, 20, 1, 20);
1312

14-
this.fall = function () {
13+
this.fall = function() {
1514
this.y = this.y + this.yspeed;
1615
var grav = map(this.z, 0, 20, 0, 0.2);
1716
this.yspeed = this.yspeed + grav;
@@ -20,12 +19,12 @@ function Drop() {
2019
this.y = random(-200, -100);
2120
this.yspeed = map(this.z, 0, 20, 4, 10);
2221
}
23-
}
22+
};
2423

25-
this.show = function () {
24+
this.show = function() {
2625
var thick = map(this.z, 0, 20, 1, 3);
2726
strokeWeight(thick);
2827
stroke(138, 43, 226);
2928
line(this.x, this.y, this.x, this.y + this.len);
30-
}
31-
}
29+
};
30+
}

CodingChallenges/CC_005_Space_invaders/P5/drop.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ function Drop(x, y) {
1212
this.show = function() {
1313
noStroke();
1414
fill(150, 0, 255);
15-
ellipse(this.x, this.y, this.r*2, this.r*2);
16-
}
15+
ellipse(this.x, this.y, this.r * 2, this.r * 2);
16+
};
1717

1818
this.evaporate = function() {
1919
this.toDelete = true;
20-
}
20+
};
2121

2222
this.hits = function(flower) {
2323
var d = dist(this.x, this.y, flower.x, flower.y);
@@ -26,10 +26,9 @@ function Drop(x, y) {
2626
} else {
2727
return false;
2828
}
29-
}
29+
};
3030

3131
this.move = function() {
3232
this.y = this.y - 5;
33-
}
34-
33+
};
3534
}

CodingChallenges/CC_005_Space_invaders/P5/flower.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@ function Flower(x, y) {
1212

1313
this.grow = function() {
1414
this.r = this.r + 2;
15-
}
15+
};
1616

1717
this.shiftDown = function() {
1818
this.xdir *= -1;
1919
this.y += this.r;
20-
}
20+
};
2121

2222
this.move = function() {
2323
this.x = this.x + this.xdir;
24-
}
24+
};
2525

2626
this.show = function() {
2727
noStroke();
2828
fill(255, 0, 200, 150);
29-
ellipse(this.x, this.y, this.r*2, this.r*2);
30-
}
31-
29+
ellipse(this.x, this.y, this.r * 2, this.r * 2);
30+
};
3231
}

CodingChallenges/CC_005_Space_invaders/P5/ship.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@
44
// Code for: https://youtu.be/biN3v3ef-Y0
55

66
function Ship() {
7-
this.x = width/2;
7+
this.x = width / 2;
88
this.xdir = 0;
99

1010
this.show = function() {
1111
fill(255);
1212
rectMode(CENTER);
13-
rect(this.x, height-20, 20, 60);
14-
}
13+
rect(this.x, height - 20, 20, 60);
14+
};
1515

1616
this.setDir = function(dir) {
1717
this.xdir = dir;
18-
}
18+
};
1919

2020
this.move = function(dir) {
21-
this.x += this.xdir*5;
22-
}
23-
21+
this.x += this.xdir * 5;
22+
};
2423
}

CodingChallenges/CC_005_Space_invaders/P5/sketch.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function setup() {
1212
ship = new Ship();
1313
// drop = new Drop(width/2, height/2);
1414
for (var i = 0; i < 6; i++) {
15-
flowers[i] = new Flower(i*80+80, 60);
15+
flowers[i] = new Flower(i * 80 + 80, 60);
1616
}
1717
}
1818

@@ -48,13 +48,11 @@ function draw() {
4848
}
4949
}
5050

51-
for (var i = drops.length-1; i >= 0; i--) {
51+
for (var i = drops.length - 1; i >= 0; i--) {
5252
if (drops[i].toDelete) {
5353
drops.splice(i, 1);
5454
}
5555
}
56-
57-
5856
}
5957

6058
function keyReleased() {
@@ -63,7 +61,6 @@ function keyReleased() {
6361
}
6462
}
6563

66-
6764
function keyPressed() {
6865
if (key === ' ') {
6966
var drop = new Drop(ship.x, height);

CodingChallenges/CC_006_Mitosis/P5/cell.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// Code for: https://youtu.be/jxGS3fKPKJA
55

66
function Cell(pos, r, c) {
7-
87
if (pos) {
98
this.pos = pos.copy();
109
} else {
@@ -14,30 +13,29 @@ function Cell(pos, r, c) {
1413
this.r = r || 60;
1514
this.c = c || color(random(100, 255), 0, random(100, 255), 100);
1615

17-
this.clicked = function (x, y) {
16+
this.clicked = function(x, y) {
1817
var d = dist(this.pos.x, this.pos.y, x, y);
1918
if (d < this.r) {
2019
return true;
2120
} else {
2221
return false;
2322
}
24-
}
23+
};
2524

26-
this.mitosis = function () {
25+
this.mitosis = function() {
2726
//this.pos.x += random(-this.r, this.r);
2827
var cell = new Cell(this.pos, this.r * 0.8, this.c);
2928
return cell;
30-
}
29+
};
3130

32-
this.move = function () {
31+
this.move = function() {
3332
var vel = p5.Vector.random2D();
3433
this.pos.add(vel);
35-
}
34+
};
3635

37-
this.show = function () {
36+
this.show = function() {
3837
noStroke();
3938
fill(this.c);
40-
ellipse(this.pos.x, this.pos.y, this.r, this.r)
41-
}
42-
43-
}
39+
ellipse(this.pos.x, this.pos.y, this.r, this.r);
40+
};
41+
}

CodingChallenges/CC_006_Mitosis/P5/sketch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ function mousePressed() {
2727
cells.splice(i, 1);
2828
}
2929
}
30-
}
30+
}

0 commit comments

Comments
 (0)