diff --git a/package.json b/package.json index 68806f14d..c75c52346 100644 --- a/package.json +++ b/package.json @@ -59,29 +59,29 @@ "object.values": "^1.0.3" }, "devDependencies": { - "babel-cli": "^6.10.1", - "babel-core": "^6.10.4", - "babel-eslint": "^6.1.0", + "babel-cli": "^6.11.4", + "babel-core": "^6.13.2", + "babel-eslint": "^6.1.2", "babel-preset-airbnb": "^2.0.0", - "babel-register": "^6.9.0", + "babel-register": "^6.11.6", "chai": "^3.5.0", - "coveralls": "^2.11.9", + "coveralls": "^2.11.12", "enzyme-example-jest": "^0.1.0", "enzyme-example-karma": "^0.1.1", "enzyme-example-karma-webpack": "^0.1.4", "enzyme-example-mocha": "^0.1.0", "enzyme-example-react-native": "^0.1.0", - "eslint": "^2.13.1", - "eslint-config-airbnb": "^9.0.1", - "eslint-plugin-import": "^1.10.0", - "eslint-plugin-jsx-a11y": "^1.5.3", - "eslint-plugin-react": "^5.2.2", + "eslint": "^3.2.2", + "eslint-config-airbnb": "^10.0.0", + "eslint-plugin-import": "^1.12.0", + "eslint-plugin-jsx-a11y": "^2.0.1", + "eslint-plugin-react": "^6.0.0", "gitbook-cli": "^1.0.1", "istanbul": "^1.0.0-alpha.2", "jsdom": "^6.1.0", - "mocha": "^2.5.3", - "rimraf": "^2.5.2", - "sinon": "^1.17.4" + "mocha": "^3.0.1", + "rimraf": "^2.5.4", + "sinon": "^1.17.5" }, "peerDependencies": { "react": "0.13.x || 0.14.x || ^15.0.0-0" diff --git a/src/ReactWrapper.jsx b/src/ReactWrapper.jsx index 31ae4337a..131ba0aaa 100644 --- a/src/ReactWrapper.jsx +++ b/src/ReactWrapper.jsx @@ -1,9 +1,10 @@ import React from 'react'; -import ComplexSelector from './ComplexSelector'; import cheerio from 'cheerio'; import flatten from 'lodash/flatten'; import unique from 'lodash/uniq'; import compact from 'lodash/compact'; + +import ComplexSelector from './ComplexSelector'; import createWrapperComponent from './ReactWrapperComponent'; import { instHasClassName, diff --git a/src/ShallowTraversal.js b/src/ShallowTraversal.js index 7ecd4dafe..e12608428 100644 --- a/src/ShallowTraversal.js +++ b/src/ShallowTraversal.js @@ -69,7 +69,7 @@ export function pathToNode(node, root) { // leaf node. if it isn't the node we are looking for, we pop. path.pop(); } - queue.push.apply(queue, children); + queue.push(...children); } return null; @@ -101,7 +101,7 @@ export function nodeHasProperty(node, propKey, stringifiedPropValue) { return nodePropValue === propValue; } - return nodeProps.hasOwnProperty(propKey); + return Object.prototype.hasOwnProperty.call(nodeProps, propKey); } export function nodeMatchesObjectProps(node, props) { diff --git a/src/ShallowWrapper.js b/src/ShallowWrapper.js index 0b5781a8f..e1551b0d0 100644 --- a/src/ShallowWrapper.js +++ b/src/ShallowWrapper.js @@ -1,9 +1,10 @@ import React from 'react'; -import ComplexSelector from './ComplexSelector'; import flatten from 'lodash/flatten'; import unique from 'lodash/uniq'; import compact from 'lodash/compact'; import cheerio from 'cheerio'; + +import ComplexSelector from './ComplexSelector'; import { nodeEqual, containsChildrenSubArray, diff --git a/src/react-compat.js b/src/react-compat.js index 058014227..a35e0dc63 100644 --- a/src/react-compat.js +++ b/src/react-compat.js @@ -2,11 +2,12 @@ global-require: 0, import/no-mutable-exports: 0, import/no-unresolved: 0, - react/no-deprecated: 0 + react/no-deprecated: 0, + react/no-render-return-value: 0, */ -import { REACT013 } from './version'; import objectAssign from 'object.assign'; +import { REACT013 } from './version'; let TestUtils; let createShallowRenderer; @@ -71,6 +72,7 @@ if (REACT013) { let ReactDOM; try { + // eslint-disable-next-line import/no-extraneous-dependencies ReactDOM = require('react-dom'); } catch (e) { // eslint-disable-next-line no-console @@ -82,7 +84,9 @@ if (REACT013) { throw e; } + // eslint-disable-next-line import/no-extraneous-dependencies renderToStaticMarkup = require('react-dom/server').renderToStaticMarkup; + findDOMNode = ReactDOM.findDOMNode; unmountComponentAtNode = ReactDOM.unmountComponentAtNode; batchedUpdates = ReactDOM.unstable_batchedUpdates; @@ -91,6 +95,7 @@ if (REACT013) { // to list this as a dependency in package.json and have 0.13 work properly. // As a result, right now this is basically an implicit dependency. try { + // eslint-disable-next-line import/no-extraneous-dependencies TestUtils = require('react-addons-test-utils'); } catch (e) { // eslint-disable-next-line no-console diff --git a/src/render.js b/src/render.js index c3b76715a..0ba17df60 100644 --- a/src/render.js +++ b/src/render.js @@ -1,5 +1,5 @@ -import { renderToStaticMarkup } from './react-compat'; import cheerio from 'cheerio'; +import { renderToStaticMarkup } from './react-compat'; /** * Renders a react component into static HTML and provides a cheerio wrapper around it. This is diff --git a/src/version.js b/src/version.js index 2ccbbc3c2..8d64d2611 100644 --- a/src/version.js +++ b/src/version.js @@ -1,4 +1,5 @@ import React from 'react'; + export const VERSION = React.version; export const REACT013 = VERSION.slice(0, 4) === '0.13'; export const REACT014 = VERSION.slice(0, 4) === '0.14'; diff --git a/test/.eslintrc b/test/.eslintrc index eb5959112..916f89a9f 100644 --- a/test/.eslintrc +++ b/test/.eslintrc @@ -7,6 +7,7 @@ "react/prefer-es6-class": 0, "react/prefer-stateless-function": 0, "react/prop-types": 0, + "react/no-string-refs": 0, "import/no-extraneous-dependencies": [2, { "devDependencies": true }], diff --git a/test/ComplexSelector-spec.jsx b/test/ComplexSelector-spec.jsx index b3e2acb2a..1cae89784 100644 --- a/test/ComplexSelector-spec.jsx +++ b/test/ComplexSelector-spec.jsx @@ -1,6 +1,7 @@ -import { describeWithDOM } from './_helpers'; import React from 'react'; import { expect } from 'chai'; + +import { describeWithDOM } from './_helpers'; import { mount, shallow, @@ -29,7 +30,7 @@ describe('ComplexSelector', () => { inside top div -
+
); @@ -42,14 +43,14 @@ describe('ComplexSelector', () => { const wrapper = renderMethod(
-

+

heading

-

+

heading

-

+

heading

); @@ -64,12 +65,12 @@ describe('ComplexSelector', () => {
-

+

heading

-

+

heading

); diff --git a/test/ReactWrapper-spec.jsx b/test/ReactWrapper-spec.jsx index d27a0b6cc..503eee358 100644 --- a/test/ReactWrapper-spec.jsx +++ b/test/ReactWrapper-spec.jsx @@ -1,3 +1,9 @@ +/* globals document */ + +import React from 'react'; +import { expect } from 'chai'; +import sinon from 'sinon'; + import { describeWithDOM, describeIf, @@ -5,14 +11,11 @@ import { itWithData, generateEmptyRenderData, } from './_helpers'; -import React from 'react'; -import { expect } from 'chai'; import { mount, render, ReactWrapper, -} from '../src/'; -import sinon from 'sinon'; +} from '../src'; import { REACT013, REACT15 } from '../src/version'; describeWithDOM('mount', () => { @@ -1751,7 +1754,7 @@ describeWithDOM('mount', () => { render() { return (
- + {this.props.items.map(x => x)}
); @@ -1789,7 +1792,7 @@ describeWithDOM('mount', () => { it('should handle mixed children with and without arrays', () => { const Foo = (props) => (
- + {props.items.map(x => x)}
); diff --git a/test/ShallowTraversal-spec.jsx b/test/ShallowTraversal-spec.jsx index 0a667cd80..f31eed347 100644 --- a/test/ShallowTraversal-spec.jsx +++ b/test/ShallowTraversal-spec.jsx @@ -225,13 +225,13 @@ describe('ShallowTraversal', () => { describe('pathToNode', () => { it('should return trees from the root node', () => { - const node =