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

[eslint] Enforce arrow-parens #3207

Merged
merged 1 commit into from
Feb 7, 2016
Merged
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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rules:
# Errors
array-bracket-spacing: [2, never]
arrow-spacing: 2
arrow-parens: 2
block-spacing: [2, always]
brace-style: 2
comma-dangle: [2, always-multiline]
Expand Down
8 changes: 4 additions & 4 deletions docs/src/app/components/PropTypeDescription.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function generatePropType(type) {
return type.raw;

case 'enum':
const values = type.value.map(v => v.value).join('<br>&nbsp;');
const values = type.value.map((v) => v.value).join('<br>&nbsp;');
return `enum:<br>&nbsp;${values}<br>`;

default:
Expand All @@ -64,15 +64,15 @@ function generateDescription(required, description, type) {
// must be eliminated to prevent markdown mayhem.
const jsDocText = parsed.description.replace(/\n\n/g, '<br>').replace(/\n/g, ' ');

if (parsed.tags.some(tag => tag.title === 'ignore')) return null;
if (parsed.tags.some((tag) => tag.title === 'ignore')) return null;

let signature = '';

if (type.name === 'func' && parsed.tags.length > 0) {
signature += '<br><br>**Signature:**<br>`function(';
signature += parsed.tags.map(tag => `${tag.name}: ${tag.type.name}`).join(', ');
signature += parsed.tags.map((tag) => `${tag.name}: ${tag.type.name}`).join(', ');
signature += ') => void`<br>';
signature += parsed.tags.map(tag => `*${tag.name}:* ${tag.description}`).join('<br>');
signature += parsed.tags.map((tag) => `*${tag.name}:* ${tag.description}`).join('<br>');
}

return `${deprecated} ${jsDocText}${signature}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const GridListExampleComplex = () => (
padding={1}
style={styles.gridList}
>
{tilesData.map(tile => (
{tilesData.map((tile) => (
<GridTile
key={tile.img}
title={tile.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const GridListExampleSimple = () => (
style={styles.gridList}
>
<Subheader>December</Subheader>
{tilesData.map(tile => (
{tilesData.map((tile) => (
<GridTile
key={tile.img}
title={tile.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class LeftNavUndockedExample extends React.Component {
docked={false}
width={200}
open={this.state.open}
onRequestChange={open => this.setState({open})}
onRequestChange={(open) => this.setState({open})}
>
<MenuItem onTouchTap={this.handleClose}>Menu Item</MenuItem>
<MenuItem onTouchTap={this.handleClose}>Menu Item 2</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion src/DropDownMenu/DropDownMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ const DropDownMenu = React.createClass({
const styles = this.getStyles();

let displayValue = '';
React.Children.forEach(children, child => {
React.Children.forEach(children, (child) => {
if (value === child.props.value) {
// This will need to be improved (in case primaryText is a node)
displayValue = child.props.label || child.props.primaryText;
Expand Down
10 changes: 5 additions & 5 deletions src/menus/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const Menu = React.createClass({

_getFilteredChildren(children) {
const filteredChildren = [];
React.Children.forEach(children, child => {
React.Children.forEach(children, (child) => {
if (child) {
filteredChildren.push(child);
}
Expand Down Expand Up @@ -299,7 +299,7 @@ const Menu = React.createClass({

//Count all the children that will fit inside the
//max menu height
filteredChildren.forEach(child => {
filteredChildren.forEach((child) => {
if (currentHeight < maxHeight) {
let childIsADivider = child.type && child.type.displayName === 'Divider';

Expand All @@ -313,7 +313,7 @@ const Menu = React.createClass({

_getMenuItemCount(filteredChildren) {
let menuItemCount = 0;
filteredChildren.forEach(child => {
filteredChildren.forEach((child) => {
let childIsADivider = child.type && child.type.displayName === 'Divider';
let childIsDisabled = child.props.disabled;
if (!childIsADivider && !childIsDisabled) menuItemCount++;
Expand All @@ -325,7 +325,7 @@ const Menu = React.createClass({
let selectedIndex = -1;
let menuItemIndex = 0;

filteredChildren.forEach(child => {
filteredChildren.forEach((child) => {
let childIsADivider = child.type && child.type.displayName === 'Divider';

if (this._isChildSelected(child, props)) selectedIndex = menuItemIndex;
Expand Down Expand Up @@ -529,7 +529,7 @@ const Menu = React.createClass({
let cumulativeDelayIncrement = Math.ceil(150 / cascadeChildrenCount);

let menuItemIndex = 0;
let newChildren = React.Children.map(filteredChildren, child => {
let newChildren = React.Children.map(filteredChildren, (child) => {
let childIsADivider = child.type && child.type.displayName === 'Divider';
let childIsDisabled = child.props.disabled;
let childrenContainerStyles = {};
Expand Down
5 changes: 3 additions & 2 deletions src/styles/getMuiTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function getMuiTheme(baseTheme, muiTheme) {
[10, 30, 0.19, 6, 10, 0.23],
[14, 45, 0.25, 10, 18, 0.22],
[19, 60, 0.30, 15, 20, 0.22],
].map(d => (
].map((d) => (
`0 ${d[0]}px ${d[1]}px ${ColorManipulator.fade(palette.shadowColor, d[2])},
0 ${d[3]}px ${d[4]}px ${ColorManipulator.fade(palette.shadowColor, d[5])}`
)),
Expand Down Expand Up @@ -241,7 +241,8 @@ export default function getMuiTheme(baseTheme, muiTheme) {
},
}, muiTheme);

const transformers = [autoprefixer, rtl, callOnce].map(t => t(muiTheme)).filter(t => t);
const transformers = [autoprefixer, rtl, callOnce].map((t) => t(muiTheme))
.filter((t) => t);
muiTheme.prepareStyles = compose(...transformers);

return muiTheme;
Expand Down
2 changes: 1 addition & 1 deletion src/toolbar/toolbar-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const ToolbarGroup = React.createClass({

const styles = getStyles(this.props, this.state);

const newChildren = React.Children.map(children, currentChild => {
const newChildren = React.Children.map(children, (currentChild) => {
if (!currentChild) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/date-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ export default {
dayArray.push(new Date(d.getFullYear(), d.getMonth(), i));
}

const addWeek = week => {
const addWeek = (week) => {
const emptyDays = 7 - week.length;
for (let i = 0; i < emptyDays; ++i) {
week[weekArray.length ? 'push' : 'unshift'](null);
}
weekArray.push(week);
};

dayArray.forEach(day => {
dayArray.forEach((day) => {
if (week.length > 0 && day.getDay() === firstDayOfWeek) {
addWeek(week);
week = [];
Expand Down