Skip to content

Commit 2fc9976

Browse files
committed
eslint cleanup; trailing comma fix for IE
- Removed unused variables - Removed double declarations - Most importantly, removed trailing commas which were breaking IE - Added eslint.json for future eslint usage
1 parent 154c074 commit 2fc9976

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

eslint.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true
5+
},
6+
"rules": {
7+
"quotes": 0,
8+
"no-comma-dangle": 2,
9+
"no-underscore-dangle": 0,
10+
"curly": 0,
11+
"strict": 0,
12+
"no-use-before-define": 0,
13+
"no-cond-assign": 0,
14+
"consistent-return": 0,
15+
"new-cap": 0
16+
}
17+
}

modules/components/Route.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var React = require('react');
22
var warning = require('react/lib/warning');
3-
var invariant = require('react/lib/invariant');
43
var ExecutionEnvironment = require('react/lib/ExecutionEnvironment');
54
var mergeProperties = require('../helpers/mergeProperties');
65
var goBack = require('../helpers/goBack');
@@ -34,7 +33,7 @@ var REF_NAME = '__activeRoute__';
3433
/**
3534
* <Route> components specify components that are rendered to the page when the
3635
* URL matches a given pattern.
37-
*
36+
*
3837
* Routes are arranged in a nested tree structure. When a new URL is requested,
3938
* the tree is searched depth-first to find a route whose path matches the URL.
4039
* When one is found, all routes in the tree that lead to it are considered
@@ -117,7 +116,7 @@ var Route = React.createClass({
117116
location: React.PropTypes.oneOf([ 'hash', 'history' ]).isRequired,
118117
handler: React.PropTypes.any.isRequired,
119118
path: React.PropTypes.string,
120-
name: React.PropTypes.string,
119+
name: React.PropTypes.string
121120
},
122121

123122
getDefaultProps: function () {
@@ -265,6 +264,7 @@ function Redirect(to, params, query) {
265264

266265
function findMatches(path, route) {
267266
var children = route.props.children, matches;
267+
var params;
268268

269269
// Check the subtree first to find the most deeply-nested match.
270270
if (Array.isArray(children)) {
@@ -277,7 +277,7 @@ function findMatches(path, route) {
277277

278278
if (matches) {
279279
var rootParams = getRootMatch(matches).params;
280-
var params = {};
280+
params = {};
281281

282282
Path.extractParamNames(route.props.path).forEach(function (paramName) {
283283
params[paramName] = rootParams[paramName];
@@ -289,7 +289,7 @@ function findMatches(path, route) {
289289
}
290290

291291
// No routes in the subtree matched, so check this route.
292-
var params = Path.extractParams(route.props.path, path);
292+
params = Path.extractParams(route.props.path, path);
293293

294294
if (params)
295295
return [ makeMatch(route, params) ];
@@ -422,7 +422,7 @@ function checkTransitionFromHooks(matches, transition) {
422422
function checkTransitionToHooks(matches, transition) {
423423
var promise = Promise.resolve();
424424

425-
matches.forEach(function (match, index) {
425+
matches.forEach(function (match) {
426426
promise = promise.then(function () {
427427
var handler = match.route.props.handler;
428428

modules/stores/RouteStore.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var RouteStore = {
7171
if (route.props.name)
7272
delete _namedRoutes[route.props.name];
7373

74-
React.Children.forEach(route.props.children, function (child) {
74+
React.Children.forEach(route.props.children, function () {
7575
RouteStore.unregisterRoute(route);
7676
});
7777
},

0 commit comments

Comments
 (0)