Skip to content

Commit

Permalink
chore: update typescript to 4.x and gts to 3.x (#336)
Browse files Browse the repository at this point in the history
Update typescript and gts to new major versions.

Additionally update eslint and plugins to latest versions and fix some other minor issues like repository field in package.json.
  • Loading branch information
Flarna authored Feb 9, 2021
1 parent b13740d commit 17d9445
Show file tree
Hide file tree
Showing 32 changed files with 78 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenTelemetry SDK resource detector for GitHub",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"clean": "rimraf build/*",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
Expand Down Expand Up @@ -49,15 +49,15 @@
"@types/node": "14.0.27",
"@types/sinon": "9.0.4",
"codecov": "3.7.2",
"gts": "2.0.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nock": "13.0.5",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "9.0.2",
"ts-mocha": "8.0.0",
"ts-node": "8.10.2",
"typescript": "3.9.7"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"name": "opentelemetry-contrib",
"version": "0.12.1",
"version": "0.13.0",
"description": "This is a repository for OpenTelemetry JavaScript contributions.",
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/open-telemetry/opentelemetry-js-contrib.git"
},
"repository": "open-telemetry/opentelemetry-js-contrib",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -44,15 +41,15 @@
"@commitlint/config-conventional": "11.0.0",
"@typescript-eslint/eslint-plugin": "4.3.0",
"@typescript-eslint/parser": "4.3.0",
"eslint": "7.4.0",
"eslint": "7.19.0",
"eslint-config-airbnb-base": "14.2.0",
"eslint-plugin-header": "3.0.0",
"eslint-plugin-import": "2.22.0",
"gts": "2.0.2",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.22.1",
"gts": "3.1.0",
"husky": "4.2.5",
"lerna": "3.22.1",
"lerna-changelog": "1.0.1",
"typescript": "3.9.6"
"typescript": "4.1.3"
},
"husky": {
"hooks": {
Expand Down
Empty file.
8 changes: 4 additions & 4 deletions packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"clean": "rimraf build/*",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"compile": "npm run version:update && tsc -p .",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"prepare": "npm run compile",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down Expand Up @@ -47,7 +47,7 @@
"@types/node": "14.0.27",
"@types/sinon": "9.0.4",
"codecov": "3.8.0",
"gts": "2.0.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"mock-require": "3.0.3",
"nan": "2.14.2",
Expand All @@ -58,7 +58,7 @@
"ts-loader": "8.0.7",
"ts-mocha": "8.0.0",
"ts-node": "8.10.2",
"typescript": "3.9.7"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-host-metrics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
},
"include": [
"src/**/*.ts",
"scripts/**/*.js",
"test/**/*.ts"
]
}
4 changes: 0 additions & 4 deletions packages/opentelemetry-host-metrics/tslint.json

This file was deleted.

6 changes: 3 additions & 3 deletions packages/opentelemetry-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"prepare": "npm run compile",
"watch": "tsc -w"
},
"repository": "open-telemetry/opentelemetry-js",
"repository": "open-telemetry/opentelemetry-js-contrib",
"keywords": [
"opentelemetry",
"test-utils"
Expand All @@ -25,11 +25,11 @@
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"devDependencies": {
"@types/node": "14.6.0",
"gts": "2.0.2",
"gts": "3.1.0",
"ts-node": "9.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.6"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "0.15.0",
Expand Down
6 changes: 2 additions & 4 deletions plugins/node/opentelemetry-hapi-instrumentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
"@types/node": "12.12.47",
"@types/shimmer": "1.0.1",
"codecov": "3.7.0",
"eslint": "7.8.1",
"eslint-plugin-header": "3.1.0",
"gts": "2.0.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
Expand All @@ -61,7 +59,7 @@
"ts-node": "9.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.6"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ describe('Hapi Instrumentation - Hapi.Plugin Tests', () => {
const rootSpan = tracer.startSpan('rootSpan');
// Suppress this ts error due the Hapi plugin type definition is incomplete. server.register can accept nested plugin. See reference https://hapi.dev/api/?v=20.0.0#-routeoptionshandler
await server.register({
// @ts-ignore
plugin: nestedPackagePlugin,
plugin: nestedPackagePlugin as any,
});
await server.start();
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenTelemetry @opentelemetry/instrumentation-graphql automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"clean": "rimraf build/*",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
Expand Down Expand Up @@ -50,15 +50,15 @@
"@types/semver": "7.3.1",
"codecov": "3.7.2",
"graphql": "15.4.0",
"gts": "2.0.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"semver": "7.3.2",
"shimmer": "1.2.1",
"ts-mocha": "8.0.0",
"ts-node": "8.10.2",
"typescript": "3.9.7"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
11 changes: 5 additions & 6 deletions plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,14 @@ export function getOperation(
if (operationName) {
return document.definitions
.filter(
definition => OPERATION_VALUES.indexOf(definition?.operation) !== -1
)
.find(
definition =>
operationName === (definition.name && definition.name.value)
);
OPERATION_VALUES.indexOf((definition as any)?.operation) !== -1
)
.find(definition => operationName === (definition as any)?.name?.value);
} else {
return document.definitions.find(
definition => OPERATION_VALUES.indexOf(definition?.operation) !== -1
definition =>
OPERATION_VALUES.indexOf((definition as any)?.operation) !== -1
);
}
}
Expand Down
6 changes: 2 additions & 4 deletions plugins/node/opentelemetry-koa-instrumentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
"@types/node": "12.12.47",
"@types/shimmer": "1.0.1",
"codecov": "3.7.1",
"eslint": "7.8.1",
"eslint-plugin-header": "3.1.0",
"gts": "2.0.2",
"gts": "3.1.0",
"koa": "2.13.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
Expand All @@ -64,7 +62,7 @@
"ts-node": "9.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.6"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Koa Instrumentation - Router Tests', () => {

app = new koa();
server = http.createServer(app.callback());
await new Promise(resolve => server.listen(0, resolve));
await new Promise<void>(resolve => server.listen(0, resolve));
port = (server.address() as AddressInfo).port;
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Koa Instrumentation - Core Tests', () => {

app = new koa();
server = http.createServer(app.callback());
await new Promise(resolve => server.listen(0, resolve));
await new Promise<void>(resolve => server.listen(0, resolve));
port = (server.address() as AddressInfo).port;
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
});
Expand Down
6 changes: 3 additions & 3 deletions plugins/node/opentelemetry-plugin-dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenTelemetry dns automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down Expand Up @@ -49,7 +49,7 @@
"@types/shimmer": "1.0.1",
"@types/sinon": "9.0.4",
"codecov": "3.7.2",
"gts": "2.0.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
Expand All @@ -58,7 +58,7 @@
"ts-node": "9.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.7"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
3 changes: 1 addition & 2 deletions plugins/node/opentelemetry-plugin-dns/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ export const setLookupAttributes = (
/**
* Check whether the given obj match pattern
* @param constant e.g URL of request
* @param obj obj to inspect
* @param pattern Match pattern
*/
export const satisfiesPattern = <T>(
export const satisfiesPattern = (
constant: string,
pattern: IgnoreMatcher
): boolean => {
Expand Down
7 changes: 3 additions & 4 deletions plugins/node/opentelemetry-plugin-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenTelemetry express automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
Expand Down Expand Up @@ -50,17 +50,16 @@
"@types/node": "14.0.27",
"@types/shimmer": "1.0.1",
"codecov": "3.7.2",
"eslint-plugin-header": "3.1.1",
"express": "4.17.1",
"gts": "2.0.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"ts-node": "9.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.7"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ describe('Express Plugin', () => {
return res.status(200).end('test');
});
const server = http.createServer(app);
await new Promise(resolve => server.listen(0, resolve));
await new Promise<void>(resolve => server.listen(0, resolve));
const port = (server.address() as AddressInfo).port;
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
const res = await httpRequest.get(`http://localhost:${port}/toto/tata`);
Expand All @@ -341,7 +341,7 @@ describe('Express Plugin', () => {
return next();
});
const server = http.createServer(app);
await new Promise(resolve => server.listen(0, resolve));
await new Promise<void>(resolve => server.listen(0, resolve));

const port = (server.address() as AddressInfo).port;
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
Expand Down Expand Up @@ -400,7 +400,7 @@ describe('Express Plugin', () => {
});

server = http.createServer(app);
await new Promise(resolve => server.listen(0, resolve));
await new Promise<void>(resolve => server.listen(0, resolve));
});

afterEach(() => {
Expand Down Expand Up @@ -458,7 +458,7 @@ describe('Express Plugin', () => {
return next();
});
const server = http.createServer(app);
await new Promise(resolve => server.listen(0, resolve));
await new Promise<void>(resolve => server.listen(0, resolve));
const port = (server.address() as AddressInfo).port;
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
await context.with(setSpan(context.active(), rootSpan), async () => {
Expand Down
6 changes: 3 additions & 3 deletions plugins/node/opentelemetry-plugin-ioredis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenTelemetry ioredis automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"test:debug": "cross-env RUN_REDIS_TESTS_LOCAL=true ts-mocha --inspect-brk --no-timeouts -p tsconfig.json 'test/**/*.test.ts'",
Expand Down Expand Up @@ -54,7 +54,7 @@
"@types/shimmer": "1.0.1",
"codecov": "3.7.2",
"cross-env": "7.0.2",
"gts": "2.0.2",
"gts": "3.1.0",
"ioredis": "4.17.3",
"mocha": "7.2.0",
"nyc": "15.1.0",
Expand All @@ -63,7 +63,7 @@
"ts-node": "9.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.7"
"typescript": "4.1.3"
},
"dependencies": {
"@opentelemetry/api": "^0.15.0",
Expand Down
Loading

0 comments on commit 17d9445

Please sign in to comment.