always jsx-curly-spacing

This commit is contained in:
Allen 2017-10-18 01:31:12 -05:00 committed by GitHub
parent 4f7a3d7eaf
commit 0440c63c66
14 changed files with 72 additions and 72 deletions

View File

@ -11,7 +11,7 @@
],
"rules": {
"comma-dangle": ["error", "never"],
"react/jsx-curly-spacing": 0,
"react/jsx-curly-spacing": [2, "always"],
"react/forbid-prop-types": 0,
"react/jsx-filename-extension": 0,
"react/jsx-space-before-closing": 0,

View File

@ -36,12 +36,12 @@ const CaptionElement = () => <h3 style={{ borderRadius: '0.25em', textAlign: 'ce
<BootstrapTable keyField="id" data={ products } caption={<CaptionElement />} columns={ columns } />
`;
const Caption = () => <h3 style={{ borderRadius: '0.25em', textAlign: 'center', color: 'purple', border: '1px solid purple', padding: '0.5em' }}>Component as Header</h3>;
const Caption = () => <h3 style={ { borderRadius: '0.25em', textAlign: 'center', color: 'purple', border: '1px solid purple', padding: '0.5em' } }>Component as Header</h3>;
export default () => (
<div>
<BootstrapTable keyField="id" data={ products } caption="Plain text header" columns={ columns } />
<BootstrapTable keyField="id" data={ products } caption={<Caption />} columns={ columns } />
<BootstrapTable keyField="id" data={ products } caption={ <Caption /> } columns={ columns } />
<Code>{ sourceCode }</Code>
</div>
);

View File

@ -203,7 +203,7 @@ const reducers = (state, action) => {
const store = createStore(reducers, initialState, applyMiddleware(thunk));
const Index = () => (
<Provider store={store}>
<Provider store={ store }>
<CellEditWithRedux />
</Provider>
);

View File

@ -24,13 +24,13 @@ export default class Welcome extends React.Component {
<h1 className="welcome-title">react-bootstrap-table2</h1>
<span
className="welcome-sub-title"
ref={(el) => { this.el = el; }}
ref={ (el) => { this.el = el; } }
/>
</div>
<a href="https://github.com/react-bootstrap-table/react-bootstrap-table2" className="github-corner" aria-label="View source on Github">
<svg width="80" height="80" viewBox="0 0 250 250" style={{ fill: '#009688', color: '#fff', position: 'absolute', top: '0', border: '0', right: '0' }} aria-hidden="true">
<svg width="80" height="80" viewBox="0 0 250 250" style={ { fill: '#009688', color: '#fff', position: 'absolute', top: '0', border: '0', right: '0' } } aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" />
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style={{ transformOrigin: '130px 106px' }} className="octo-arm" />
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style={ { transformOrigin: '130px 106px' } } className="octo-arm" />
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" className="octo-body" />
</svg>
</a>

View File

@ -81,8 +81,8 @@ class BootstrapTable extends PropsBaseResolver(Component) {
visibleColumnSize={ this.visibleColumnSize() }
noDataIndication={ noDataIndication }
cellEdit={ cellEditInfo }
selectRow={cellSelectionInfo}
selectedRowKeys={store.getSelectedRowKeys()}
selectRow={ cellSelectionInfo }
selectedRowKeys={ store.getSelectedRowKeys() }
/>
</table>
</div>

View File

@ -21,7 +21,7 @@ const Header = (props) => {
<thead>
<tr>
{
selectRow.mode === ROW_SELECT_DISABLED ? null : <SelectionHeaderCell {...selectRow} />
selectRow.mode === ROW_SELECT_DISABLED ? null : <SelectionHeaderCell { ...selectRow } />
}
{
columns.map((column, i) => {

View File

@ -48,10 +48,10 @@ export default class SelectionCell extends Component {
} = this.props;
return (
<td onClick={this.handleRowClick}>
<td onClick={ this.handleRowClick }>
<input
type={inputType}
checked={selected}
type={ inputType }
checked={ selected }
/>
</td>
);

View File

@ -6,10 +6,10 @@ import Const from '../const';
export const CheckBox = ({ checked, indeterminate }) => (
<input
type="checkbox"
checked={checked}
ref={(input) => {
checked={ checked }
ref={ (input) => {
if (input) input.indeterminate = indeterminate; // eslint-disable-line no-param-reassign
}}
} }
/>
);
@ -64,11 +64,11 @@ export default class SelectionHeaderCell extends Component {
return mode === ROW_SELECT_SINGLE
? <th data-row-selection />
: (
<th data-row-selection onClick={this.handleCheckBoxClick}>
<th data-row-selection onClick={ this.handleCheckBoxClick }>
<CheckBox
{...this.props}
checked={checked}
indeterminate={indeterminate}
{ ...this.props }
checked={ checked }
indeterminate={ indeterminate }
/>
</th>
);

View File

@ -38,8 +38,8 @@ const Row = (props) => {
: (
<SelectionCell
{ ...selectRow }
rowKey={_.get(row, keyField)}
selected={selected}
rowKey={ _.get(row, keyField) }
selected={ selected }
/>
)
}

View File

@ -28,7 +28,7 @@ describe('Body', () => {
describe('simplest body', () => {
beforeEach(() => {
wrapper = shallow(<Body {...mockBodyResolvedProps} keyField="id" columns={ columns } data={ data } />);
wrapper = shallow(<Body { ...mockBodyResolvedProps } keyField="id" columns={ columns } data={ data } />);
});
it('should render successfully', () => {
@ -42,7 +42,7 @@ describe('Body', () => {
beforeEach(() => {
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
keyField="id"
columns={ columns }
data={ data }
@ -67,7 +67,7 @@ describe('Body', () => {
emptyIndication = 'Table is empty';
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
keyField="id"
columns={ columns }
data={ data }
@ -93,7 +93,7 @@ describe('Body', () => {
emptyIndicationCallBack = sinon.stub().returns(content);
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
keyField="id"
columns={ columns }
data={ data }
@ -127,7 +127,7 @@ describe('Body', () => {
beforeEach(() => {
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
data={ data }
columns={ columns }
keyField={ keyField }
@ -156,12 +156,12 @@ describe('Body', () => {
it('props selected should be true if all rows were selected', () => {
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
data={ data }
columns={ columns }
keyField={ keyField }
selectedRowKeys={[1, 2]}
selectRow={selectRow}
selectedRowKeys={ [1, 2] }
selectRow={ selectRow }
/>
);
@ -171,12 +171,12 @@ describe('Body', () => {
it('props selected should be false if all rows were not selected', () => {
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
data={ data }
columns={ columns }
keyField={ keyField }
selectedRowKeys={[]}
selectRow={selectRow}
selectedRowKeys={ [] }
selectRow={ selectRow }
/>
);
@ -189,11 +189,11 @@ describe('Body', () => {
const keyField = 'id';
wrapper = shallow(
<Body
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
data={ data }
columns={ columns }
keyField={ keyField }
selectedRowKeys={[]}
selectedRowKeys={ [] }
/>
);
});

View File

@ -19,7 +19,7 @@ describe('Header', () => {
describe('simplest header', () => {
beforeEach(() => {
wrapper = shallow(<Header {...mockHeaderResolvedProps} columns={ columns } />);
wrapper = shallow(<Header { ...mockHeaderResolvedProps } columns={ columns } />);
});
it('should render successfully', () => {
@ -35,7 +35,7 @@ describe('Header', () => {
beforeEach(() => {
wrapper = shallow(
<Header
{...mockHeaderResolvedProps}
{ ...mockHeaderResolvedProps }
columns={ columns }
sortField={ sortField }
sortOrder={ Const.SORT_ASC }
@ -53,7 +53,7 @@ describe('Header', () => {
describe('when the selectRow.mode is radio(single selection)', () => {
beforeEach(() => {
wrapper = shallow(<Header {...mockHeaderResolvedProps} columns={ columns } />);
wrapper = shallow(<Header { ...mockHeaderResolvedProps } columns={ columns } />);
});
it('should not render <SelectionHeaderCell />', () => {
@ -66,9 +66,9 @@ describe('Header', () => {
const selectRow = { mode: 'checkbox' };
wrapper = shallow(
<Header
{...mockHeaderResolvedProps}
{ ...mockHeaderResolvedProps }
columns={ columns }
selectRow={selectRow}
selectRow={ selectRow }
/>
);
});

View File

@ -16,7 +16,7 @@ describe('<SelectionCell />', () => {
it('should not update component', () => {
const nextProps = { selected };
wrapper = shallow(<SelectionCell rowKey={1} mode={mode} selected={selected} />);
wrapper = shallow(<SelectionCell rowKey={ 1 } mode={ mode } selected={ selected } />);
expect(wrapper.instance().shouldComponentUpdate(nextProps)).toBe(false);
});
@ -26,7 +26,7 @@ describe('<SelectionCell />', () => {
it('should update component', () => {
const nextProps = { selected: !selected };
wrapper = shallow(<SelectionCell rowKey={1} mode={mode} selected={selected} />);
wrapper = shallow(<SelectionCell rowKey={ 1 } mode={ mode } selected={ selected } />);
expect(wrapper.instance().shouldComponentUpdate(nextProps)).toBe(true);
});
@ -48,9 +48,9 @@ describe('<SelectionCell />', () => {
wrapper = shallow(
<SelectionCell
selected
rowKey={rowKey}
mode={mode}
onRowSelect={mockOnRowSelect}
rowKey={ rowKey }
mode={ mode }
onRowSelect={ mockOnRowSelect }
/>
);
@ -65,9 +65,9 @@ describe('<SelectionCell />', () => {
wrapper = shallow(
<SelectionCell
selected
rowKey={rowKey}
rowKey={ rowKey }
mode="radio"
onRowSelect={mockOnRowSelect}
onRowSelect={ mockOnRowSelect }
/>
);
});
@ -89,9 +89,9 @@ describe('<SelectionCell />', () => {
beforeEach(() => {
wrapper = shallow(
<SelectionCell
rowKey={rowKey}
rowKey={ rowKey }
mode="checkbox"
onRowSelect={mockOnRowSelect}
onRowSelect={ mockOnRowSelect }
/>
);
});
@ -119,9 +119,9 @@ describe('<SelectionCell />', () => {
beforeEach(() => {
wrapper = shallow(
<SelectionCell
rowKey={1}
mode={mode}
selected={selected}
rowKey={ 1 }
mode={ mode }
selected={ selected }
/>
);
});

View File

@ -24,7 +24,7 @@ describe('<SelectionHeaderCell />', () => {
const nextProps = { checkedStatus };
wrapper = shallow(
<SelectionHeaderCell mode="checkbox" checkedStatus={checkedStatus} />);
<SelectionHeaderCell mode="checkbox" checkedStatus={ checkedStatus } />);
expect(wrapper.instance().shouldComponentUpdate(nextProps)).toBe(false);
});
@ -37,7 +37,7 @@ describe('<SelectionHeaderCell />', () => {
const nextProps = { checkedStatus };
wrapper = shallow(
<SelectionHeaderCell mode="checkbox" checkedStatus={CHECKBOX_STATUS_INDETERMINATE} />);
<SelectionHeaderCell mode="checkbox" checkedStatus={ CHECKBOX_STATUS_INDETERMINATE } />);
expect(wrapper.instance().shouldComponentUpdate(nextProps)).toBe(true);
});
@ -60,8 +60,8 @@ describe('<SelectionHeaderCell />', () => {
wrapper = shallow(
<SelectionHeaderCell
mode="radio"
checkedStatus={Const.CHECKBOX_STATUS_CHECKED}
onAllRowsSelect={mockOnAllRowsSelect}
checkedStatus={ Const.CHECKBOX_STATUS_CHECKED }
onAllRowsSelect={ mockOnAllRowsSelect }
/>);
});
@ -78,8 +78,8 @@ describe('<SelectionHeaderCell />', () => {
wrapper = shallow(
<SelectionHeaderCell
mode="checkbox"
checkedStatus={Const.CHECKBOX_STATUS_CHECKED}
onAllRowsSelect={mockOnAllRowsSelect}
checkedStatus={ Const.CHECKBOX_STATUS_CHECKED }
onAllRowsSelect={ mockOnAllRowsSelect }
/>);
});
@ -98,7 +98,7 @@ describe('<SelectionHeaderCell />', () => {
beforeEach(() => {
const checkedStatus = Const.CHECKBOX_STATUS_CHECKED;
wrapper = shallow(<SelectionHeaderCell mode="radio" checkedStatus={checkedStatus} />);
wrapper = shallow(<SelectionHeaderCell mode="radio" checkedStatus={ checkedStatus } />);
});
it('should not render checkbox', () => {
@ -112,7 +112,7 @@ describe('<SelectionHeaderCell />', () => {
const checkedStatus = Const.CHECKBOX_STATUS_CHECKED;
beforeEach(() => {
wrapper = shallow(<SelectionHeaderCell mode="checkbox" checkedStatus={checkedStatus} />);
wrapper = shallow(<SelectionHeaderCell mode="checkbox" checkedStatus={ checkedStatus } />);
});
it('should render checkbox', () => {
@ -134,7 +134,7 @@ describe('<CheckBox />', () => {
it('should render component correctly', () => {
const checked = true;
const indeterminate = false;
wrapper = shallow(<CheckBox checked={checked} indeterminate={indeterminate} />);
wrapper = shallow(<CheckBox checked={ checked } indeterminate={ indeterminate } />);
expect(wrapper.find('input').length).toBe(1);
expect(wrapper.find('input').prop('checked')).toBe(checked);

View File

@ -32,7 +32,7 @@ describe('Row', () => {
describe('simplest row', () => {
beforeEach(() => {
wrapper = shallow(
<Row {...mockBodyResolvedProps} rowIndex={ 1 } columns={ defaultColumns } row={ row } />);
<Row { ...mockBodyResolvedProps } rowIndex={ 1 } columns={ defaultColumns } row={ row } />);
});
it('should render successfully', () => {
@ -55,7 +55,7 @@ describe('Row', () => {
};
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ rowIndex }
columns={ columns }
@ -95,7 +95,7 @@ describe('Row', () => {
columns[nonEditableColIndex].editable = false;
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ rowIndex }
columns={ columns }
@ -132,7 +132,7 @@ describe('Row', () => {
columns[nonEditableColIndex].editable = editableCallBack;
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ rowIndex }
columns={ columns }
@ -165,7 +165,7 @@ describe('Row', () => {
columns[nonEditableColIndex].editable = editableCallBack;
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ rowIndex }
columns={ columns }
@ -199,7 +199,7 @@ describe('Row', () => {
beforeEach(() => {
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ rowIndex }
columns={ columns }
@ -230,7 +230,7 @@ describe('Row', () => {
cellEdit.onUpdate = sinon.stub();
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ 1 }
columns={ columns }
@ -260,7 +260,7 @@ describe('Row', () => {
cellEdit.onEscape = sinon.stub();
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
row={ row }
rowIndex={ 1 }
columns={ columns }
@ -283,7 +283,7 @@ describe('Row', () => {
describe('when selectRow.mode is ROW_SELECT_DISABLED (row was un-selectable)', () => {
beforeEach(() => {
wrapper = shallow(
<Row {...mockBodyResolvedProps} rowIndex={ 1 } columns={ defaultColumns } row={ row } />);
<Row { ...mockBodyResolvedProps } rowIndex={ 1 } columns={ defaultColumns } row={ row } />);
});
it('should not render <SelectionCell />', () => {
@ -296,11 +296,11 @@ describe('Row', () => {
const selectRow = { mode: 'checkbox' };
wrapper = shallow(
<Row
{...mockBodyResolvedProps}
{ ...mockBodyResolvedProps }
rowIndex={ 1 }
columns={ defaultColumns }
row={ row }
selectRow={selectRow}
selectRow={ selectRow }
/>);
});