Skip to content

Commit 2c57d49

Browse files
committed
linting fixes
1 parent b663872 commit 2c57d49

File tree

54 files changed

+403
-388
lines changed

Some content is hidden

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

54 files changed

+403
-388
lines changed

google-analytics-admin/quickstart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function main() {
5858
// [END analytics_admin_quickstart]
5959
}
6060

61-
process.on('unhandledRejection', err => {
61+
process.on('unhandledRejection', (err) => {
6262
console.error(err.message);
6363
process.exitCode = 1;
6464
});
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
import { defineConfig } from "eslint/config";
2-
import globals from "globals";
3-
import path from "node:path";
4-
import { fileURLToPath } from "node:url";
5-
import js from "@eslint/js";
6-
import { FlatCompat } from "@eslint/eslintrc";
1+
import {defineConfig} from 'eslint/config';
2+
import globals from 'globals';
3+
import path from 'node:path';
4+
import {fileURLToPath} from 'node:url';
5+
import js from '@eslint/js';
6+
import {FlatCompat} from '@eslint/eslintrc';
77

88
const __filename = fileURLToPath(import.meta.url);
99
const __dirname = path.dirname(__filename);
1010
const compat = new FlatCompat({
11-
baseDirectory: __dirname,
12-
recommendedConfig: js.configs.recommended,
13-
allConfig: js.configs.all
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all,
1414
});
1515

16-
const googleConfig = compat.extends("google");
16+
const googleConfig = compat.extends('google');
1717
for (const config of googleConfig) {
18-
if (config.rules) {
19-
delete config.rules["valid-jsdoc"];
20-
delete config.rules["require-jsdoc"];
21-
}
18+
if (config.rules) {
19+
delete config.rules['valid-jsdoc'];
20+
delete config.rules['require-jsdoc'];
21+
}
2222
}
2323

2424
export default defineConfig([
25-
...googleConfig,
26-
{
27-
files: ["**/*.js"],
28-
languageOptions: {
29-
globals: {
30-
...globals.browser,
31-
...globals.commonjs,
32-
},
25+
...googleConfig,
26+
{
27+
files: ['**/*.js'],
28+
languageOptions: {
29+
globals: {
30+
...globals.browser,
31+
...globals.commonjs,
32+
},
3333

34-
ecmaVersion: "latest",
35-
sourceType: "script",
36-
},
34+
ecmaVersion: 'latest',
35+
sourceType: 'script',
36+
},
3737

38-
rules: {},
39-
}
40-
]);
38+
rules: {},
39+
},
40+
]);

google-analytics-data/get_common_metadata.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414

1515
'use strict';
1616

17-
/** Google Analytics Data API sample application retrieving dimension and metrics
18-
metadata.
19-
20-
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
21-
for more information.
22-
23-
Before you start the application, please review the comments starting with
24-
"TODO(developer)" and update the code to use correct values.
25-
26-
Usage:
27-
npm install
28-
node getCommonMetadata.js
17+
/**
18+
* Google Analytics Data API sample application retrieving dimension and metrics
19+
* metadata.
20+
*
21+
* See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
22+
* for more information.
23+
*
24+
* Before you start the application, please review the comments starting with
25+
* "TODO(developer)" and update the code to use correct values.
26+
*
27+
* Usage:
28+
* npm install
29+
* node getCommonMetadata.js
2930
*/
3031

3132
function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
@@ -43,13 +44,15 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
4344
// needs to be created once, and can be reused for multiple requests.
4445
const analyticsDataClient = new BetaAnalyticsDataClient();
4546

46-
// Retrieves dimensions and metrics available for all Google Analytics 4 properties.
47+
// Retrieves dimensions and metrics available for all Google Analytics 4
48+
// properties.
4749
async function getCommonMetadata() {
4850
const [response] = await analyticsDataClient.getMetadata({
4951
name: `properties/${propertyId}/metadata`,
5052
});
5153
console.log(
52-
'Dimensions and metrics available for all Google Analytics 4 properties:'
54+
'Dimensions and metrics available for all ' +
55+
'Google Analytics 4 properties:',
5356
);
5457
printGetMetadataResponse(response);
5558
}
@@ -58,11 +61,12 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
5861

5962
// Prints results of the getMetadata call.
6063
function printGetMetadataResponse(response) {
61-
//[START analyticsdata_print_get_metadata_response]
62-
response.dimensions.forEach(dimension => {
64+
// [START analyticsdata_print_get_metadata_response]
65+
response.dimensions.forEach((dimension) => {
6366
console.log('DIMENSION');
6467
console.log(
65-
`${dimension.apiName} (${dimension.uiName}): ${dimension.description}`
68+
`${dimension.apiName} (${dimension.uiName}): ` +
69+
`${dimension.description}`,
6670
);
6771
console.log(`custom definition: ${dimension.customDefinition}`);
6872
if (
@@ -74,10 +78,10 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
7478
console.log();
7579
});
7680

77-
response.metrics.forEach(metric => {
81+
response.metrics.forEach((metric) => {
7882
console.log('METRIC');
7983
console.log(
80-
`${metric.apiName} (${metric.uiName}): ${metric.description}`
84+
`${metric.apiName} (${metric.uiName}): ${metric.description}`,
8185
);
8286
console.log(`custom definition: ${metric.customDefinition}`);
8387
if (metric.expression) {
@@ -94,7 +98,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
9498
// [END analyticsdata_get_common_metadata]
9599
}
96100

97-
process.on('unhandledRejection', err => {
101+
process.on('unhandledRejection', (err) => {
98102
console.error(err.message);
99103
process.exitCode = 1;
100104
});

google-analytics-data/get_metadata_by_property_id.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414

1515
'use strict';
1616

17-
/** Google Analytics Data API sample application retrieving dimension and metrics
18-
metadata.
19-
20-
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
21-
for more information.
22-
23-
Before you start the application, please review the comments starting with
24-
"TODO(developer)" and update the code to use correct values.
25-
26-
Usage:
27-
npm install
28-
node getMetadataByPropertyId.js
17+
/**
18+
* Google Analytics Data API sample application retrieving dimension and metrics
19+
* metadata.
20+
*
21+
* See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
22+
* for more information.
23+
*
24+
* Before you start the application, please review the comments starting with
25+
* "TODO(developer)" and update the code to use correct values.
26+
*
27+
* Usage:
28+
* npm install
29+
* node getMetadataByPropertyId.js
2930
*/
3031

3132
function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
@@ -49,7 +50,8 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
4950
name: `properties/${propertyId}/metadata`,
5051
});
5152
console.log(
52-
`Dimensions and metrics available for a Google Analytics 4 property ${propertyId} (including custom fields):`
53+
'Dimensions and metrics available for a Google Analytics 4 ' +
54+
`property ${propertyId} (including custom fields):`,
5355
);
5456
printGetMetadataResponse(response);
5557
}
@@ -58,11 +60,12 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
5860

5961
// Prints results of the getMetadata call.
6062
function printGetMetadataResponse(response) {
61-
//[START analyticsdata_print_get_metadata_response]
62-
response.dimensions.forEach(dimension => {
63+
// [START analyticsdata_print_get_metadata_response]
64+
response.dimensions.forEach((dimension) => {
6365
console.log('DIMENSION');
6466
console.log(
65-
`${dimension.apiName} (${dimension.uiName}): ${dimension.description}`
67+
`${dimension.apiName} (${dimension.uiName}): ` +
68+
`${dimension.description}`,
6669
);
6770
console.log(`custom definition: ${dimension.customDefinition}`);
6871
if (
@@ -74,10 +77,10 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
7477
console.log();
7578
});
7679

77-
response.metrics.forEach(metric => {
80+
response.metrics.forEach((metric) => {
7881
console.log('METRIC');
7982
console.log(
80-
`${metric.apiName} (${metric.uiName}): ${metric.description}`
83+
`${metric.apiName} (${metric.uiName}): ${metric.description}`,
8184
);
8285
console.log(`custom definition: ${metric.customDefinition}`);
8386
if (metric.expression) {
@@ -94,7 +97,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
9497
// [END analyticsdata_get_metadata_by_property_id]
9598
}
9699

97-
process.on('unhandledRejection', err => {
100+
process.on('unhandledRejection', (err) => {
98101
console.error(err.message);
99102
process.exitCode = 1;
100103
});

google-analytics-data/quickstart_json_credentials.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID', credentialsJsonPath = '') {
7878
// [END analyticsdata_json_credentials_run_report]
7979

8080
console.log('Report result:');
81-
response.rows.forEach(row => {
81+
response.rows.forEach((row) => {
8282
console.log(row.dimensionValues[0], row.metricValues[0]);
8383
});
8484
}
@@ -87,7 +87,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID', credentialsJsonPath = '') {
8787
// [END analyticsdata_json_credentials_quickstart]
8888
}
8989

90-
process.on('unhandledRejection', err => {
90+
process.on('unhandledRejection', (err) => {
9191
console.error(err.message);
9292
process.exitCode = 1;
9393
});

google-analytics-data/quickstart_oauth2.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const destroyer = require('server-destroy');
3535

3636
// TODO(developer): Download the OAuth 2.0 client ID JSON from
3737
// https://console.cloud.google.com/apis/credentials for a Desktop or Web
38-
// client, and save it in the nodejs-docs-samples/google-analytics-data directory
39-
// in a file named oauth2.keys.json. If using a Web client, register
38+
// client, and save it in the nodejs-docs-samples/google-analytics-data
39+
// directory in a file named oauth2.keys.json. If using a Web client, register
4040
// http://127.0.0.1 as an authorized redirect URI.
4141
const keys = require('./oauth2.keys.json');
4242

@@ -49,8 +49,8 @@ async function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
4949
// Constructs a BetaAnalyticsDataClient using the credentials obtained above
5050
// instead of the Application Default Credentials.
5151
const credentials = grpc.credentials.combineChannelCredentials(
52-
grpc.credentials.createSsl(),
53-
grpc.credentials.createFromGoogleCredential(oAuth2Client)
52+
grpc.credentials.createSsl(),
53+
grpc.credentials.createFromGoogleCredential(oAuth2Client),
5454
);
5555
const analyticsDataClient = new BetaAnalyticsDataClient({
5656
sslCreds: credentials,

google-analytics-data/run_batch_report.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414

1515
'use strict';
1616

17-
/** Google Analytics Data API sample application demonstrating the batch creation
18-
of multiple reports.
19-
20-
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
21-
for more information.
22-
23-
Before you start the application, please review the comments starting with
24-
"TODO(developer)" and update the code to use correct values.
25-
26-
Usage:
27-
npm install
28-
node runBatchReport.js
17+
/**
18+
* Google Analytics Data API sample application demonstrating the batch creation
19+
* of multiple reports.
20+
*
21+
* See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
22+
* for more information.
23+
*
24+
* Before you start the application, please review the comments starting with
25+
* "TODO(developer)" and update the code to use correct values.
26+
*
27+
* Usage:
28+
* npm install
29+
* node runBatchReport.js
2930
*/
3031

3132
function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
@@ -93,7 +94,7 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
9394
});
9495

9596
console.log('Batch report results:');
96-
response.reports.forEach(report => {
97+
response.reports.forEach((report) => {
9798
printRunReportResponse(report);
9899
});
99100
}
@@ -102,31 +103,31 @@ function main(propertyId = 'YOUR-GA4-PROPERTY-ID') {
102103

103104
// Prints results of a runReport call.
104105
function printRunReportResponse(response) {
105-
//[START analyticsdata_print_run_report_response_header]
106+
// [START analyticsdata_print_run_report_response_header]
106107
console.log(`${response.rowCount} rows received`);
107-
response.dimensionHeaders.forEach(dimensionHeader => {
108+
response.dimensionHeaders.forEach((dimensionHeader) => {
108109
console.log(`Dimension header name: ${dimensionHeader.name}`);
109110
});
110-
response.metricHeaders.forEach(metricHeader => {
111+
response.metricHeaders.forEach((metricHeader) => {
111112
console.log(
112-
`Metric header name: ${metricHeader.name} (${metricHeader.type})`
113+
`Metric header name: ${metricHeader.name} (${metricHeader.type})`,
113114
);
114115
});
115-
//[END analyticsdata_print_run_report_response_header]
116+
// [END analyticsdata_print_run_report_response_header]
116117

117118
// [START analyticsdata_print_run_report_response_rows]
118119
console.log('Report result:');
119-
response.rows.forEach(row => {
120+
response.rows.forEach((row) => {
120121
console.log(
121-
`${row.dimensionValues[0].value}, ${row.metricValues[0].value}`
122+
`${row.dimensionValues[0].value}, ${row.metricValues[0].value}`,
122123
);
123124
});
124125
// [END analyticsdata_print_run_report_response_rows]
125126
}
126127
// [END analyticsdata_run_batch_report]
127128
}
128129

129-
process.on('unhandledRejection', err => {
130+
process.on('unhandledRejection', (err) => {
130131
console.error(err.message);
131132
process.exitCode = 1;
132133
});

0 commit comments

Comments
 (0)