Skip to content

Commit

Permalink
apply prettier styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed May 22, 2020
1 parent 64ad4f3 commit bf04235
Show file tree
Hide file tree
Showing 7,130 changed files with 31,405 additions and 37,175 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ELASTIC_LICENSE_HEADER = `
`;

const allMochaRulesOff = {};
Object.keys(require('eslint-plugin-mocha').rules).forEach(k => {
Object.keys(require('eslint-plugin-mocha').rules).forEach((k) => {
allMochaRulesOff['mocha/' + k] = 'off';
});

Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

require('./src/setup_node_env');

module.exports = function(grunt) {
module.exports = function (grunt) {
// set the config once before calling load-grunt-config
// and once during so that we have access to it via
// grunt.config.get() within the config files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const AlwaysFiringExpression: React.FunctionComponent<AlwaysFiringParamsP
<EuiFieldNumber
name="instances"
value={instances}
onChange={event => {
onChange={(event) => {
setAlertParams('instances', event.target.valueAsNumber);
}}
/>
Expand Down
10 changes: 5 additions & 5 deletions examples/alerting_example/public/alert_types/astros.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface PeopleinSpaceParamsProps {
}

function isValueInEnum(enumeratin: Record<string, any>, value: any): boolean {
return !!Object.values(enumeratin).find(enumVal => enumVal === value);
return !!Object.values(enumeratin).find((enumVal) => enumVal === value);
}

export function getAlertType(): AlertTypeModel {
Expand Down Expand Up @@ -139,7 +139,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam

const errorsCallout = flatten(
Object.entries(errors).map(([field, errs]: [string, string[]]) =>
errs.map(e => (
errs.map((e) => (
<p>
<EuiTextColor color="accent">{field}:</EuiTextColor>`: ${errs}`
</p>
Expand Down Expand Up @@ -189,7 +189,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam
<EuiSelect
compressed
value={craftTrigger.craft}
onChange={event => {
onChange={(event) => {
setAlertParams('craft', event.target.value);
setCraftTrigger({
craft: event.target.value,
Expand Down Expand Up @@ -238,7 +238,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam
<EuiSelect
compressed
value={outerSpaceCapacityTrigger.op}
onChange={event => {
onChange={(event) => {
setAlertParams('op', event.target.value);
setOuterSpaceCapacity({
...outerSpaceCapacityTrigger,
Expand All @@ -258,7 +258,7 @@ export const PeopleinSpaceExpression: React.FunctionComponent<PeopleinSpaceParam
<EuiFieldNumber
compressed
value={outerSpaceCapacityTrigger.outerSpaceCapacity}
onChange={event => {
onChange={(event) => {
setAlertParams('outerSpaceCapacity', event.target.valueAsNumber);
setOuterSpaceCapacity({
...outerSpaceCapacityTrigger,
Expand Down
5 changes: 1 addition & 4 deletions examples/alerting_example/server/alert_types/astros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ export const alertType: AlertType = {

if (getOperator(op)(peopleInCraft.length, outerSpaceCapacity)) {
peopleInCraft.forEach(({ craft, name }) => {
services
.alertInstanceFactory(name)
.replaceState({ craft })
.scheduleActions('default');
services.alertInstanceFactory(name).replaceState({ craft }).scheduleActions('default');
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const CountUntil: React.FC<Props> = ({ fetchStreaming }) => {
<EuiFieldNumber
placeholder="Some integer"
value={data}
onChange={e => setData(Number(e.target.value))}
onChange={(e) => setData(Number(e.target.value))}
/>
</EuiFormRow>
<EuiButton type="submit" fill onClick={handleSubmit}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ export const DoubleIntegers: React.FC<Props> = ({ double }) => {
setShowingResults(true);
const nums = numbers
.split('\n')
.map(num => num.trim())
.map((num) => num.trim())
.filter(Boolean)
.map(Number);
counter.set(nums.length);
nums.forEach(num => {
nums.forEach((num) => {
double({ num }).then(
result => {
(result) => {
if (!isMounted()) return;
counter.dec();
pushResult({ num, result });
},
error => {
(error) => {
if (!isMounted()) return;
counter.dec();
pushResult({ num, error });
Expand Down Expand Up @@ -94,7 +94,7 @@ export const DoubleIntegers: React.FC<Props> = ({ double }) => {
fullWidth
placeholder="Enter numbers in milliseconds separated by new line"
value={numbers}
onChange={e => setNumbers(e.target.value)}
onChange={(e) => setNumbers(e.target.value)}
/>
</EuiFormRow>
<EuiButton type="submit" fill onClick={handleSubmit}>
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/public/containers/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const App: React.FC = () => {
const routeElements: React.ReactElement[] = [];
for (const { items } of routes) {
for (const { id, component } of items) {
routeElements.push(<Route key={id} path={`/${id}`} render={props => component} />);
routeElements.push(<Route key={id} path={`/${id}`} render={(props) => component} />);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const Sidebar: React.FC<SidebarProps> = () => {
id,
name: title,
isSelected: true,
items: items.map(route => ({
items: items.map((route) => ({
id: route.id,
name: route.title,
onClick: () => history.push(`/${route.id}`),
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class BfetchExplorerPlugin implements Plugin {
// Validate inputs.
if (num < 0) throw new Error('Invalid number');
// Wait number of specified milliseconds.
await new Promise(r => setTimeout(r, num));
await new Promise((r) => setTimeout(r, num));
// Double the number and send it back.
return { num: 2 * num };
},
Expand Down
4 changes: 2 additions & 2 deletions examples/demo_search/server/async_demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const totalMap = new Map<string, number>();

export const asyncDemoSearchStrategyProvider: TSearchStrategyProvider<typeof ASYNC_DEMO_SEARCH_STRATEGY> = () => {
return {
search: async request => {
search: async (request) => {
const id = request.id ?? generateId();

const loaded = (loadedMap.get(id) ?? 0) + 1;
Expand All @@ -52,7 +52,7 @@ export const asyncDemoSearchStrategyProvider: TSearchStrategyProvider<typeof ASY
const fibonacciSequence = getFibonacciSequence(loaded);
return { id, total, loaded, fibonacciSequence };
},
cancel: async id => {
cancel: async (id) => {
loadedMap.delete(id);
totalMap.delete(id);
},
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_search/server/demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DEMO_SEARCH_STRATEGY } from '../common';

export const demoSearchStrategyProvider: TSearchStrategyProvider<typeof DEMO_SEARCH_STRATEGY> = () => {
return {
search: request => {
search: (request) => {
return Promise.resolve({
greeting:
request.mood === 'happy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function renderList(
embeddableServices: EmbeddableStart
) {
let number = 0;
const list = Object.values(panels).map(panel => {
const list = Object.values(panels).map((panel) => {
const child = embeddable.getChild(panel.explicitInput.id);
number++;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function wrapSearchTerms(task: string, search?: string) {
}

function renderTasks(tasks: MultiTaskTodoInput['tasks'], search?: string) {
return tasks.map(task => (
return tasks.map((task) => (
<EuiListGroupItem
key={task}
data-test-subj="multiTaskTodoTask"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getHasMatch(tasks: string[], title?: string, search?: string) {

if (title && title.match(search)) return true;

const match = tasks.find(task => task.match(search));
const match = tasks.find((task) => task.match(search));
if (match) return true;

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat

const checked: { [id: string]: boolean } = {};
const hasMatch: { [id: string]: boolean } = {};
props.embeddable.getChildIds().forEach(id => {
props.embeddable.getChildIds().forEach((id) => {
checked[id] = false;
const output = props.embeddable.getChild(id).getOutput();
hasMatch[id] = hasHasMatchOutput(output) && output.hasMatch;
});
props.embeddable.getChildIds().forEach(id => (checked[id] = false));
props.embeddable.getChildIds().forEach((id) => (checked[id] = false));
this.state = {
checked,
hasMatch,
};
}

componentDidMount() {
this.props.embeddable.getChildIds().forEach(id => {
this.props.embeddable.getChildIds().forEach((id) => {
this.subscriptions[id] = this.props.embeddable
.getChild(id)
.getOutput$()
.subscribe(output => {
.subscribe((output) => {
if (hasHasMatchOutput(output)) {
this.setState(prevState => ({
this.setState((prevState) => ({
hasMatch: {
...prevState.hasMatch,
[id]: output.hasMatch,
Expand All @@ -96,15 +96,15 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
}

componentWillUnmount() {
Object.values(this.subscriptions).forEach(sub => sub.unsubscribe());
Object.values(this.subscriptions).forEach((sub) => sub.unsubscribe());
}

private updateSearch = (search: string) => {
this.props.embeddable.updateInput({ search });
};

private deleteChecked = () => {
Object.values(this.props.input.panels).map(panel => {
Object.values(this.props.input.panels).map((panel) => {
if (this.state.checked[panel.explicitInput.id]) {
this.props.embeddable.removeEmbeddable(panel.explicitInput.id);
this.subscriptions[panel.explicitInput.id].unsubscribe();
Expand All @@ -115,7 +115,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
private checkMatching = () => {
const { input, embeddable } = this.props;
const checked: { [key: string]: boolean } = {};
Object.values(input.panels).map(panel => {
Object.values(input.panels).map((panel) => {
const child = embeddable.getChild(panel.explicitInput.id);
const output = child.getOutput();
if (hasHasMatchOutput(output) && output.hasMatch) {
Expand All @@ -126,7 +126,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
};

private toggleCheck = (isChecked: boolean, id: string) => {
this.setState(prevState => ({ checked: { ...prevState.checked, [id]: isChecked } }));
this.setState((prevState) => ({ checked: { ...prevState.checked, [id]: isChecked } }));
};

public renderControls() {
Expand Down Expand Up @@ -156,7 +156,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
<EuiFieldText
data-test-subj="filterTodos"
value={this.props.input.search || ''}
onChange={ev => this.updateSearch(ev.target.value)}
onChange={(ev) => this.updateSearch(ev.target.value)}
/>
</EuiFormRow>
</EuiFlexItem>
Expand All @@ -183,7 +183,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
private renderList() {
const { embeddableServices, input, embeddable } = this.props;
let id = 0;
const list = Object.values(input.panels).map(panel => {
const list = Object.values(input.panels).map((panel) => {
const childEmbeddable = embeddable.getChild(panel.explicitInput.id);
id++;
return childEmbeddable ? (
Expand All @@ -195,7 +195,7 @@ export class SearchableListContainerComponentInner extends Component<Props, Stat
disabled={!childEmbeddable}
id={childEmbeddable ? childEmbeddable.id : ''}
checked={this.state.checked[childEmbeddable.id]}
onChange={e => this.toggleCheck(e.target.checked, childEmbeddable.id)}
onChange={(e) => this.toggleCheck(e.target.checked, childEmbeddable.id)}
/>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function TaskInput({ onSave }: { onSave: (task: string) => void }) {
data-test-subj="taskInputField"
value={task}
placeholder="Enter task here"
onChange={e => setTask(e.target.value)}
onChange={(e) => setTask(e.target.value)}
/>
<EuiButton data-test-subj="createTodoEmbeddable" onClick={() => onSave(task)}>
Save
Expand Down Expand Up @@ -69,7 +69,7 @@ export class TodoEmbeddableFactory
*/
public getExplicitInput = async () => {
const { openModal } = await this.getStartServices();
return new Promise<{ task: string }>(resolve => {
return new Promise<{ task: string }>((resolve) => {
const onSave = (task: string) => resolve({ task });
const overlay = openModal(
toMountPoint(
Expand Down
4 changes: 2 additions & 2 deletions examples/embeddable_explorer/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type NavProps = RouteComponentProps & {
};

const Nav = withRouter(({ history, navigateToApp, pages }: NavProps) => {
const navItems = pages.map(page => ({
const navItems = pages.map((page) => ({
id: page.id,
name: page.title,
onClick: () => history.push(`/${page.id}`),
Expand Down Expand Up @@ -122,7 +122,7 @@ const EmbeddableExplorerApp = ({
];

const routes = pages.map((page, i) => (
<Route key={i} path={`/${page.id}`} render={props => page.component} />
<Route key={i} path={`/${page.id}`} render={(props) => page.component} />
));

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function EmbeddablePanelExample({ embeddableServices }: Props) {
const factory = embeddableServices.getEmbeddableFactory(SEARCHABLE_LIST_CONTAINER);
const promise = factory?.create(searchableInput);
if (promise) {
promise.then(e => {
promise.then((e) => {
if (ref.current) {
setEmbeddable(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class TodoEmbeddableExample extends React.Component<Props, State> {
icon: 'broom',
title: 'Trash',
})
.then(embeddable => {
.then((embeddable) => {
this.embeddable = embeddable;
this.setState({ loading: false });
});
Expand Down Expand Up @@ -135,15 +135,15 @@ export class TodoEmbeddableExample extends React.Component<Props, State> {
<EuiFormRow label="Title">
<EuiFieldText
data-test-subj="titleTodo"
onChange={ev => this.setState({ title: ev.target.value })}
onChange={(ev) => this.setState({ title: ev.target.value })}
/>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem grow={true}>
<EuiFormRow label="Icon">
<EuiFieldText
data-test-subj="iconTodo"
onChange={ev => this.setState({ icon: ev.target.value })}
onChange={(ev) => this.setState({ icon: ev.target.value })}
/>
</EuiFormRow>
</EuiFlexItem>
Expand All @@ -153,7 +153,7 @@ export class TodoEmbeddableExample extends React.Component<Props, State> {
fullWidth
resize="horizontal"
data-test-subj="taskTodo"
onChange={ev => this.setState({ task: ev.target.value })}
onChange={(ev) => this.setState({ task: ev.target.value })}
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down
4 changes: 2 additions & 2 deletions examples/search_explorer/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type NavProps = RouteComponentProps & {
};

const Nav = withRouter(({ history, navigateToApp, pages }: NavProps) => {
const navItems = pages.map(page => ({
const navItems = pages.map((page) => ({
id: page.id,
name: page.title,
onClick: () => history.push(`/${page.id}`),
Expand Down Expand Up @@ -103,7 +103,7 @@ const SearchApp = ({ basename, data, application }: SearchBarComponentParams) =>
];

const routes = pages.map((page, i) => (
<Route key={i} path={`/${page.id}`} render={props => buildPage(page)} />
<Route key={i} path={`/${page.id}`} render={(props) => buildPage(page)} />
));

return (
Expand Down
Loading

0 comments on commit bf04235

Please sign in to comment.