Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update create-react-app to 2.1.2 #301

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@
/* import */
"import/prefer-default-export": 1,
"import/no-named-default": 0,
"import/extensions": 0,

"new-cap": [2, {
"capIsNewExceptions": [
"Immutable.Map",
"Immutable.List",
"Immutable.Set"
]
}]
"import/extensions": 0
}
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"private": true,
"license": "Apache-2.0",
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.5.0",
"babel-eslint": "9.x.x",
"eslint": "5.6.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-config-prettier": "^2.3.0",
"eslint-config-react-app": "^2.0.0",
Expand All @@ -16,7 +16,8 @@
"husky": "^0.14.3",
"lerna": "^2.10.2",
"lint-staged": "^7.0.4",
"prettier": "^1.10.2"
"prettier": "^1.10.2",
"rxjs-compat": "6.3.3"
},
"workspaces": ["packages/*"],
"scripts": {
Expand Down
39 changes: 25 additions & 14 deletions packages/jaeger-ui/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,38 @@
// limitations under the License.

/* eslint-disable import/no-extraneous-dependencies */

const path = require('path');
const fs = require('fs');
const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
const lessToJs = require('less-vars-to-js');
const rewireBabelLoader = require('react-app-rewire-babel-loader');

const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);

// Read the less file in as string
// Convert less vars to JS
const loadedVarOverrides = fs.readFileSync('config-overrides-antd-vars.less', 'utf8');

// Pass in file contents
const modifyVars = lessToJs(loadedVarOverrides);

module.exports = function override(_config, env) {
function webpack(_config, env) {
let config = _config;
config = injectBabelPlugin(['import', { libraryName: 'antd', style: true }], config);
config = rewireLess.withLoaderOptions({ modifyVars })(config, env);
config = rewireBabelLoader.include(config, resolveApp('../../node_modules/drange'));
config = rewireLess.withLoaderOptions({
modifyVars,
javascriptEnabled: true,
})(config, env);
config = injectBabelPlugin(
['import', { libraryName: 'antd', style: true, libraryDirectory: 'lib' }],
config
);
return config;
};
}

// Don't use react-app-rewired/scripts/utils/babelTransform.js for the jest
// transform - it has an issue with automatically loading decorators.
function jest(config) {
const _config = config;
Object.keys(_config.transform).forEach(key => {
if (_config.transform[key].endsWith('babelTransform.js')) {
_config.transform[key] = require.resolve('./jest-babel-transform.js');
}
});
return config;
}

module.exports = { jest, webpack };
23 changes: 23 additions & 0 deletions packages/jaeger-ui/jest-babel-transform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2019 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// eslint-disable-next-line import/no-extraneous-dependencies
const babelJest = require('babel-jest');

// Derived from react-app-rewired/scripts/utils/babelTransform.js
module.exports = babelJest.createTransformer({
presets: [require.resolve('babel-preset-react-app')],
plugins: [],
babelrc: true,
});
23 changes: 7 additions & 16 deletions packages/jaeger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,19 @@
"version": "0.0.1",
"main": "src/index.js",
"license": "Apache-2.0",
"proxy": {
"/api": {
"target": "http://localhost:16686",
"logLevel": "silent",
"secure": false,
"changeOrigin": true,
"ws": true,
"xfwd": true
}
},
"homepage": ".",
"devDependencies": {
"babel-plugin-import": "^1.6.3",
"babel-plugin-import": "1.11.0",
"bluebird": "^3.5.0",
"enzyme": "^3.2.0",
"enzyme-adapter-react-16": "^1.1.0",
"enzyme-to-json": "^3.3.0",
"http-proxy-middleware": "^0.19.1",
"less-vars-to-js": "^1.2.1",
"react-app-rewire-babel-loader": "^0.1.1",
"react-app-rewire-less": "^2.1.0",
"react-app-rewired": "^1.4.0",
"react-scripts": "^1.0.11",
"react-app-rewire-less": "2.1.3",
"react-app-rewired": "2.0.2-next.0",
"react-scripts": "2.1.2",
"react-test-renderer": "^15.6.1",
"sinon": "^3.2.1",
"source-map-explorer": "^1.6.0"
Expand All @@ -47,7 +38,6 @@
"history": "^4.6.3",
"is-promise": "^2.1.0",
"isomorphic-fetch": "^2.2.1",
"jest": "^21.2.1",
"json-markup": "^1.1.0",
"lodash": "^4.17.4",
"logfmt": "^1.2.0",
Expand Down Expand Up @@ -96,5 +86,6 @@
"!src/utils/test/**/*.js",
"!src/demo/**/*.js"
]
}
},
"browserslist": [">0.2%", "not dead", "not ie <= 11", "not op_mini all"]
}
4 changes: 3 additions & 1 deletion packages/jaeger-ui/src/api/jaeger.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const JaegerAPI = {
return getJSON(`${this.apiRoot}services/${encodeURIComponent(serviceName)}/operations`);
},
fetchDependencies(endTs = new Date().getTime(), lookback = DEFAULT_DEPENDENCY_LOOKBACK) {
return getJSON(`${this.apiRoot}dependencies`, { query: { endTs, lookback } });
return getJSON(`${this.apiRoot}dependencies`, {
query: { endTs, lookback },
});
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ describe('mapStateToProps()', () => {

describe('mapDispatchToProps()', () => {
it('providers the `fetchDependencies` prop', () => {
expect(mapDispatchToProps({})).toEqual({ fetchDependencies: expect.any(Function) });
expect(mapDispatchToProps({})).toEqual({
fetchDependencies: expect.any(Function),
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export default class ResultItem extends React.PureComponent<Props> {
<li key={name} className="ub-inline-block ub-m1">
<Tag
className="ResultItem--serviceTag"
style={{ borderLeftColor: colorGenerator.getColorByKey(name) }}
style={{
borderLeftColor: colorGenerator.getColorByKey(name),
}}
>
{name} ({count})
</Tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export default class ResultItemTitle extends React.PureComponent<Props> {
} = this.props;
// Use a div when the ResultItemTitle doesn't link to anything
let WrapperComponent = 'div';
const wrapperProps: { [string]: string } = { className: 'ResultItemTitle--item ub-flex-auto' };
const wrapperProps: { [string]: string } = {
className: 'ResultItemTitle--item ub-flex-auto',
};
if (linkTo) {
WrapperComponent = Link;
wrapperProps.to = linkTo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ describe('<SearchResults>', () => {
});

it('hide scatter plot if queryparam hideGraph', () => {
wrapper.setProps({ hideGraph: true, embed: true, getSearchURL: () => 'SEARCH_URL' });
wrapper.setProps({
hideGraph: true,
embed: true,
getSearchURL: () => 'SEARCH_URL',
});
expect(wrapper.find(ScatterPlot).length).toBe(0);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ describe('mapStateToProps()', () => {
state: fetchedState.DONE,
},
traces: {
[trace.traceID]: { id: trace.traceID, data: trace, state: fetchedState.DONE },
[trace.traceID]: {
id: trace.traceID,
data: trace,
state: fetchedState.DONE,
},
},
};
const stateServices = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export default class TraceDiffGraph extends React.PureComponent<Props> {

constructor(props: Props) {
super(props);
this.layoutManager = new LayoutManager({ useDotEdges: true, splines: 'polyline' });
this.layoutManager = new LayoutManager({
useDotEdges: true,
splines: 'polyline',
});
}

componentWillUnmount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ function archiveErred(state: TracesArchive, { meta, payload }: ArchiveAction) {
// make flow happy
throw new Error('Invalid state, missing API error details');
}
const traceArchive = { error: payload, isArchived: false, isError: true, isAcknowledged: false };
const traceArchive = {
error: payload,
isArchived: false,
isError: true,
isAcknowledged: false,
};
return { ...state, [meta.id]: traceArchive };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ export default class TraceGraph extends React.PureComponent<Props, State> {
showHelp: false,
mode: MODE_SERVICE,
};
this.layoutManager = new LayoutManager({ useDotEdges: true, splines: 'polyline' });
this.layoutManager = new LayoutManager({
useDotEdges: true,
splines: 'polyline',
});
}

componentWillUnmount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const getBgFillRect = items => ({
});

describe('renderIntoCanvas()', () => {
const basicItem = { valueWidth: 100, valueOffset: 50, serviceName: 'some-name' };
const basicItem = {
valueWidth: 100,
valueOffset: 50,
serviceName: 'some-name',
};

class CanvasContext {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ export default class ListView extends React.Component<ListViewProps> {
// _knownHeights is (item-key -> observed height) of list items
this._knownHeights = new Map();

this._startIndexDrawn = 2 ** 20;
this._endIndexDrawn = -(2 ** 20);
// eslint-disable-next-line no-bitwise
this._startIndexDrawn = 1 << 20;
this._endIndexDrawn = -this._startIndexDrawn;
this._startIndex = 0;
this._endIndex = 0;
this._viewHeight = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

import React from 'react';
import Bluebird from 'bluebird';
import { mount, shallow } from 'enzyme';

import ListView from './index';
Expand Down Expand Up @@ -205,14 +204,16 @@ describe('<ListView>', () => {
expect(eventListeners.scroll).toEqual([instance._onScroll]);
});

it('calls _positionList when the document is scrolled', async () => {
it('calls _positionList when the document is scrolled', done => {
const event = new Event('scroll');
const fn = jest.spyOn(instance, '_positionList');
expect(instance._isScrolledOrResized).toBe(false);
window.dispatchEvent(event);
expect(instance._isScrolledOrResized).toBe(true);
await Bluebird.resolve().delay(0);
expect(fn).toHaveBeenCalled();
window.requestAnimationFrame(() => {
expect(fn).toHaveBeenCalled();
done();
});
});

it('uses the root HTML element to determine if the view has changed', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ KeyValuesSummary.defaultProps = {
export default function AccordianKeyValues(props: AccordianKeyValuesProps) {
const { className, data, highContrast, isOpen, label, linksGetter, onToggle } = props;
const isEmpty = !Array.isArray(data) || !data.length;
const iconCls = cx('u-align-icon', { 'AccordianKeyValues--emptyIcon': isEmpty });
const iconCls = cx('u-align-icon', {
'AccordianKeyValues--emptyIcon': isEmpty,
});
return (
<div className={cx(className, 'u-tx-ellipsis')}>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ describe('<KeyValuesTable>', () => {
linksGetter: (array, i) =>
array[i].key === 'span.kind'
? [
{ url: `http://example.com/1?kind=${encodeURIComponent(array[i].value)}`, text: 'Example 1' },
{ url: `http://example.com/2?kind=${encodeURIComponent(array[i].value)}`, text: 'Example 2' },
{
url: `http://example.com/1?kind=${encodeURIComponent(array[i].value)}`,
text: 'Example 1',
},
{
url: `http://example.com/2?kind=${encodeURIComponent(array[i].value)}`,
text: 'Example 2',
},
]
: [],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ describe('<TimelineColumnResizer>', () => {

describe('uses DraggableManager', () => {
it('handles mouse down on the dragger', () => {
const dragger = wrapper.find({ onMouseDown: instance._dragManager.handleMouseDown });
const dragger = wrapper.find({
onMouseDown: instance._dragManager.handleMouseDown,
});
expect(dragger.length).toBe(1);
expect(dragger.is('.TimelineColumnResizer--dragger')).toBe(true);
});
Expand Down
Loading