Skip to content

Commit

Permalink
Merge branch 'master' into global
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 committed May 21, 2020
2 parents 45aa44b + 05e7bb9 commit bfbcc11
Show file tree
Hide file tree
Showing 178 changed files with 598 additions and 580 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ jobs:
- checkout
- run:
name: Install minimal doc and lint modules globally
command: npm i -g tslint lerna typedoc linkinator typescript tslint-consistent-codestyle tslint-microsoft-contrib
command: npm i -g eslint eslint-plugin-node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-header eslint-plugin-import eslint-plugin-prettier prettier lerna typedoc linkinator typescript
- run:
name: Install gts version 1.1.0 globally
command: npm i -g gts@1.1.0
name: Install gts version 2.0.0 globally
command: npm i -g gts@2.0.0
- run:
name: Symlink global modules into all lerna packages
command: lerna exec 'npm link tslint lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib'
command: lerna exec 'npm link eslint gts eslint-plugin-node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-header eslint-plugin-import eslint-plugin-prettier prettier lerna typedoc linkinator typescript'
- run:
name: Check code style and linting
command: npm run lint
Expand Down
49 changes: 49 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module.exports = {
plugins: [
"@typescript-eslint",
"header"
],
extends: [
"./node_modules/gts",
],
parser: "@typescript-eslint/parser",
parserOptions: {
"project": "./tsconfig.json"
},
rules: {
"@typescript-eslint/no-this-alias": "off",
"eqeqeq": "off",
"prefer-rest-params": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "memberLike",
"modifiers": ["private", "protected"],
"format": ["camelCase"],
"leadingUnderscore": "require"
}
],
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
"arrow-parens": ["error", "as-needed"],
"prettier/prettier": ["error", { "singleQuote": true, "arrowParens": "avoid" }],
"node/no-deprecated-api": ["warn"],
"header/header": [2, "block", [{
pattern: / \* Copyright \d{4}, 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,
template:
`\n * Copyright ${new Date().getFullYear()}, OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n `
}]]
},
overrides: [
{
"files": ["test/**/*.ts"],
"rules": {
"no-empty": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
]
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-header": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"gh-pages": "^2.1.1",
"gts": "^1.1.0",
"gts": "^2.0.0",
"husky": "^3.0.9",
"lerna": "^3.17.0",
"lerna-changelog": "^1.0.0",
"tslint": "^5.0.0",
"typescript": "^3.7.2"
},
"husky": {
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-api/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
8 changes: 8 additions & 0 deletions packages/opentelemetry-api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
"env": {
"mocha": true,
"commonjs": true,
"shared-node-browser": true
},
...require('../../eslint.config.js')
}
8 changes: 3 additions & 5 deletions packages/opentelemetry-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"build": "npm run compile",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down Expand Up @@ -58,7 +58,7 @@
"@types/node": "^12.6.8",
"@types/webpack-env": "1.13.9",
"codecov": "^3.6.1",
"gts": "^1.1.0",
"gts": "^2.0.0",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^5.0.5",
"karma-chrome-launcher": "^3.1.0",
Expand All @@ -71,8 +71,6 @@
"nyc": "^15.0.0",
"ts-loader": "^6.0.4",
"ts-mocha": "^7.0.0",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typedoc": "^0.15.0",
"typescript": "3.7.2",
"webpack": "^4.35.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/metrics/Metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export interface UnboundMetric<T> extends Metric {

export interface Counter extends UnboundMetric<BoundCounter> {
/**
* Adds the given value to the current value. Values cannot be negative.
* Adds the given value to the current value. Values cannot be negative.
*/
add(value: number, labels?: Labels): void;
}

export interface Measure extends UnboundMetric<BoundMeasure> {
/**
* Records the given value to this measure.
* Records the given value to this measure.
*/
record(value: number, labels?: Labels): void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { Logger } from '../../common/Logger';
import { TracerProvider } from '../tracer_provider';

/** Interface Plugin to apply patch. */
// tslint:disable-next-line:no-any
export interface Plugin<T = any> {
/**
* Contains all supported versions.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 0 additions & 4 deletions packages/opentelemetry-api/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/opentelemetry-context-async-hooks/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions packages/opentelemetry-context-async-hooks/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../eslint.config.js')
}
10 changes: 4 additions & 6 deletions packages/opentelemetry-context-async-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand All @@ -28,7 +28,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": ">=8.0.0"
"node": ">=8.1.0"
},
"files": [
"build/src/**/*.js",
Expand All @@ -45,14 +45,12 @@
"@types/node": "^12.6.8",
"@types/shimmer": "^1.0.1",
"codecov": "^3.6.1",
"gts": "^1.1.0",
"gts": "^2.0.0",
"mocha": "^7.1.2",
"nyc": "^15.0.0",
"rimraf": "^3.0.0",
"ts-mocha": "^7.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export class AsyncHooksContextManager implements ContextManager {
}
try {
return fn();
} catch (err) {
throw err;
} finally {
if (oldContext === undefined) {
this._destroy(uid);
Expand All @@ -110,8 +108,6 @@ export class AsyncHooksContextManager implements ContextManager {
}
try {
return await fn();
} catch (err) {
throw err;
} finally {
if (oldContext === undefined) {
this._destroy(uid);
Expand Down Expand Up @@ -147,7 +143,7 @@ export class AsyncHooksContextManager implements ContextManager {

private _bindFunction<T extends Function>(target: T, context: Context): T {
const manager = this;
const contextWrapper = function(this: {}, ...args: unknown[]) {
const contextWrapper = function (this: {}, ...args: unknown[]) {
return manager.with(context, () => target.apply(this, args));
};
Object.defineProperty(contextWrapper, 'length', {
Expand All @@ -160,7 +156,6 @@ export class AsyncHooksContextManager implements ContextManager {
* It isn't possible to tell Typescript that contextWrapper is the same as T
* so we forced to cast as any here.
*/
// tslint:disable-next-line:no-any
return contextWrapper as any;
}

Expand Down Expand Up @@ -208,7 +203,7 @@ export class AsyncHooksContextManager implements ContextManager {
* @param original reference to the patched method
*/
private _patchRemoveListener(ee: PatchedEventEmitter, original: Function) {
return function(this: {}, event: string, listener: Func<void>) {
return function (this: {}, event: string, listener: Func<void>) {
if (
ee.__ot_listeners === undefined ||
ee.__ot_listeners[event] === undefined
Expand All @@ -231,7 +226,7 @@ export class AsyncHooksContextManager implements ContextManager {
ee: PatchedEventEmitter,
original: Function
) {
return function(this: {}, event: string) {
return function (this: {}, event: string) {
if (
ee.__ot_listeners === undefined ||
ee.__ot_listeners[event] === undefined
Expand All @@ -256,7 +251,7 @@ export class AsyncHooksContextManager implements ContextManager {
context: Context
) {
const contextManager = this;
return function(this: {}, event: string, listener: Func<void>) {
return function (this: {}, event: string, listener: Func<void>) {
if (ee.__ot_listeners === undefined) ee.__ot_listeners = {};
let listeners = ee.__ot_listeners[event];
if (listeners === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-context-async-hooks/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-context-async-hooks/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('AsyncHooksContextManager', () => {
it('not awaited withAsync() inside with() should not restore context', done => {
const scope1 = '1' as any;
const scope2 = '2' as any;
let _done: boolean = false;
let _done = false;

contextManager.with(scope1, () => {
assert.strictEqual(contextManager.active(), scope1);
Expand Down
4 changes: 0 additions & 4 deletions packages/opentelemetry-context-async-hooks/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/opentelemetry-context-base/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions packages/opentelemetry-context-base/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../eslint.config.js')
}
8 changes: 3 additions & 5 deletions packages/opentelemetry-context-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down Expand Up @@ -46,14 +46,12 @@
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"codecov": "^3.6.1",
"gts": "^1.1.0",
"gts": "^2.0.0",
"mocha": "^7.1.2",
"nyc": "^15.0.0",
"rimraf": "^3.0.0",
"ts-mocha": "^7.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
}
}
4 changes: 2 additions & 2 deletions packages/opentelemetry-context-base/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-context-base/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 0 additions & 4 deletions packages/opentelemetry-context-base/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/opentelemetry-context-zone-peer-dep/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
11 changes: 11 additions & 0 deletions packages/opentelemetry-context-zone-peer-dep/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
"env": {
"mocha": true,
"browser": true,
"commonjs": true
},
"globals": {
"Zone": "readonly"
},
...require('../../eslint.config.js')
}
Loading

0 comments on commit bfbcc11

Please sign in to comment.