Skip to content

Commit

Permalink
Enable prefer-const in the eslint config (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Sep 20, 2018
1 parent 340262a commit 6bbee3a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dialogflow/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function streamingDetectIntent(

// The BCP-47 language code to use, e.g. 'en-US'
// const languageCode = 'en-US';
let sessionPath = sessionClient.sessionPath(projectId, sessionId);
const sessionPath = sessionClient.sessionPath(projectId, sessionId);

const initialStreamRequest = {
session: sessionPath,
Expand Down
36 changes: 18 additions & 18 deletions dialogflow/detect.v2beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ function createKnowledgeBase(projectId, displayName) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow client.
let client = new dialogflow.KnowledgeBasesClient();
const client = new dialogflow.KnowledgeBasesClient();

/**
* TODO(developer): Uncomment the following lines before running the sample.
*/
// const projectId = 'ID of GCP project associated with your Dialogflow agent';
// const displayName = `your knowledge base display name, e.g. myKnowledgeBase`;

let formattedParent = client.projectPath(projectId);
let knowledgeBase = {
const formattedParent = client.projectPath(projectId);
const knowledgeBase = {
displayName: displayName,
};
let request = {
const request = {
parent: formattedParent,
knowledgeBase: knowledgeBase,
};
Expand All @@ -62,7 +62,7 @@ function getKnowledgeBase(projectId, knowledgeBaseId) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow client.
let client = new dialogflow.KnowledgeBasesClient({
const client = new dialogflow.KnowledgeBasesClient({
projectId: projectId,
});

Expand All @@ -71,7 +71,7 @@ function getKnowledgeBase(projectId, knowledgeBaseId) {
*/
// const projectId = 'ID of GCP project associated with your Dialogflow agent';
// const knowledgeBaseFullName = `the full path of your knowledge base, e.g my-Gcloud-project/myKnowledgeBase`;
let formattedName = client.knowledgeBasePath(projectId, knowledgeBaseId);
const formattedName = client.knowledgeBasePath(projectId, knowledgeBaseId);
client
.getKnowledgeBase({
name: formattedName,
Expand All @@ -93,7 +93,7 @@ function listKnowledgeBases(projectId) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow KnowledgeBasesClient.
let client = new dialogflow.KnowledgeBasesClient({
const client = new dialogflow.KnowledgeBasesClient({
projectPath: projectId,
});

Expand All @@ -102,12 +102,12 @@ function listKnowledgeBases(projectId) {
*/
// const projectId = 'ID of GCP project associated with your Dialogflow agent';

let formattedParent = client.projectPath(projectId);
const formattedParent = client.projectPath(projectId);

client
.listKnowledgeBases({parent: formattedParent})
.then(responses => {
let resources = responses[0];
const resources = responses[0];
resources.forEach(r => {
console.log(`displayName: ${r.displayName}`);
console.log(`name: ${r.name}`);
Expand All @@ -125,7 +125,7 @@ function deleteKnowledgeBase(projectId, knowledgeBaseFullName) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow KnowledgeBasesClient.
let client = new dialogflow.KnowledgeBasesClient();
const client = new dialogflow.KnowledgeBasesClient();

/**
* TODO(developer): Uncomment the following lines before running the sample.
Expand Down Expand Up @@ -160,7 +160,7 @@ function createDocument(
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow Documents client.
let client = new dialogflow.DocumentsClient({
const client = new dialogflow.DocumentsClient({
projectId: projectId,
});

Expand All @@ -174,7 +174,7 @@ function createDocument(
// const knowledgeTypes = `The Knowledge type of the Document. e.g. FAQ`;
// const mimeType = `The mime_type of the Document. e.g. text/csv, text/html,text/plain, text/pdf etc.`;

let request = {
const request = {
parent: knowledgeBaseFullName,
document: {
knowledgeTypes: [knowledgeTypes],
Expand Down Expand Up @@ -212,7 +212,7 @@ function listDocuments(projectId, knowledgeBaseFullName) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow Documents client.
let client = new dialogflow.DocumentsClient({
const client = new dialogflow.DocumentsClient({
projectId: projectId,
});

Expand All @@ -225,7 +225,7 @@ function listDocuments(projectId, knowledgeBaseFullName) {
client
.listDocuments({parent: knowledgeBaseFullName})
.then(responses => {
let resources = responses[0];
const resources = responses[0];
console.log(
`There are ${resources.length} documents in ${knowledgeBaseFullName}`
);
Expand All @@ -250,7 +250,7 @@ function getDocument(documentId) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow Documents client.
let client = new dialogflow.DocumentsClient({
const client = new dialogflow.DocumentsClient({
projectId: projectId,
});

Expand All @@ -262,7 +262,7 @@ function getDocument(documentId) {
client
.getDocument({name: documentId})
.then(responses => {
let r = responses[0];
const r = responses[0];
console.log(` KnowledgeType: ${r.knowledgeType}`);
console.log(` displayName: ${r.displayName}`);
console.log(` mimeType: ${r.mimeType}`);
Expand All @@ -282,7 +282,7 @@ function deleteDocument(projectId, documentId) {
const dialogflow = require('dialogflow').v2beta1;

// Instantiate a DialogFlow Documents client.
let client = new dialogflow.DocumentsClient({
const client = new dialogflow.DocumentsClient({
projectId: projectId,
});

Expand All @@ -295,7 +295,7 @@ function deleteDocument(projectId, documentId) {
client
.deleteDocument({name: documentId})
.then(responses => {
let operation = responses[0];
const operation = responses[0];
return operation.promise();
})
.then(responses => {
Expand Down
4 changes: 2 additions & 2 deletions dialogflow/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ function logContext(context) {
console.log(` Lifespan: ${context.lifespanCount}`);
console.log(` Parameters:`);
const parameters = structjson.structProtoToJson(context.parameters);
for (let k in parameters) {
for (const k in parameters) {
console.log(` ${k}: ${parameters[k]}`);
}
console.log('');
Expand Down Expand Up @@ -1426,7 +1426,7 @@ function verifyCommand(callback, force, projectId, arg2, arg3) {
},
},
function(err, result) {
let input = result.confirm.toLowerCase();
const input = result.confirm.toLowerCase();
// If the user didn't say yes/y, abort
if (input !== 'y' && input !== 'yes') {
console.log('Operation aborted.');
Expand Down
2 changes: 1 addition & 1 deletion dialogflow/structjson.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

function jsonToStructProto(json) {
const fields = {};
for (let k in json) {
for (const k in json) {
fields[k] = jsonValueToProto(json[k]);
}

Expand Down

0 comments on commit 6bbee3a

Please sign in to comment.