Skip to content

Commit

Permalink
lint exercises: bowling, change, circular-buffer (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
trvrfrd authored and tejasbubane committed Oct 29, 2018
1 parent c261c3f commit a56d10b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
allergies
alphametics
bowling
change
circular-buffer
clock
complex-numbers
connect
Expand Down
3 changes: 1 addition & 2 deletions exercises/circular-buffer/circular-buffer.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import circularBuffer from './circular-buffer';
import { BufferFullError, BufferEmptyError } from './circular-buffer';
import circularBuffer, { BufferFullError, BufferEmptyError } from './circular-buffer';

describe('CircularBuffer', () => {
test('reading an empty buffer throws a BufferEmptyError', () => {
Expand Down
11 changes: 7 additions & 4 deletions exercises/circular-buffer/example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let buffer,
bufferMax;
let buffer;
let bufferMax;

export class BufferEmptyError extends Error {
constructor(message) {
Expand All @@ -25,7 +25,7 @@ const write = (value) => {
if (buffer.length === bufferMax) {
throw new BufferFullError();
}
value ? buffer.push(value) : null;
return value ? buffer.push(value) : null;
};

const forceWrite = (value) => {
Expand All @@ -35,7 +35,10 @@ const forceWrite = (value) => {
write(value);
};

const clear = () => buffer = [];
const clear = () => {
buffer = [];
return buffer;
};

const CircularBuffer = (capacity) => {
buffer = [];
Expand Down

0 comments on commit a56d10b

Please sign in to comment.