Skip to content

Commit

Permalink
eslint cleanup; trailing comma fix for IE
Browse files Browse the repository at this point in the history
- Removed unused variables
- Removed double declarations
- Most importantly, removed trailing commas which were breaking IE
- Added eslint.json for future eslint usage
  • Loading branch information
aaronshaf committed Jul 25, 2014
1 parent 154c074 commit 2fc9976
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
17 changes: 17 additions & 0 deletions eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"node": true
},
"rules": {
"quotes": 0,
"no-comma-dangle": 2,
"no-underscore-dangle": 0,
"curly": 0,
"strict": 0,
"no-use-before-define": 0,
"no-cond-assign": 0,
"consistent-return": 0,
"new-cap": 0
}
}
12 changes: 6 additions & 6 deletions modules/components/Route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var React = require('react');
var warning = require('react/lib/warning');
var invariant = require('react/lib/invariant');
var ExecutionEnvironment = require('react/lib/ExecutionEnvironment');
var mergeProperties = require('../helpers/mergeProperties');
var goBack = require('../helpers/goBack');
Expand Down Expand Up @@ -34,7 +33,7 @@ var REF_NAME = '__activeRoute__';
/**
* <Route> components specify components that are rendered to the page when the
* URL matches a given pattern.
*
*
* Routes are arranged in a nested tree structure. When a new URL is requested,
* the tree is searched depth-first to find a route whose path matches the URL.
* When one is found, all routes in the tree that lead to it are considered
Expand Down Expand Up @@ -117,7 +116,7 @@ var Route = React.createClass({
location: React.PropTypes.oneOf([ 'hash', 'history' ]).isRequired,
handler: React.PropTypes.any.isRequired,
path: React.PropTypes.string,
name: React.PropTypes.string,
name: React.PropTypes.string
},

getDefaultProps: function () {
Expand Down Expand Up @@ -265,6 +264,7 @@ function Redirect(to, params, query) {

function findMatches(path, route) {
var children = route.props.children, matches;
var params;

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

if (matches) {
var rootParams = getRootMatch(matches).params;
var params = {};
params = {};

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

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

if (params)
return [ makeMatch(route, params) ];
Expand Down Expand Up @@ -422,7 +422,7 @@ function checkTransitionFromHooks(matches, transition) {
function checkTransitionToHooks(matches, transition) {
var promise = Promise.resolve();

matches.forEach(function (match, index) {
matches.forEach(function (match) {
promise = promise.then(function () {
var handler = match.route.props.handler;

Expand Down
2 changes: 1 addition & 1 deletion modules/stores/RouteStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var RouteStore = {
if (route.props.name)
delete _namedRoutes[route.props.name];

React.Children.forEach(route.props.children, function (child) {
React.Children.forEach(route.props.children, function () {
RouteStore.unregisterRoute(route);
});
},
Expand Down

0 comments on commit 2fc9976

Please sign in to comment.