diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 130e33111b2..6514f81e816 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -41,7 +41,8 @@ jobs: metapackages/*/package-lock.json packages/*/package-lock.json integration-tests/*/package-lock.json - key: ${{ runner.os }}-lint-${{ hashFiles('**/package.json') }} + # increment the trailing number to break the cache manually + key: ${{ runner.os }}-lint-${{ hashFiles('**/package.json') }}-0 # On a cache hit, use ci to speed up the install process - name: Bootstrap (cache hit) diff --git a/eslint.config.js b/eslint.config.js index 938de96c054..a1514132f95 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,11 +1,10 @@ module.exports = { plugins: [ "@typescript-eslint", - "header" - ], - extends: [ - "./node_modules/gts", + "header", + "node" ], + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], parser: "@typescript-eslint/parser", parserOptions: { "project": "./tsconfig.json" @@ -13,6 +12,7 @@ module.exports = { rules: { "@typescript-eslint/no-floating-promises": 2, "@typescript-eslint/no-this-alias": "off", + "brace-style": ["error", "1tbs"], "eqeqeq": [ "error", "smart" @@ -32,8 +32,14 @@ module.exports = { "@typescript-eslint/no-shadow": ["warn"], "@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_", "args": "after-used"}], "@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }], + "@typescript-eslint/no-empty-function": ["off"], + "@typescript-eslint/ban-types": ["warn", { + "types": { + "Function": null, + } + }], + "@typescript-eslint/no-shadow": ["warn"], "arrow-parens": ["error", "as-needed"], - "prettier/prettier": ["error", { "singleQuote": true, "arrowParens": "avoid" }], "node/no-deprecated-api": ["warn"], "header/header": [2, "block", [{ pattern: / \* Copyright The OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm, @@ -53,6 +59,9 @@ module.exports = { "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-shadow": ["off"], + "@typescript-eslint/no-floating-promises": ["off"], + "@typescript-eslint/no-non-null-assertion": ["off"], + "@typescript-eslint/explicit-module-boundary-types": ["off"] } } ] diff --git a/package.json b/package.json index b71d1f0fd26..506c7c1dada 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,8 @@ "eslint-config-airbnb-base": "14.2.1", "eslint-plugin-header": "3.1.1", "eslint-plugin-import": "2.22.1", + "eslint-plugin-node": "^11.1.0", "gh-pages": "3.1.0", - "gts": "3.1.0", "husky": "4.3.8", "lerna": "3.22.1", "lerna-changelog": "1.0.1", diff --git a/packages/opentelemetry-api-metrics/package.json b/packages/opentelemetry-api-metrics/package.json index 19dd39a057a..27a71227d9d 100644 --- a/packages/opentelemetry-api-metrics/package.json +++ b/packages/opentelemetry-api-metrics/package.json @@ -61,7 +61,6 @@ "@types/node": "14.14.43", "@types/webpack-env": "1.16.0", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 790af59ff82..7cca3257e20 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -45,7 +45,6 @@ "@types/node": "14.14.43", "@types/shimmer": "1.0.1", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index c5c0e6f68df..c2ad6c8fb2f 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -54,7 +54,6 @@ "@types/zone.js": "0.5.12", "babel-loader": "8.2.2", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index b1f19d0ded4..caf9420685f 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -49,7 +49,6 @@ "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", "codecov": "3.8.1", - "gts": "3.1.0", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-mocha": "2.0.1", diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 9fdbb2dc24c..b20b593560b 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -62,7 +62,6 @@ "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-collector-grpc/package.json index 88713dc2a9e..a259e72bf15 100644 --- a/packages/opentelemetry-exporter-collector-grpc/package.json +++ b/packages/opentelemetry-exporter-collector-grpc/package.json @@ -53,7 +53,6 @@ "@types/sinon": "9.0.11", "codecov": "3.8.1", "cpx": "1.5.0", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-collector-proto/package.json index ba9637f6e10..a3f606d8599 100644 --- a/packages/opentelemetry-exporter-collector-proto/package.json +++ b/packages/opentelemetry-exporter-collector-proto/package.json @@ -53,7 +53,6 @@ "@types/sinon": "9.0.11", "codecov": "3.8.1", "cpx": "1.5.0", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index c35b3374d4f..1e743a9af79 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -62,7 +62,6 @@ "babel-loader": "8.2.2", "codecov": "3.8.1", "cpx": "1.5.0", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 139dbe447d7..7399629051a 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -46,7 +46,6 @@ "@types/node": "14.14.43", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts index e482133cf70..9e5c3f0055f 100644 --- a/packages/opentelemetry-exporter-jaeger/src/types.ts +++ b/packages/opentelemetry-exporter-jaeger/src/types.ts @@ -37,13 +37,15 @@ export interface ExporterConfig { // Below require is needed as jaeger-client types does not expose the thrift, // udp_sender, util etc. modules. -export const UDPSender = - require('jaeger-client/dist/src/reporters/udp_sender').default; +/* eslint-disable @typescript-eslint/no-var-requires */ +export const UDPSender = require('jaeger-client/dist/src/reporters/udp_sender') + .default; export const Utils = require('jaeger-client/dist/src/util').default; export const ThriftUtils = require('jaeger-client/dist/src/thrift').default; -export const HTTPSender = - require('jaeger-client/dist/src/reporters/http_sender').default; +export const HTTPSender = require('jaeger-client/dist/src/reporters/http_sender') + .default; +/* eslint-enable @typescript-eslint/no-var-requires */ export type TagValue = string | number | boolean; diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json index 27e7d6a2d11..8477905ad19 100644 --- a/packages/opentelemetry-exporter-prometheus/package.json +++ b/packages/opentelemetry-exporter-prometheus/package.json @@ -44,7 +44,6 @@ "@types/node": "14.14.43", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 748b18216da..d485b87b624 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -59,7 +59,6 @@ "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-instrumentation-fetch/package.json b/packages/opentelemetry-instrumentation-fetch/package.json index f45017bba8a..0a1090ed832 100644 --- a/packages/opentelemetry-instrumentation-fetch/package.json +++ b/packages/opentelemetry-instrumentation-fetch/package.json @@ -58,7 +58,6 @@ "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-instrumentation-grpc/package.json b/packages/opentelemetry-instrumentation-grpc/package.json index f4aefe3ca30..392911764cd 100644 --- a/packages/opentelemetry-instrumentation-grpc/package.json +++ b/packages/opentelemetry-instrumentation-grpc/package.json @@ -55,7 +55,6 @@ "@types/sinon": "9.0.11", "codecov": "3.8.1", "grpc": "1.24.7", - "gts": "3.1.0", "mocha": "7.2.0", "node-pre-gyp": "0.17.0", "nyc": "15.1.0", diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json index 976c69e1c10..a81677fb74c 100644 --- a/packages/opentelemetry-instrumentation-http/package.json +++ b/packages/opentelemetry-instrumentation-http/package.json @@ -55,7 +55,6 @@ "axios": "0.21.1", "codecov": "3.8.1", "got": "9.6.0", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json index af7cf75d355..603e2e52f2e 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -57,7 +57,6 @@ "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-instrumentation/package.json b/packages/opentelemetry-instrumentation/package.json index 409397964bc..511cda4985c 100644 --- a/packages/opentelemetry-instrumentation/package.json +++ b/packages/opentelemetry-instrumentation/package.json @@ -79,7 +79,6 @@ "babel-loader": "8.2.2", "codecov": "3.8.1", "cpx": "1.5.0", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index 58f825008e5..69b9eb9c88d 100644 --- a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -74,6 +74,7 @@ export abstract class InstrumentationBase return exports; } + // eslint-disable-next-line @typescript-eslint/no-var-requires const version = require(path.join(baseDir, 'package.json')).version; module.moduleVersion = version; if (module.name === name) { diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json index d00bcba7ddb..6978335b41d 100644 --- a/packages/opentelemetry-metrics/package.json +++ b/packages/opentelemetry-metrics/package.json @@ -50,7 +50,6 @@ "@types/node": "14.14.43", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-metrics/src/Meter.ts b/packages/opentelemetry-metrics/src/Meter.ts index d42c9f15c60..348c554dec0 100644 --- a/packages/opentelemetry-metrics/src/Meter.ts +++ b/packages/opentelemetry-metrics/src/Meter.ts @@ -31,6 +31,7 @@ import { UpDownCounterMetric } from './UpDownCounterMetric'; import { UpDownSumObserverMetric } from './UpDownSumObserverMetric'; import { ValueObserverMetric } from './ValueObserverMetric'; import { ValueRecorderMetric } from './ValueRecorderMetric'; +// eslint-disable-next-line @typescript-eslint/no-var-requires const merge = require('lodash.merge'); /** diff --git a/packages/opentelemetry-metrics/src/MeterProvider.ts b/packages/opentelemetry-metrics/src/MeterProvider.ts index b305456a9e9..b38243ae130 100644 --- a/packages/opentelemetry-metrics/src/MeterProvider.ts +++ b/packages/opentelemetry-metrics/src/MeterProvider.ts @@ -18,6 +18,7 @@ import * as api from '@opentelemetry/api-metrics'; import { Resource } from '@opentelemetry/resources'; import { Meter } from '.'; import { DEFAULT_CONFIG, MeterConfig } from './types'; +// eslint-disable-next-line @typescript-eslint/no-var-requires const merge = require('lodash.merge'); /** diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index 34da33956ef..5f31927896c 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -50,7 +50,6 @@ "@types/shimmer": "1.0.1", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index a93811d80ad..20d1cb93682 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -53,7 +53,6 @@ "@types/mocha": "8.2.2", "@types/node": "14.14.43", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "mocha": "7.2.0", "nyc": "15.1.0", diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 353765fef6e..156efa08fc9 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -53,7 +53,6 @@ "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-resource-detector-aws/package.json b/packages/opentelemetry-resource-detector-aws/package.json index d469dc43d56..0c436485fdc 100644 --- a/packages/opentelemetry-resource-detector-aws/package.json +++ b/packages/opentelemetry-resource-detector-aws/package.json @@ -44,7 +44,6 @@ "@types/node": "14.14.43", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json index a2a283c9ddd..abb647da0f4 100644 --- a/packages/opentelemetry-resource-detector-gcp/package.json +++ b/packages/opentelemetry-resource-detector-gcp/package.json @@ -45,7 +45,6 @@ "@types/node": "14.14.43", "@types/semver": "7.3.5", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 5c3c178771d..d8ae074e6e0 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -53,7 +53,6 @@ "@types/node": "14.14.43", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index 6de91cb1f3a..bbbb23e17e6 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -63,7 +63,6 @@ "@types/sinon": "9.0.11", "codecov": "3.8.1", "gcp-metadata": "^4.1.4", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "mocha": "7.2.0", "nyc": "15.1.0", diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index a2e90a7450a..9394b076568 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -47,7 +47,6 @@ "@types/node": "14.14.43", "@types/sinon": "9.0.11", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index 30ecc063f49..2a3f2b1ee20 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -45,7 +45,6 @@ "@types/mocha": "8.2.2", "@types/node": "14.14.43", "codecov": "3.8.1", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json index 4fe9a038bcc..f67ef5f0cb4 100644 --- a/packages/opentelemetry-tracing/package.json +++ b/packages/opentelemetry-tracing/package.json @@ -60,7 +60,6 @@ "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts index 436bf313a75..4166d773942 100644 --- a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts +++ b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts @@ -34,6 +34,7 @@ import { DEFAULT_CONFIG } from './config'; import { MultiSpanProcessor } from './MultiSpanProcessor'; import { NoopSpanProcessor } from './export/NoopSpanProcessor'; import { SDKRegistrationConfig, TracerConfig } from './types'; +// eslint-disable-next-line @typescript-eslint/no-var-requires const merge = require('lodash.merge'); import { SpanExporter } from './export/SpanExporter'; import { BatchSpanProcessor } from './export/BatchSpanProcessor'; diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json index e0d73f1716d..3e5d84a8567 100644 --- a/packages/opentelemetry-web/package.json +++ b/packages/opentelemetry-web/package.json @@ -57,7 +57,6 @@ "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", "codecov": "3.8.1", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", diff --git a/packages/template/package.json b/packages/template/package.json index aeefcf09f51..4c4901cff6b 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -88,8 +88,5 @@ "karma-spec-reporter": "0.0.32", "karma-webpack": "4.0.2", "webpack": "4.44.2" - }, - "Add these to devDependencies for linting": { - "gts": "3.1.0" } }