Skip to content

Commit

Permalink
Fix lint and add lint to travis build
Browse files Browse the repository at this point in the history
  • Loading branch information
cozmo committed Jan 4, 2018
1 parent eff0155 commit 937d967
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ deploy:
branch: master
email: cosmo.wolfe@gmail.com
api_key: $NPM_API_TOKEN
script: npm run-script lint && npm test
2 changes: 1 addition & 1 deletion src/decoder/decodeData/BitStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class BitStream {
result = (this.bytes[this.byteOffset] & mask) >> bitsToNotRead;
numBits -= toRead;
this.bitOffset += toRead;
if (this.bitOffset == 8) {
if (this.bitOffset === 8) {
this.bitOffset = 0;
this.byteOffset++;
}
Expand Down
8 changes: 4 additions & 4 deletions src/extractor/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BitMatrix} from "../BitMatrix";
import {QRLocation, Point} from "../locator";
import {Point, QRLocation} from "../locator";

interface PerspectiveTransform {
a11: number;
Expand Down Expand Up @@ -96,8 +96,8 @@ export function extract(image: BitMatrix, location: QRLocation) {
return {
x: (transform.a11 * x + transform.a21 * y + transform.a31) / denominator,
y: (transform.a12 * x + transform.a22 * y + transform.a32) / denominator,
}
}
};
};

for (let y = 0; y < location.dimension; y++) {
for (let x = 0; x < location.dimension; x++) {
Expand All @@ -110,6 +110,6 @@ export function extract(image: BitMatrix, location: QRLocation) {

return {
matrix,
mappingFunction
mappingFunction,
};
}
14 changes: 7 additions & 7 deletions src/locator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const MIN_QUAD_RATIO = 0.5;
const MAX_QUAD_RATIO = 1.5;

export interface Point {
x: number,
y: number,
x: number;
y: number;
}

export interface QRLocation {
Expand Down Expand Up @@ -305,11 +305,11 @@ export function locate(matrix: BitMatrix): QRLocation {
}
}
}
finderPatternQuads.push(...activeFinderPatternQuads.filter(q => q.bottom.y !== y && q.bottom.y - q.top.y >= 2))
activeFinderPatternQuads = activeFinderPatternQuads.filter(q => q.bottom.y === y)
finderPatternQuads.push(...activeFinderPatternQuads.filter(q => q.bottom.y !== y && q.bottom.y - q.top.y >= 2));
activeFinderPatternQuads = activeFinderPatternQuads.filter(q => q.bottom.y === y);

alignmentPatternQuads.push(...activeAlignmentPatternQuads.filter(q => q.bottom.y !== y))
activeAlignmentPatternQuads = activeAlignmentPatternQuads.filter(q => q.bottom.y === y)
alignmentPatternQuads.push(...activeAlignmentPatternQuads.filter(q => q.bottom.y !== y));
activeAlignmentPatternQuads = activeAlignmentPatternQuads.filter(q => q.bottom.y === y);

}

Expand Down Expand Up @@ -352,7 +352,7 @@ export function locate(matrix: BitMatrix): QRLocation {
}

const { topRight, topLeft, bottomLeft } = reorderFinderPatterns(
finderPatternGroups[0].points[0], finderPatternGroups[0].points[1], finderPatternGroups[0].points[2]
finderPatternGroups[0].points[0], finderPatternGroups[0].points[1], finderPatternGroups[0].points[2],
);

// Now that we've found the three finder patterns we can determine the blockSize and the size of the QR code.
Expand Down

0 comments on commit 937d967

Please sign in to comment.