Skip to content

Commit 4117c73

Browse files
committed
Style tweaks
1 parent b3f50a0 commit 4117c73

17 files changed

+103
-106
lines changed

modules/IndexLink.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react'
1+
import React, { Component } from 'react'
22
import Link from './Link'
33

44
/**
55
* An <IndexLink> is used to link to an <IndexRoute>.
66
*/
7-
class IndexLink extends React.Component {
7+
class IndexLink extends Component {
88

99
render() {
1010
return <Link {...this.props} onlyActiveOnIndex={true} />

modules/IndexRedirect.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react'
2-
import invariant from 'invariant'
31
import warning from 'warning'
2+
import invariant from 'invariant'
3+
import React, { Component } from 'react'
44
import Redirect from './Redirect'
55
import { falsy } from './PropTypes'
66

@@ -9,7 +9,7 @@ const { string, object } = React.PropTypes
99
/**
1010
* An <IndexRedirect> is used to redirect from an indexRoute.
1111
*/
12-
class IndexRedirect extends React.Component {
12+
class IndexRedirect extends Component {
1313

1414
static createRouteFromReactElement(element, parentRoute) {
1515
if (parentRoute) {

modules/IndexRoute.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react'
2-
import invariant from 'invariant'
31
import warning from 'warning'
2+
import invariant from 'invariant'
3+
import React, { Component } from 'react'
44
import { createRouteFromReactElement } from './RouteUtils'
55
import { component, components, falsy } from './PropTypes'
66

@@ -10,7 +10,7 @@ const { bool, func } = React.PropTypes
1010
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
1111
* a JSX route config.
1212
*/
13-
class IndexRoute extends React.Component {
13+
class IndexRoute extends Component {
1414

1515
static createRouteFromReactElement(element, parentRoute) {
1616
if (parentRoute) {

modules/Link.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { Component } from 'react'
22

33
const { bool, object, string, func } = React.PropTypes
44

@@ -36,7 +36,7 @@ function isEmptyObject(object) {
3636
*
3737
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
3838
*/
39-
class Link extends React.Component {
39+
class Link extends Component {
4040

4141
static contextTypes = {
4242
history: object

modules/Redirect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react'
21
import invariant from 'invariant'
2+
import React, { Component } from 'react'
33
import { createRouteFromReactElement } from './RouteUtils'
44
import { formatPattern } from './PatternUtils'
55
import { falsy } from './PropTypes'
@@ -13,7 +13,7 @@ const { string, object } = React.PropTypes
1313
* Redirects are placed alongside routes in the route configuration
1414
* and are traversed in the same manner.
1515
*/
16-
class Redirect extends React.Component {
16+
class Redirect extends Component {
1717

1818
static createRouteFromReactElement(element) {
1919
const route = createRouteFromReactElement(element)

modules/Route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react'
21
import warning from 'warning'
32
import invariant from 'invariant'
3+
import React, { Component } from 'react'
44
import { createRouteFromReactElement } from './RouteUtils'
55
import { component, components } from './PropTypes'
66

@@ -16,7 +16,7 @@ const { string, bool, func } = React.PropTypes
1616
* that lead to it are considered "active" and their components are
1717
* rendered into the DOM, nested in the same order as in the tree.
1818
*/
19-
class Route extends React.Component {
19+
class Route extends Component {
2020

2121
static createRouteFromReactElement(element) {
2222
const route = createRouteFromReactElement(element)

modules/Router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react'
21
import warning from 'warning'
2+
import React, { Component } from 'react'
33
import createHashHistory from 'history/lib/createHashHistory'
44
import { createRoutes } from './RouteUtils'
55
import RoutingContext from './RoutingContext'
@@ -13,7 +13,7 @@ const { func, object } = React.PropTypes
1313
* a router that renders a <RoutingContext> with all the props
1414
* it needs each time the URL changes.
1515
*/
16-
class Router extends React.Component {
16+
class Router extends Component {
1717

1818
static propTypes = {
1919
history: object,

modules/RoutingContext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react'
21
import invariant from 'invariant'
2+
import React, { Component } from 'react'
33
import getRouteParams from './getRouteParams'
44

55
const { array, func, object } = React.PropTypes
@@ -8,7 +8,7 @@ const { array, func, object } = React.PropTypes
88
* A <RoutingContext> renders the component tree for a given router state
99
* and sets the history object and the current location in context.
1010
*/
11-
class RoutingContext extends React.Component {
11+
class RoutingContext extends Component {
1212

1313
static propTypes = {
1414
history: object.isRequired,

modules/__tests__/IndexLink-test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*eslint-env mocha */
22
/*eslint react/prop-types: 0*/
33
import expect from 'expect'
4-
import React from 'react'
4+
import React, { Component } from 'react'
55
import { render, unmountComponentAtNode } from 'react-dom'
66
import createHistory from 'history/lib/createMemoryHistory'
77
import IndexRoute from '../IndexRoute'
@@ -12,7 +12,7 @@ import Link from '../Link'
1212

1313
describe('An <IndexLink>', function () {
1414

15-
class App extends React.Component {
15+
class App extends Component {
1616
render() {
1717
return (
1818
<div>
@@ -28,51 +28,51 @@ describe('An <IndexLink>', function () {
2828
}
2929
}
3030

31-
class Website extends React.Component {
31+
class Wrapper extends Component {
3232
render() {
3333
return <div>website wrapper {this.props.children}</div>
3434
}
3535
}
3636

37-
class WebsiteOverview extends React.Component {
37+
class IndexPage extends Component {
3838
render() {
3939
return <div>website overview</div>
4040
}
4141
}
4242

43-
class WebsiteContact extends React.Component {
43+
class ContactPage extends Component {
4444
render() {
4545
return <div>contact page</div>
4646
}
4747
}
4848

49-
class WebsiteProducts extends React.Component {
49+
class ProductsPage extends Component {
5050
render() {
5151
return <div>website products {this.props.children}</div>
5252
}
5353
}
5454

55-
class WebsiteProductsProduct extends React.Component {
55+
class ProductPage extends Component {
5656
render() {
5757
return <div>specific product {this.props.params.productId}</div>
5858
}
5959
}
6060

61-
class WebsiteProductsIndex extends React.Component {
61+
class ProductsIndexPage extends Component {
6262
render() {
6363
return <div>list of products</div>
6464
}
6565
}
6666

6767
const routes = (
6868
<Route component={App}>
69-
<Route path="/website" component={Website}>
70-
<Route path="products" component={WebsiteProducts}>
71-
<Route path=":productId" component={WebsiteProductsProduct} />
72-
<IndexRoute component={WebsiteProductsIndex} />
69+
<Route path="/website" component={Wrapper}>
70+
<Route path="products" component={ProductsPage}>
71+
<Route path=":productId" component={ProductPage} />
72+
<IndexRoute component={ProductsIndexPage} />
7373
</Route>
74-
<Route path="contact" component={WebsiteContact} />
75-
<IndexRoute component={WebsiteOverview} />
74+
<Route path="contact" component={ContactPage} />
75+
<IndexRoute component={IndexPage} />
7676
</Route>
7777
</Route>
7878
)

modules/__tests__/IndexRoute-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*eslint-env mocha */
22
/*eslint react/prop-types: 0*/
33
import expect from 'expect'
4-
import React from 'react'
4+
import React, { Component } from 'react'
55
import { render, unmountComponentAtNode } from 'react-dom'
66
import createHistory from 'history/lib/createMemoryHistory'
77
import IndexRoute from '../IndexRoute'
@@ -10,15 +10,15 @@ import Route from '../Route'
1010

1111
describe('An <IndexRoute>', function () {
1212

13-
class Parent extends React.Component {
13+
class Parent extends Component {
1414
render() {
1515
return <div>parent {this.props.children}</div>
1616
}
1717
}
1818

19-
class Child extends React.Component {
19+
class Child extends Component {
2020
render() {
21-
return <div>child </div>
21+
return <div>child</div>
2222
}
2323
}
2424

@@ -31,21 +31,21 @@ describe('An <IndexRoute>', function () {
3131
unmountComponentAtNode(node)
3232
})
3333

34-
it('renders when its parent’s url matches exactly', function (done) {
34+
it("renders when its parent's URL matches exactly", function (done) {
3535
render((
3636
<Router history={createHistory('/')}>
3737
<Route path="/" component={Parent}>
3838
<IndexRoute component={Child}/>
3939
</Route>
4040
</Router>
4141
), node, function () {
42-
expect(node.textContent.trim()).toEqual('parent child')
42+
expect(node.textContent).toEqual('parent child')
4343
done()
4444
})
4545
})
4646

4747
describe('nested deeply in the route hierarchy', function () {
48-
it('renders when its parent’s url matches exactly', function (done) {
48+
it("renders when its parent's URL matches exactly", function (done) {
4949
render((
5050
<Router history={createHistory('/test')}>
5151
<Route path="/" component={Parent}>
@@ -56,7 +56,7 @@ describe('An <IndexRoute>', function () {
5656
</Route>
5757
</Router>
5858
), node, function () {
59-
expect(node.textContent.trim()).toEqual('parent parent child')
59+
expect(node.textContent).toEqual('parent parent child')
6060
done()
6161
})
6262
})

0 commit comments

Comments
 (0)