Skip to content

Commit

Permalink
Merge pull request react-bootstrap#1281 from AlexKVal/airbnb
Browse files Browse the repository at this point in the history
Next portion of `airbnb`
  • Loading branch information
taion committed Sep 5, 2015
2 parents a1bd934 + 732dc03 commit 360fceb
Show file tree
Hide file tree
Showing 82 changed files with 280 additions and 286 deletions.
8 changes: 1 addition & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,10 @@
"no-param-reassign": 0,
"no-this-before-super": 2,
"no-undef": 2,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
"babel/object-shorthand": 2,
"react/jsx-boolean-value": [2, "never"],
"react/jsx-no-duplicate-props": 2,
"react/prop-types": [2, { "ignore": [ "children", "className", "style" ] }],
"react/sort-comp": 0,
"space-after-keywords": 0,
"space-before-blocks": 0,
"space-before-function-paren": 0,
"spaced-comment": 0,
"vars-on-top": 0
"react/sort-comp": 0
}
}
2 changes: 1 addition & 1 deletion docs/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const readmeDest = path.join(docsBuilt, 'README.md');
* @internal
*/
function generateHTML(fileName, propData) {
return new Promise((resolve, reject) => {
return new Promise( resolve => {
const urlSlug = fileName === 'index.html' ? '/' : `/${fileName}`;

Router.run(routes, urlSlug, Handler => {
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/Collapse.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class Example extends React.Component {
constructor(...args){
constructor(...args) {
super(...args);

this.state = {};
}

render(){
render() {
return (
<div>
<Button onClick={ ()=> this.setState({ open: !this.state.open })}>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/DropdownButtonBasic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const BUTTONS = ['Default', 'Primary', 'Success', 'Info', 'Warning', 'Danger', 'Link'];

function renderDropdownButton (title, i) {
function renderDropdownButton(title, i) {
return (
<DropdownButton bsStyle={title.toLowerCase()} title={title} key={i} id={`dropdown-basic-${i}`}>
<MenuItem eventKey="1">Action</MenuItem>
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/DropdownButtonCustomMenu.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

class CustomMenu extends React.Component {

constructor(...args){
constructor(...args) {
super(...args);
this.state = { value: '' };
this.onChange = e => this.setState({ value: e.target.value });
}

render(){
render() {
let { className, ...props } = this.props;

return (
Expand All @@ -30,7 +30,7 @@ class CustomMenu extends React.Component {
);
}

filterChildren(){
filterChildren() {
let { children } = this.props;
let { value } = this.state;
let filtered = [];
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/Fade.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

class Example extends React.Component {

constructor(...args){
constructor(...args) {
super(...args);
this.state = {};
}

render(){
render() {
return (
<div>
<Button onClick={()=> this.setState({ open: !this.state.open })}>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ListGroupLinked.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function alertClicked () {
function alertClicked() {
alert('You clicked the third ListGroupItem');
}

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/MenuItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function onSelectAlert(eventKey, href, target) {
function onSelectAlert(eventKey, href) {
alert('Alert from menu item.\neventKey: "' + eventKey + '"\nhref: "' + href + '"');
}

Expand Down
6 changes: 3 additions & 3 deletions docs/examples/Modal.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const Example = React.createClass({

getInitialState(){
getInitialState() {
return { showModal: false };
},

close(){
close() {
this.setState({ showModal: false });
},

open(){
open() {
this.setState({ showModal: true });
},

Expand Down
6 changes: 3 additions & 3 deletions docs/examples/ModalContained.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
*/

const Trigger = React.createClass({
getInitialState(){
getInitialState() {
return { show: false };
},

render() {
let close = e => this.setState({ show: false});
let close = () => this.setState({ show: false});

return (
<div className="modal-container" style={{height: 200}}>
<Button
bsStyle="primary"
bsSize="large"
onClick={e => this.setState({ show: true})}
onClick={() => this.setState({ show: true})}
>
Launch contained modal
</Button>
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/ModalDefaultSizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ const MyLargeModal = React.createClass({
});

const App = React.createClass({
getInitialState(){
getInitialState() {
return { smShow: false, lgShow: false };
},
render(){
let smClose = e => this.setState({ smShow: false });
let lgClose = e => this.setState({ lgShow: false });
render() {
let smClose = () => this.setState({ smShow: false });
let lgClose = () => this.setState({ lgShow: false });

return (
<ButtonToolbar>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/NavBasic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function handleSelect (selectedKey) {
function handleSelect(selectedKey) {
alert('selected ' + selectedKey);
}

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/NavStacked.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function handleSelect (selectedKey) {
function handleSelect(selectedKey) {
alert('selected ' + selectedKey);
}

Expand Down
8 changes: 4 additions & 4 deletions docs/examples/Overlay.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

const Example = React.createClass({
getInitialState(){
getInitialState() {
return { show: true };
},

toggle(){
toggle() {
this.setState({ show: !this.state.show });
},

render(){
render() {
const tooltip = <Tooltip>Tooltip overload!</Tooltip>;

const sharedProps = {
show: this.state.show,
container: this,
target: props => React.findDOMNode(this.refs.target)
target: () => React.findDOMNode(this.refs.target)
};

return (
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/OverlayCustom.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

const Example = React.createClass({
getInitialState(){
getInitialState() {
return { show: true };
},

toggle(){
toggle() {
this.setState({ show: !this.state.show });
},

render(){
render() {
const style = {
position: 'absolute',
backgroundColor: '#EEE',
Expand All @@ -31,7 +31,7 @@ const Example = React.createClass({
onHide={() => this.setState({ show: false })}
placement="right"
container={this}
target={ props => React.findDOMNode(this.refs.target)}
target={() => React.findDOMNode(this.refs.target)}
>
<div style={style}>
<strong>Holy guacamole!</strong> Check this info.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/PaginationBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const PaginationBasic = React.createClass({
};
},

handleSelect(event, selectedEvent){
handleSelect(event, selectedEvent) {
this.setState({
activePage: selectedEvent.eventKey
});
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/PanelCollapsible.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class Example extends React.Component {
constructor(...args){
constructor(...args) {
super(...args);
this.state = {
open: true
};
}

render(){
render() {
return (
<div>
<Button onClick={ ()=> this.setState({ open: !this.state.open })}>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/PopoverContained.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class Example extends React.Component {
constructor(...args){
constructor(...args) {
super(...args);
this.state = { show: false };
}
render(){
render() {
return (
<ButtonToolbar>
<Button
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/SplitButtonBasic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const BUTTONS = ['Default', 'Primary', 'Success', 'Info', 'Warning', 'Danger'];

function renderDropdownButton (title, i) {
function renderDropdownButton(title, i) {
return (
<SplitButton bsStyle={title.toLowerCase()} title={title} key={i} id={`split-button-basic-${i}`}>
<MenuItem eventKey="1">Action</MenuItem>
Expand Down
10 changes: 5 additions & 5 deletions docs/generate-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let isLiteral = str => (/^('|")/).test(str.trim());
*
* @param {ComponentMetadata|PropMetadata} obj
*/
function parseDoclets(obj){
function parseDoclets(obj) {
obj.doclets = metadata.parseDoclets(obj.desc || '') || {};
obj.desc = cleanDoclets(obj.desc || '');
obj.descHtml = marked(obj.desc || '');
Expand All @@ -39,7 +39,7 @@ function parseDoclets(obj){
* @param {Object} props Object Hash of the prop metadata
* @param {String} propName
*/
function applyPropDoclets(props, propName){
function applyPropDoclets(props, propName) {
let prop = props[propName];
let doclets = prop.doclets;
let value;
Expand Down Expand Up @@ -72,8 +72,8 @@ function applyPropDoclets(props, propName){
}


export default function generate(destination, options = { mixins: true, inferComponent: true }){
return globp(__dirname + '/../src/**/*.js') //eslint-disable-line no-path-concat
export default function generate(destination, options = { mixins: true, inferComponent: true }) {
return globp(__dirname + '/../src/**/*.js') // eslint-disable-line no-path-concat
.then( files => {
let results = files.map(
filename => fsp.readFile(filename).then(content => metadata(content, options)) );
Expand All @@ -96,7 +96,7 @@ export default function generate(destination, options = { mixins: true, inferCom
});
});

//combine all the component metadata into one large object
// combine all the component metadata into one large object
result = { ...result, ...components };
});

Expand Down
4 changes: 2 additions & 2 deletions docs/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (development) {
let webpackPort = process.env.WEBPACK_DEV_PORT;
let target = `http://${ip.address()}:${webpackPort}`;

app.get('/assets/*', function (req, res) {
app.get('/assets/*', function(req, res) {
proxy.web(req, res, { target });
});

Expand Down Expand Up @@ -49,7 +49,7 @@ if (development) {
app.use(express.static(path.join(__dirname, '../docs-built')));
}

app.listen(port, function () {
app.listen(port, function() {
console.log(`Server started at:`);
console.log(`- http://localhost:${port}`);
console.log(`- http://${ip.address()}:${port}`);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Alert from '../../src/Alert';
import Glyphicon from '../../src/Glyphicon';
import Label from '../../src/Label';

export default class HomePage extends React.Component{
export default class HomePage extends React.Component {
render() {
return (
<div>
Expand Down
12 changes: 6 additions & 6 deletions docs/src/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Table from '../../src/Table';
let cleanDocletValue = str => str.trim().replace(/^\{/, '').replace(/\}$/, '');
let capitalize = str => str[0].toUpperCase() + str.substr(1);

function getPropsData(component, metadata){
function getPropsData(component, metadata) {
let componentData = metadata[component] || {};
let props = componentData.props || {};

Expand Down Expand Up @@ -38,14 +38,14 @@ const PropTable = React.createClass({
metadata: React.PropTypes.object
},

componentWillMount(){
componentWillMount() {
this.propsData = getPropsData(this.props.component, this.context.metadata);
},

render(){
render() {
let propsData = this.propsData;

if ( !Object.keys(propsData).length){
if ( !Object.keys(propsData).length) {
return <span/>;
}

Expand All @@ -66,7 +66,7 @@ const PropTable = React.createClass({
);
},

_renderRows(propsData){
_renderRows(propsData) {
return Object.keys(propsData)
.sort()
.filter(propName => propsData[propName].type && !propsData[propName].doclets.private )
Expand Down Expand Up @@ -107,7 +107,7 @@ const PropTable = React.createClass({
);
},

renderControllableNote(prop, propName){
renderControllableNote(prop, propName) {
let controllable = prop.doclets.controllable;
let isHandler = this.getDisplayTypeName(prop.type.name) === 'function';

Expand Down
2 changes: 1 addition & 1 deletion docs/src/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Root = React.createClass({
metadata: React.PropTypes.object
},

getChildContext(){
getChildContext() {
return { metadata: this.props.propData };
},

Expand Down
Loading

0 comments on commit 360fceb

Please sign in to comment.