Skip to content

Commit

Permalink
[Dev Deps] update eslint, eslint-config-airbnb, `eslint-plugin-re…
Browse files Browse the repository at this point in the history
…act`
  • Loading branch information
ljharb committed Jan 8, 2016
1 parent 8e96af6 commit 5498604
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 133 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"babel-eslint": "^4.1.4",
"chai": "^3.2.0",
"coveralls": "^2.11.4",
"eslint": "^1.9.0",
"eslint-config-airbnb": "^0.1.0",
"eslint-plugin-react": "^3.8.0",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^3.0.2",
"eslint-plugin-react": "^3.14.0",
"gitbook-cli": "^1.0.0",
"istanbul": "^0.4.0",
"mocha": "^2.2.5",
Expand Down
22 changes: 11 additions & 11 deletions src/Debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ export function indent(depth, string) {

function propString(prop) {
switch (typeof prop) {
case 'function':
return '{[Function]}';
case 'string':
return `"${prop}"`;
case 'number':
case 'boolean':
return `{${prop}}`;
case 'object':
return `{{...}}`;
default:
return `{[${typeof prop}]}`;
case 'function':
return '{[Function]}';
case 'string':
return `"${prop}"`;
case 'number':
case 'boolean':
return `{${prop}}`;
case 'object':
return `{{...}}`;
default:
return `{[${typeof prop}]}`;
}
}

Expand Down
56 changes: 28 additions & 28 deletions src/MountedTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export function instHasId(inst, id) {

export function instHasType(inst, type) {
switch (typeof type) {
case 'string':
return isDOMComponent(inst) &&
inst.tagName.toUpperCase() === type.toUpperCase();
case 'function':
return isCompositeComponentWithType(inst, type);
default:
return false;
case 'string':
return isDOMComponent(inst) &&
inst.tagName.toUpperCase() === type.toUpperCase();
case 'function':
return isCompositeComponentWithType(inst, type);
default:
return false;
}
}

Expand Down Expand Up @@ -155,29 +155,29 @@ export function parentsOfInst(inst, root) {

export function buildInstPredicate(selector) {
switch (typeof selector) {
case 'function':
// selector is a component constructor
return inst => instHasType(inst, selector);
case 'function':
// selector is a component constructor
return inst => instHasType(inst, selector);

case 'string':
if (!isSimpleSelector(selector)) {
throw selectorError(selector);
}
if (isCompoundSelector.test(selector)) {
return AND(splitSelector(selector).map(buildInstPredicate));
}
if (selector[0] === '.') {
// selector is a class name
return inst => instHasClassName(inst, selector.substr(1));
} else if (selector[0] === '#') {
// selector is an id name
return inst => instHasId(inst, selector.substr(1));
}
// selector is a string. match to DOM tag or constructor displayName
return inst => instHasType(inst, selector);
case 'string':
if (!isSimpleSelector(selector)) {
throw selectorError(selector);
}
if (isCompoundSelector.test(selector)) {
return AND(splitSelector(selector).map(buildInstPredicate));
}
if (selector[0] === '.') {
// selector is a class name
return inst => instHasClassName(inst, selector.substr(1));
} else if (selector[0] === '#') {
// selector is an id name
return inst => instHasId(inst, selector.substr(1));
}
// selector is a string. match to DOM tag or constructor displayName
return inst => instHasType(inst, selector);

default:
throw new TypeError('Expecting a string or Component Constructor');
default:
throw new TypeError('Expecting a string or Component Constructor');
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/ReactWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class ReactWrapper {
Component={nodes.type}
props={nodes.props}
context={options.context}
/>
/>
);
this.root = this;
this.node = this.component.getWrappedComponent();
Expand Down Expand Up @@ -434,8 +434,8 @@ export default class ReactWrapper {
}

/**
* Reduces the current array of nodes to another array. Each node is passed in as a `ShallowWrapper`
* to the reducer function.
* Reduces the current array of nodes to another array.
* Each node is passed in as a `ShallowWrapper` to the reducer function.
*
* @param {Function} fn - the reducer function
* @param {*} initialValue - the initial value
Expand Down
46 changes: 23 additions & 23 deletions src/ShallowTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,29 @@ export function nodeHasType(node, type) {

export function buildPredicate(selector) {
switch (typeof selector) {
case 'function':
// selector is a component constructor
return node => node && node.type === selector;

case 'string':
if (!isSimpleSelector(selector)) {
throw selectorError(selector);
}
if (isCompoundSelector.test(selector)) {
return AND(splitSelector(selector).map(buildPredicate));
}
if (selector[0] === '.') {
// selector is a class name
return node => hasClassName(node, selector.substr(1));
} else if (selector[0] === '#') {
// selector is an id name
return node => nodeHasId(node, selector.substr(1));
}
// selector is a string. match to DOM tag or constructor displayName
return node => nodeHasType(node, selector);

default:
throw new TypeError('Expecting a string or Component Constructor');
case 'function':
// selector is a component constructor
return node => node && node.type === selector;

case 'string':
if (!isSimpleSelector(selector)) {
throw selectorError(selector);
}
if (isCompoundSelector.test(selector)) {
return AND(splitSelector(selector).map(buildPredicate));
}
if (selector[0] === '.') {
// selector is a class name
return node => hasClassName(node, selector.substr(1));
} else if (selector[0] === '#') {
// selector is an id name
return node => nodeHasId(node, selector.substr(1));
}
// selector is a string. match to DOM tag or constructor displayName
return node => nodeHasType(node, selector);

default:
throw new TypeError('Expecting a string or Component Constructor');
}
}

Expand Down
34 changes: 17 additions & 17 deletions src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ export function onPrototype(Component, lifecycle, method) {
Object.getOwnPropertyNames(proto).forEach((name) => {
if (typeof proto[name] !== 'function') return;
switch (name) {
case 'componentDidMount':
case 'componentWillMount':
case 'componentDidUnmount':
case 'componentWillUnmount':
case 'componentWillReceiveProps':
case 'componentDidUpdate':
case 'componentWillUpdate':
case 'shouldComponentUpdate':
case 'render':
if (lifecycle) lifecycle(proto, name);
break;
case 'constructor':
// don't spy on the constructor, even though it shows up in the prototype
break;
default:
if (method) method(proto, name);
break;
case 'componentDidMount':
case 'componentWillMount':
case 'componentDidUnmount':
case 'componentWillUnmount':
case 'componentWillReceiveProps':
case 'componentDidUpdate':
case 'componentWillUpdate':
case 'shouldComponentUpdate':
case 'render':
if (lifecycle) lifecycle(proto, name);
break;
case 'constructor':
// don't spy on the constructor, even though it shows up in the prototype
break;
default:
if (method) method(proto, name);
break;
}
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"react/no-multi-comp": 0,
"react/prop-types": 0,
"react/no-did-mount-set-state": 0,
"react/prefer-es6-class": 0,
"no-param-reassign": 0,
}
}

0 comments on commit 5498604

Please sign in to comment.