Skip to content

Commit ec05de0

Browse files
authored
chore(examples): lint examples/network using shared top-level eslint config (#2908)
Refs: #2891
1 parent e63b4df commit ec05de0

File tree

4 files changed

+69
-13
lines changed

4 files changed

+69
-13
lines changed

examples/network/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
const baseConfig = require('../../eslint.config');
20+
21+
module.exports = {
22+
...baseConfig,
23+
env: {
24+
node: true,
25+
},
26+
};

examples/network/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

examples/network/client.js

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
'use strict';
218

319
const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
@@ -6,14 +22,19 @@ const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
622
const { NetInstrumentation } = require('@opentelemetry/instrumentation-net');
723
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns');
824
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
9-
const { SimpleSpanProcessor, ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
25+
const {
26+
SimpleSpanProcessor,
27+
ConsoleSpanExporter,
28+
} = require('@opentelemetry/sdk-trace-base');
1029
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
1130

1231
const provider = new NodeTracerProvider({
1332
spanProcessors: [
14-
new SimpleSpanProcessor(new JaegerExporter({
15-
serviceName: 'http-client',
16-
})),
33+
new SimpleSpanProcessor(
34+
new JaegerExporter({
35+
serviceName: 'http-client',
36+
})
37+
),
1738
new SimpleSpanProcessor(new ConsoleSpanExporter()),
1839
],
1940
});
@@ -39,14 +60,20 @@ require('dns');
3960
const https = require('https');
4061
const http = require('http');
4162

42-
http.get('http://opentelemetry.io/', () => {}).on('error', (e) => {
43-
console.error(e);
44-
});
63+
http
64+
.get('http://opentelemetry.io/', () => {})
65+
.on('error', e => {
66+
console.error(e);
67+
});
4568

46-
https.get('https://opentelemetry.io/', () => {}).on('error', (e) => {
47-
console.error(e);
48-
});
69+
https
70+
.get('https://opentelemetry.io/', () => {})
71+
.on('error', e => {
72+
console.error(e);
73+
});
4974

50-
https.get('https://opentelemetry.io/', { ca: [] }, () => {}).on('error', (e) => {
51-
console.error(e);
52-
});
75+
https
76+
.get('https://opentelemetry.io/', { ca: [] }, () => {})
77+
.on('error', e => {
78+
console.error(e);
79+
});

examples/network/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"description": "Example of NET & TLS integration with OpenTelemetry",
66
"main": "index.js",
77
"scripts": {
8+
"lint": "eslint . --ext=ts,js,mjs",
9+
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
810
"zipkin:client": "cross-env EXPORTER=zipkin node ./client.js",
911
"jaeger:client": "cross-env EXPORTER=jaeger node ./client.js"
1012
},

0 commit comments

Comments
 (0)