Skip to content

Commit

Permalink
Convert and consume first types/ file
Browse files Browse the repository at this point in the history
Signed-off-by: Everett Ross <reverett@uber.com>
  • Loading branch information
everett980 committed Mar 12, 2019
1 parent 10d7d17 commit f4fab60
Show file tree
Hide file tree
Showing 42 changed files with 415 additions and 524 deletions.
28 changes: 14 additions & 14 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ This applies ESLint to the repo, as a whole. The TypeScript linting has a distin

This is an amalgamation of linting scripts that run to make sure things are all-good. It's run in CI (travis) and as part of a pre-commit hook.

- `prettier-lint`
- `tsc-lint`
- `eslint`
- `flow`
- `check-license`
* `prettier-lint`
* `tsc-lint`
* `eslint`
* `flow`
* `check-license`

#### `prepare`

Expand Down Expand Up @@ -90,15 +90,15 @@ Used to configure the `tsc-lint` script and, in theory, the IDE (such as VS Code

A few notable [compiler settings](http://www.typescriptlang.org/docs/handbook/compiler-options.html):

- `lib`
- [es2017](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es2017.d.ts)
- [dom](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts)
- [dom.iterable](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.iterable.d.ts)
- [webworker](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts)
- `skipLibCheck` - Maybe worth reevaluating in the future
- `strict` - Very important
- `noEmit` - We're using this for linting, after all
- `include` - We've included `./typgings` here because it turned out to be a lot simpler than configuring `types`, `typeRoots` and `paths`
* `lib`
* [es2017](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es2017.d.ts)
* [dom](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts)
* [dom.iterable](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.iterable.d.ts)
* [webworker](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts)
* `skipLibCheck` - Maybe worth reevaluating in the future
* `strict` - Very important
* `noEmit` - We're using this for linting, after all
* `include` - We've included `./typgings` here because it turned out to be a lot simpler than configuring `types`, `typeRoots` and `paths`

## `typings/{custom.d.ts, index.d.ts}`

Expand Down
144 changes: 72 additions & 72 deletions CHANGELOG.md

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ _Before making any significant changes, please [open an issue](https://github.co

Once we've discussed your changes and you've got your code ready, make sure that tests are passing and open your pull request. Your PR is most likely to be accepted if it:

- Includes tests for new functionality.
- References the original issue in description, e.g. "Resolves #123".
- Has a [good commit message](https://chris.beams.io/posts/git-commit/):
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain _what_ and _why_ instead of _how_
- Each commit must be signed by the author ([see below](#sign-your-work)).
* Includes tests for new functionality.
* References the original issue in description, e.g. "Resolves #123".
* Has a [good commit message](https://chris.beams.io/posts/git-commit/):
* Separate subject from body with a blank line
* Limit the subject line to 50 characters
* Capitalize the subject line
* Do not end the subject line with a period
* Use the imperative mood in the subject line
* Wrap the body at 72 characters
* Use the body to explain _what_ and _why_ instead of _how_
* Each commit must be signed by the author ([see below](#sign-your-work)).

## License

Expand Down Expand Up @@ -121,18 +121,18 @@ Finally, we generally adhere to the [Airbnb Style Guide](https://github.com/airb
# Cutting a Jaeger UI release

1. Determine the version for the release.
- Follow [semver.org](https://semver.org) to determine the new version for Jaeger UI.
- Review all changes since the last release to determine how, if at all, any externally facing APIs are impacted. This includes, but is not limited to, the UI config and URL routes such as deep-linking and configuring the embedded mode.
- Preface the version with a "v", e.g. `v1.0.0`.
* Follow [semver.org](https://semver.org) to determine the new version for Jaeger UI.
* Review all changes since the last release to determine how, if at all, any externally facing APIs are impacted. This includes, but is not limited to, the UI config and URL routes such as deep-linking and configuring the embedded mode.
* Preface the version with a "v", e.g. `v1.0.0`.
1. Create and merge, per approval, a PR which preps the release.
1. The PR title should match the format "Preparing release vX.Y.Z".
1. CHANGELOG.md
- Change the version of the current release from "Next (unreleased)" to "vX.Y.Z (Month D, YYYY)" where "vX.Y.Z" is the semver for this release.
- Make sure all relevant changes made since the last release are present and listed under the current release. [`scripts/get-changelog.js`](https://github.com/jaegertracing/jaeger-ui/blob/52780c897f21131472de9b81c96ebd63853917ee/scripts/get-changelog.js) might be useful.
- If necessary, add a note detailing any impact to externally facing APIs.
* Change the version of the current release from "Next (unreleased)" to "vX.Y.Z (Month D, YYYY)" where "vX.Y.Z" is the semver for this release.
* Make sure all relevant changes made since the last release are present and listed under the current release. [`scripts/get-changelog.js`](https://github.com/jaegertracing/jaeger-ui/blob/52780c897f21131472de9b81c96ebd63853917ee/scripts/get-changelog.js) might be useful.
* If necessary, add a note detailing any impact to externally facing APIs.
1. Update `packages/jaeger-ui/package.json#version` to refer to the version being released.
1. Create a GitHub release.
- The tag and release must refer to the commit created when the PR from the previous step was merged.
- The tag name for the GitHub release should be the version for the release. It should include the "v", e.g. `v1.0.0`.
- The title of the release match the format "Jaeger UI vX.Y.Z".
- Copy the new CHANGELOG.md section into the release notes.
* The tag and release must refer to the commit created when the PR from the previous step was merged.
* The tag name for the GitHub release should be the version for the release. It should include the "v", e.g. `v1.0.0`.
* The title of the release match the format "Jaeger UI vX.Y.Z".
* Copy the new CHANGELOG.md section into the release notes.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
"**/lodash": "4.17.11"
},
"workspaces": {
"packages": [
"packages/*"
],
"packages": ["packages/*"],
"nohoist": [
"**/customize-cra",
"**/customize-cra/**",
Expand All @@ -49,11 +47,14 @@
"coverage": "lerna run coverage",
"eslint": "eslint 'scripts/*.{js,ts,tsx}' 'packages/*/src/**/*.{js,ts,tsx}' 'packages/*/*.{js,ts,tsx}'",
"flow": "glow",
"lint": "yarn run prettier-lint && yarn run tsc-lint && yarn run eslint && yarn run flow && yarn run check-license",
"lint":
"yarn run prettier-lint && yarn run tsc-lint && yarn run eslint && yarn run flow && yarn run check-license",
"prepare": "lerna run --stream --sort prepublishOnly",
"prettier-comment": "https://github.com/yarnpkg/yarn/issues/6300",
"prettier": "./node_modules/prettier/bin-prettier.js --write '{.,scripts}/*.{js,json,md,ts,tsx}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md,ts,tsx}' 'packages/*/*.{css,js,json,md,ts,tsx}'",
"prettier-lint": "./node_modules/prettier/bin-prettier.js --list-different '{.,scripts}/*.{js,json,md,ts,tsx}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md,ts,tsx}' 'packages/*/*.{css,js,json,md,ts,tsx}'",
"prettier":
"./node_modules/prettier/bin-prettier.js --write '{.,scripts}/*.{js,json,md,ts,tsx}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md,ts,tsx}' 'packages/*/*.{css,js,json,md,ts,tsx}'",
"prettier-lint":
"./node_modules/prettier/bin-prettier.js --list-different '{.,scripts}/*.{js,json,md,ts,tsx}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md,ts,tsx}' 'packages/*/*.{css,js,json,md,ts,tsx}'",
"test": "lerna run test",
"tsc-lint": "tsc",
"tsc-lint-debug": "tsc --listFiles",
Expand Down
14 changes: 5 additions & 9 deletions packages/jaeger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"logfmt": "^1.2.0",
"moment": "^2.18.1",
"prop-types": "^15.5.10",
"query-string": "^5.0.0",
"query-string": "^6.3.0",
"raven-js": "^3.22.1",
"react": "^16.3.2",
"react-copy-to-clipboard": "^5.0.1",
Expand All @@ -70,7 +70,7 @@
"react-icons": "2.2.7",
"react-metrics": "^2.3.2",
"react-redux": "^5.0.6",
"react-router-dom": "^4.1.2",
"react-router-dom": "^4.3.1",
"react-router-redux": "5.0.0-alpha.6",
"react-virtualized-select": "^3.1.0",
"react-vis": "^1.7.2",
Expand All @@ -91,7 +91,8 @@
"analyze": "source-map-explorer build/static/js/main.*",
"build": "REACT_APP_VSN_STATE=$(../../scripts/get-tracking-version.js) react-app-rewired build",
"coverage": "yarn run test -- --coverage",
"start:ga-debug": "REACT_APP_GA_DEBUG=1 REACT_APP_VSN_STATE=$(../../scripts/get-tracking-version.js) react-app-rewired start",
"start:ga-debug":
"REACT_APP_GA_DEBUG=1 REACT_APP_VSN_STATE=$(../../scripts/get-tracking-version.js) react-app-rewired start",
"start": "react-app-rewired start",
"test-dev": "react-app-rewired test --env=jsdom",
"test": "CI=1 react-app-rewired test --env=jsdom --color"
Expand All @@ -105,10 +106,5 @@
"!src/demo/**/*.js"
]
},
"browserslist": [
">0.5%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
"browserslist": [">0.5%", "not dead", "not ie <= 11", "not op_mini all"]
}
5 changes: 1 addition & 4 deletions packages/jaeger-ui/src/components/DependencyGraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,4 @@ export function mapDispatchToProps(dispatch) {
return { fetchDependencies };
}

export default connect(
mapStateToProps,
mapDispatchToProps
)(DependencyGraphPageImpl);
export default connect(mapStateToProps, mapDispatchToProps)(DependencyGraphPageImpl);
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,7 @@ function mapDispatchToProps(dispatch) {
};
}

export default connect(
mapStateToProps,
mapDispatchToProps
)(
export default connect(mapStateToProps, mapDispatchToProps)(
reduxForm({
form: 'searchSideBar',
})(SearchFormImpl)
Expand Down
9 changes: 2 additions & 7 deletions packages/jaeger-ui/src/components/SearchTracePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ export class SearchTracePageImpl extends Component {
{showErrors && (
<div className="js-test-error-message">
<h2>There was an error querying for traces:</h2>
{errors.map(err => (
<ErrorMessage key={err.message} error={err} />
))}
{errors.map(err => <ErrorMessage key={err.message} error={err} />)}
</div>
)}
{!showErrors && (
Expand Down Expand Up @@ -284,7 +282,4 @@ function mapDispatchToProps(dispatch) {
};
}

export default connect(
mapStateToProps,
mapDispatchToProps
)(SearchTracePageImpl);
export default connect(mapStateToProps, mapDispatchToProps)(SearchTracePageImpl);
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @flow

// Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,9 +17,9 @@ import { matchPath } from 'react-router-dom';

import prefixUrl from '../../utils/prefix-url';

import type { SearchQuery } from '../../types/search';
import { SearchQuery } from '../../types/search'; // eslint-disable-line no-unused-vars

function eqEq(a: ?(string | number), b: ?(string | number)) {
function eqEq(a: string | number | null | undefined, b: string | number | null | undefined) {
return (a == null && b == null) || String(a) === String(b);
}

Expand All @@ -33,7 +31,7 @@ export function matches(path: string) {
return Boolean(matchPath(path, ROUTE_MATCHER));
}

export function getUrl(query?: ?Object) {
export function getUrl(query?: Object | null | undefined) {
const search = query ? `?${queryString.stringify(query)}` : '';
return prefixUrl(`/search${search}`);
}
Expand Down
5 changes: 1 addition & 4 deletions packages/jaeger-ui/src/components/TraceDiff/TraceDiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,4 @@ export function mapDispatchToProps(dispatch: Function) {
return { fetchMultipleTraces, forceState };
}

export default connect(
mapStateToProps,
mapDispatchToProps
)(TraceDiffImpl);
export default connect(mapStateToProps, mapDispatchToProps)(TraceDiffImpl);
8 changes: 4 additions & 4 deletions packages/jaeger-ui/src/components/TraceDiff/TraceDiff.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ describe('TraceDiff', () => {

// This test may false negative if previous tests are failing
it('builds tracesData Map from cohort and state.trace.traces', () => {
const {
tracesData,
cohort: { length: expectedSize },
} = mapStateToProps(makeTestReduxState(), getOwnProps());
const { tracesData, cohort: { length: expectedSize } } = mapStateToProps(
makeTestReduxState(),
getOwnProps()
);
defaultCohortIds.forEach(id => {
expect(tracesData.get(id)).toEqual({
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class DiffNode extends React.PureComponent<Props> {
{isSame ? null : (
<td className={`DiffNode--metricCell ${className}`}>
<span className="DiffNode--metricSymbol">{chgSign}</span>
{a === 0 || b === 0 ? 100 : abs(((a - b) / max(a, b)) * 100).toFixed(0)}
{a === 0 || b === 0 ? 100 : abs((a - b) / max(a, b) * 100).toFixed(0)}
<span className="DiffNode--metricSymbol">%</span>
</td>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,7 @@ describe('CohortTable', () => {
it('renders TraceName fragment when given complete data', () => {
const traceNameColumnRenderer = getRowRenderer('traceName');
const testTrace = cohort[0];
const {
id,
error,
state,
data: { traceName },
} = testTrace;
const { id, error, state, data: { traceName } } = testTrace;
const renderedTraceNameColumn = shallow(
// traceNameRenderer returns a React Fragment, wrapper div helps enzyme
<div>{traceNameColumnRenderer('unused argument', testTrace)}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export function calculateTraceDag(trace: Trace): TraceDag<SumSpan> {
count: n.members.length,
errors: numErrors,
time: ntime,
percent: (100 / trace.duration) * ntime,
percent: 100 / trace.duration * ntime,
selfTime: stime,
percentSelfTime: (100 / ntime) * stime,
percentSelfTime: 100 / ntime * stime,
};
// eslint-disable-next-line no-param-reassign
n.data = nd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function GraphTicks(props: GraphTicksProps) {
const ticks = [];
// i starts at 1, limit is `i < numTicks` so the first and last ticks aren't drawn
for (let i = 1; i < numTicks; i++) {
const x = `${(i / numTicks) * 100}%`;
const x = `${i / numTicks * 100}%`;
ticks.push(<line className="GraphTick" x1={x} y1="0%" x2={x} y2="100%" key={i / numTicks} />);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default function renderIntoCanvas(
ctx.fillRect(0, 0, cWidth, cHeight);
for (let i = 0; i < items.length; i++) {
const { valueWidth, valueOffset, serviceName } = items[i];
const x = (valueOffset / totalValueWidth) * cWidth;
let width = (valueWidth / totalValueWidth) * cWidth;
const x = valueOffset / totalValueWidth * cWidth;
let width = valueWidth / totalValueWidth * cWidth;
if (width < MIN_ITEM_WIDTH) {
width = MIN_ITEM_WIDTH;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ describe('renderIntoCanvas()', () => {
const color = expectedColors[i].output;
const fillStyle = `rgba(${color.concat(ITEM_ALPHA).join()})`;
const height = MIN_TOTAL_HEIGHT / items.length;
const width = (valueWidth / totalValueWidth) * getCanvasWidth();
const x = (valueOffset / totalValueWidth) * getCanvasWidth();
const width = valueWidth / totalValueWidth * getCanvasWidth();
const x = valueOffset / totalValueWidth * getCanvasWidth();
const y = height * i;
return { fillStyle, height, width, x, y };
}),
Expand Down Expand Up @@ -177,9 +177,9 @@ describe('renderIntoCanvas()', () => {
const color = expectedColors[i].output;
const fillStyle = `rgba(${color.concat(ITEM_ALPHA).join()})`;
const height = MIN_ITEM_HEIGHT;
const width = Math.max(MIN_ITEM_WIDTH, (valueWidth / totalValueWidth) * getCanvasWidth());
const x = (valueOffset / totalValueWidth) * getCanvasWidth();
const y = (MAX_TOTAL_HEIGHT / items.length) * i;
const width = Math.max(MIN_ITEM_WIDTH, valueWidth / totalValueWidth * getCanvasWidth());
const x = valueOffset / totalValueWidth * getCanvasWidth();
const y = MAX_TOTAL_HEIGHT / items.length * i;
return { fillStyle, height, width, x, y };
}),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,15 @@ export function TracePageHeaderFn(props: TracePageHeaderEmbedProps) {
)}
</div>
{summaryItems && <LabeledList className="TracePageHeader--overviewItems" items={summaryItems} />}
{!hideMap && !slimView && (
<SpanGraph
trace={trace}
viewRange={viewRange}
updateNextViewRangeTime={updateNextViewRangeTime}
updateViewRangeTime={updateViewRangeTime}
/>
)}
{!hideMap &&
!slimView && (
<SpanGraph
trace={trace}
viewRange={viewRange}
updateNextViewRangeTime={updateNextViewRangeTime}
updateViewRangeTime={updateViewRangeTime}
/>
)}
</header>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@ export default class Positions {
return known | 0;
}
// eslint-disable-next-line no-bitwise
return ((known / (this.lastI + 1)) * this.heights.length) | 0;
return (known / (this.lastI + 1) * this.heights.length) | 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ export default class SpanBarRow extends React.PureComponent<SpanBarRowProps> {
traceStartTime,
span,
} = this.props;
const {
duration,
hasChildren: isParent,
operationName,
process: { serviceName },
} = span;
const { duration, hasChildren: isParent, operationName, process: { serviceName } } = span;
const label = formatDuration(duration);
const viewBounds = getViewedBounds(span.startTime, span.startTime + span.duration);
const viewStart = viewBounds.start;
Expand Down
Loading

0 comments on commit f4fab60

Please sign in to comment.