Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #38 from andymikulski/normandy-fix-prettier
Browse files Browse the repository at this point in the history
Fix normandy prettier-ing
  • Loading branch information
andymikulski committed Apr 2, 2018
2 parents fc67ba5 + 6a489fe commit 826ed8d
Show file tree
Hide file tree
Showing 155 changed files with 1,484 additions and 1,296 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"eject": "react-scripts eject",
"lint:flow": "flow",
"lint:less": "stylelint 'src/**/*.less' --config .stylelintrc",
"lint:prettier": "prettier --list-different src/**/*.js | ./lint_problems.sh",
"lint:prettierfix": "prettier src/**/*.js --write",
"lint:prettier": "prettier --list-different 'src/**/*.js' | ./lint_problems.sh",
"lint:prettierfix": "prettier 'src/**/*.js' --write",
"lint": "yarn run lint:flow && yarn run lint:prettier && yarn run lint:less"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import DevConsoleApp from "./console/App";
import React from 'react';
import ReactDOM from 'react-dom';
import DevConsoleApp from './console/App';

ReactDOM.render(<DevConsoleApp />, document.getElementById("root"));
ReactDOM.render(<DevConsoleApp />, document.getElementById('root'));
11 changes: 2 additions & 9 deletions src/normandy/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import QueryServiceInfo from 'normandy/components/data/QueryServiceInfo';

const { Content, Header, Sider } = Layout;


export default class App extends React.PureComponent {
static propTypes = {
children: PropTypes.node,
Expand Down Expand Up @@ -46,20 +45,14 @@ export default class App extends React.PureComponent {
</Header>

<Layout>
<Sider
className="sidebar"
breakpoint="sm"
collapsedWidth="0"
>
<Sider className="sidebar" breakpoint="sm" collapsedWidth="0">
<NavigationMenu />
</Sider>

<Layout className="content-wrapper">
<NavigationCrumbs />

<Content className="content">
{children}
</Content>
<Content className="content">{children}</Content>
</Layout>
</Layout>
</Layout>
Expand Down
1 change: 0 additions & 1 deletion src/normandy/components/common/BooleanIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Icon } from 'antd';
import PropTypes from 'prop-types';
import React from 'react';


export default class BooleanIcon extends React.PureComponent {
static propTypes = {
value: PropTypes.bool.isRequired,
Expand Down
1 change: 0 additions & 1 deletion src/normandy/components/common/CheckboxMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Button, Checkbox, Dropdown } from 'antd';
import PropTypes from 'prop-types';
import React from 'react';


export default class CheckboxMenu extends React.PureComponent {
static propTypes = {
checkboxes: PropTypes.array,
Expand Down
11 changes: 4 additions & 7 deletions src/normandy/components/common/CurrentUserDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import {
getLogoutUrl,
} from 'normandy/state/app/serviceInfo/selectors';


@connect(
state => ({
user: getCurrentUser(state, new Map()),
logoutUrl: getLogoutUrl(state, ''),
}),
)
@connect(state => ({
user: getCurrentUser(state, new Map()),
logoutUrl: getLogoutUrl(state, ''),
}))
export default class CurrentUserDetails extends React.PureComponent {
static propTypes = {
logoutUrl: PropTypes.string.isRequired,
Expand Down
9 changes: 5 additions & 4 deletions src/normandy/components/common/EnrollmentStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ export default class EnrollmentSatus extends React.Component {
}

render() {
const {
recipe,
} = this.props;
const { recipe } = this.props;

return (
<Link href={`/recipe/${recipe.id}/`} className={cx('status-link', !recipe.enabled && 'is-lowkey')}>
<Link
href={`/recipe/${recipe.id}/`}
className={cx('status-link', !recipe.enabled && 'is-lowkey')}
>
<Icon
className={cx('status-icon', this.getColor())}
type={this.getIcon()}
Expand Down
3 changes: 2 additions & 1 deletion src/normandy/components/common/EnvAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default class EnvAlert extends React.PureComponent {
rel="noopener noreferrer"
>
Learn more about Normandy environments.
</a>);
</a>
);

/**
* Given a URL and an array of strings, determines if that URL contains at least
Expand Down
50 changes: 19 additions & 31 deletions src/normandy/components/common/LoadingOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
isRequestInProgress,
} from 'normandy/state/app/requests/selectors';


export class SimpleLoadingOverlay extends React.PureComponent {
static propTypes = {
children: PropTypes.any,
Expand All @@ -23,45 +22,34 @@ export class SimpleLoadingOverlay extends React.PureComponent {
};

render() {
const {
children,
className,
isVisible,
} = this.props;
const { children, className, isVisible } = this.props;

const Wrapper = isVisible ? Spin : 'div';

return (
<Wrapper className={className}>
{children}
</Wrapper>
);
return <Wrapper className={className}>{children}</Wrapper>;
}
}

@connect((state, { requestIds }) => {
let isLoading;

@connect(
(state, { requestIds }) => {
let isLoading;

// If we're given one or more request IDs, check if at least one is in progress.
// If nothing is given, simply check if _any_ request is in progress.
if (requestIds) {
let requestArray = requestIds;
if (!(requestArray instanceof Array)) {
requestArray = [requestIds];
}

isLoading = !!requestArray.find(reqId => isRequestInProgress(state, reqId));
} else {
isLoading = areAnyRequestsInProgress(state);
// If we're given one or more request IDs, check if at least one is in progress.
// If nothing is given, simply check if _any_ request is in progress.
if (requestIds) {
let requestArray = requestIds;
if (!(requestArray instanceof Array)) {
requestArray = [requestIds];
}

return {
isLoading,
};
},
)
isLoading = !!requestArray.find(reqId => isRequestInProgress(state, reqId));
} else {
isLoading = areAnyRequestsInProgress(state);
}

return {
isLoading,
};
})
export default class LoadingOverlay extends React.PureComponent {
static propTypes = {
isLoading: PropTypes.bool.isRequired,
Expand Down
20 changes: 10 additions & 10 deletions src/normandy/components/common/NavigationCrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { Link } from 'redux-little-router';

import { getBreadcrumbs } from 'normandy/state/router/selectors';

@connect(
state => ({
breadcrumbs: getBreadcrumbs(state),
}),
)
@connect(state => ({
breadcrumbs: getBreadcrumbs(state),
}))
@autobind
export default class NavigationCrumbs extends React.PureComponent {
static propTypes = {
Expand All @@ -27,11 +25,13 @@ export default class NavigationCrumbs extends React.PureComponent {

return (
<Breadcrumb>
{breadcrumbs.map((crumb, idx) =>
(<Breadcrumb.Item key={idx}>
<Link href={crumb.link} id={this.getCrumbSlug(crumb)}>{ crumb.name }</Link>
</Breadcrumb.Item>),
)}
{breadcrumbs.map((crumb, idx) => (
<Breadcrumb.Item key={idx}>
<Link href={crumb.link} id={this.getCrumbSlug(crumb)}>
{crumb.name}
</Link>
</Breadcrumb.Item>
))}
</Breadcrumb>
);
}
Expand Down
52 changes: 26 additions & 26 deletions src/normandy/components/common/NavigationMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import ShieldIdenticon from 'normandy/components/common/ShieldIdenticon';

const { Divider, Item, SubMenu } = Menu;

@connect(
state => ({
recipeSessionHistory: getSessionHistory(state, 'recipe'),
extensionSessionHistory: getSessionHistory(state, 'extension'),
router: state.router,
}),
)
@connect(state => ({
recipeSessionHistory: getSessionHistory(state, 'recipe'),
extensionSessionHistory: getSessionHistory(state, 'extension'),
router: state.router,
}))
export default class NavigationMenu extends React.PureComponent {
static propTypes = {
recipeSessionHistory: PropTypes.instanceOf(List).isRequired,
Expand All @@ -26,7 +24,11 @@ export default class NavigationMenu extends React.PureComponent {
};

render() {
const { router, recipeSessionHistory, extensionSessionHistory } = this.props;
const {
router,
recipeSessionHistory,
extensionSessionHistory,
} = this.props;
const { pathname, search } = router;

return (
Expand All @@ -37,7 +39,9 @@ export default class NavigationMenu extends React.PureComponent {
selectedKeys={[pathname + search]}
mode="inline"
>
<Item key="/"><Link href="/">Home</Link></Item>
<Item key="/">
<Link href="/">Home</Link>
</Item>

<SubMenu title="Recipes" key="Recipes">
<Item key="/recipe/">
Expand All @@ -46,16 +50,14 @@ export default class NavigationMenu extends React.PureComponent {

{recipeSessionHistory.size > 0 && <Divider />}

{
recipeSessionHistory.map(item =>
(<Item key={item.get('url')}>
<Link href={item.get('url')}>
<ShieldIdenticon seed={item.get('identicon')} size={20} />
{ item.get('caption') }
</Link>
</Item>),
)
}
{recipeSessionHistory.map(item => (
<Item key={item.get('url')}>
<Link href={item.get('url')}>
<ShieldIdenticon seed={item.get('identicon')} size={20} />
{item.get('caption')}
</Link>
</Item>
))}
</SubMenu>

<SubMenu title="Extensions" key="Extensions">
Expand All @@ -65,13 +67,11 @@ export default class NavigationMenu extends React.PureComponent {

{extensionSessionHistory.size > 0 && <Divider />}

{
extensionSessionHistory.map(item =>
(<Item key={item.get('url')}>
<Link href={item.get('url')}>{ item.get('caption') }</Link>
</Item>),
)
}
{extensionSessionHistory.map(item => (
<Item key={item.get('url')}>
<Link href={item.get('url')}>{item.get('caption')}</Link>
</Item>
))}
</SubMenu>
</Menu>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/normandy/components/common/ShieldIdenticon.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ export default class ShieldIdenticon extends React.PureComponent {
};

return (
<span style={containerStyle} className={cx(className, 'shield-container')}>
{ isLoading && <Spin size="small" /> }
<span
style={containerStyle}
className={cx(className, 'shield-container')}
>
{isLoading && <Spin size="small" />}
<img
alt="Shield Identicon"
height={size}
Expand Down
11 changes: 4 additions & 7 deletions src/normandy/components/data/QueryActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import { connect } from 'react-redux';

import { fetchAllActions } from 'normandy/state/app/actions/actions';

@connect(
null,
{
fetchAllActions,
},
)
@connect(null, {
fetchAllActions,
})
export default class QueryActions extends React.PureComponent {
static propTypes = {
fetchAllActions: PropTypes.func.isRequired,
}
};

componentWillMount() {
this.props.fetchAllActions();
Expand Down
12 changes: 4 additions & 8 deletions src/normandy/components/data/QueryExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ import { connect } from 'react-redux';

import { fetchExtension } from 'normandy/state/app/extensions/actions';


@connect(
null,
{
fetchExtension,
},
)
@connect(null, {
fetchExtension,
})
export default class QueryExtension extends React.PureComponent {
static propTypes = {
fetchExtension: PropTypes.func.isRequired,
pk: PropTypes.number.isRequired,
}
};

componentWillMount() {
const { pk } = this.props;
Expand Down
10 changes: 3 additions & 7 deletions src/normandy/components/data/QueryExtensionListingColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import { connect } from 'react-redux';

import { loadExtensionListingColumns } from 'normandy/state/app/extensions/actions';


@connect(
null,
{
loadExtensionListingColumns,
},
)
@connect(null, {
loadExtensionListingColumns,
})
export default class QueryExtensionListingColumns extends React.PureComponent {
static propTypes = {
loadExtensionListingColumns: PropTypes.func.isRequired,
Expand Down

0 comments on commit 826ed8d

Please sign in to comment.