Skip to content

Commit

Permalink
Enable no-var in eslint (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and alexander-fenster committed Sep 18, 2018
1 parent 5aca94f commit c0025c4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-vision/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ rules:
block-scoped-var: error
eqeqeq: error
no-warning-comments: warn
no-var: error
6 changes: 3 additions & 3 deletions packages/google-cloud-vision/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ let _coerceRequest = (request, callback) => {
* @returns {function} The function that, when called, will call annotateImage
* asking for the single feature annotation.
*/
var _createSingleFeatureMethod = featureValue => {
let _createSingleFeatureMethod = featureValue => {
return function(annotateImageRequest, callOptions, callback) {
// Sanity check: If we got a string or buffer, we need this to be
// in object form now, so we can tack on the features list.
Expand Down Expand Up @@ -152,7 +152,7 @@ var _createSingleFeatureMethod = featureValue => {
* onto the pure GAPIC.
*/
module.exports = apiVersion => {
var methods = {};
let methods = {};

/**
* Annotate a single image with the requested features.
Expand Down Expand Up @@ -236,7 +236,7 @@ module.exports = apiVersion => {

// We are guaranteed to only have one response element, since we
// only sent one image.
var response = r.responses[0];
let response = r.responses[0];

// Fire the callback if applicable.
return callback(undefined, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ describe('ImageAnnotatorSmokeTest', () => {
it('successfully makes a call to the service', done => {
const vision = require('../src');

var client = new vision.v1p3beta1.ImageAnnotatorClient({
let client = new vision.v1p3beta1.ImageAnnotatorClient({
// optional auth parameters.
});

var gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg';
var source = {
let gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg';
let source = {
gcsImageUri: gcsImageUri,
};
var image = {
let image = {
source: source,
};
var type = 'FACE_DETECTION';
var featuresElement = {
let type = 'FACE_DETECTION';
let featuresElement = {
type: type,
};
var features = [featuresElement];
var requestsElement = {
let features = [featuresElement];
let requestsElement = {
image: image,
features: features,
};
var requests = [requestsElement];
let requests = [requestsElement];
client
.batchAnnotateImages({requests: requests})
.then(responses => {
var response = responses[0];
let response = responses[0];
console.log(response);
})
.then(done)
Expand Down
20 changes: 10 additions & 10 deletions packages/google-cloud-vision/system-test/vision-v1p2beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ describe('ImageAnnotatorSmokeTest', () => {
it('successfully makes a call to the service', done => {
const vision = require('../src');

var client = new vision.v1p2beta1.ImageAnnotatorClient({
let client = new vision.v1p2beta1.ImageAnnotatorClient({
// optional auth parameters.
});

var gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg';
var source = {
let gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg';
let source = {
gcsImageUri: gcsImageUri,
};
var image = {
let image = {
source: source,
};
var type = 'FACE_DETECTION';
var featuresElement = {
let type = 'FACE_DETECTION';
let featuresElement = {
type: type,
};
var features = [featuresElement];
var requestsElement = {
let features = [featuresElement];
let requestsElement = {
image: image,
features: features,
};
var requests = [requestsElement];
let requests = [requestsElement];
client
.batchAnnotateImages({requests: requests})
.then(responses => {
var response = responses[0];
let response = responses[0];
console.log(response);
})
.then(done)
Expand Down
14 changes: 7 additions & 7 deletions packages/google-cloud-vision/system-test/vision.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,30 @@ describe('Vision', function() {
});

it('should detect from a URL', () => {
var url = 'https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png';
let url = 'https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png';
return client.logoDetection(url).then(responses => {
var response = responses[0];
let response = responses[0];
assert.deepStrictEqual(response.logoAnnotations[0].description, 'Google');
});
});

it('should detect from a filename', () => {
return client.logoDetection(IMAGES.logo).then(responses => {
var response = responses[0];
let response = responses[0];
assert.deepStrictEqual(response.logoAnnotations[0].description, 'Google');
});
});

it('should detect from a Buffer', () => {
var buffer = fs.readFileSync(IMAGES.logo);
let buffer = fs.readFileSync(IMAGES.logo);
return client.logoDetection(buffer).then(responses => {
var response = responses[0];
let response = responses[0];
assert.deepStrictEqual(response.logoAnnotations[0].description, 'Google');
});
});

describe('single image', () => {
var TYPES = [
let TYPES = [
{type: 'FACE_DETECTION'},
{type: 'LABEL_DETECTION'},
{type: 'SAFE_SEARCH_DETECTION'},
Expand All @@ -115,7 +115,7 @@ describe('Vision', function() {
image: {source: {filename: IMAGES.rushmore}},
})
.then(responses => {
var response = responses[0];
let response = responses[0];
assert(response.faceAnnotations.length >= 1);
assert(response.labelAnnotations.length >= 1);
assert(response.safeSearchAnnotation !== null);
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-vision/test/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('Vision helper methods', () => {

// Ensure that the annotateImage method arrifies the request and
// passes it through to the batch annotation method.
var request = {
let request = {
image: {content: Buffer.from('bogus==')},
features: {type: ['LOGO_DETECTION']},
};
Expand Down

0 comments on commit c0025c4

Please sign in to comment.