diff --git a/.eslintrc b/.eslintrc index 32f8cd4..fbd8ae3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,11 +1,26 @@ { "parser": "babel-eslint", - "plugins": ["react"], + "plugins": ["react", "import"], + "extends": [ + "plugin:import/errors", + "plugin:import/warnings", + "eslint:recommended", + "plugin:react/recommended" + ], "env": { - "node": true + "node": true, + "es6": true, + "browser": true, + "mocha": true }, - "ecmaFeatures": { - "jsx": true + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + }, + "globals": { + "window": true, + "document": true }, "rules": { "no-console": ["warn", {allow: ["warn","error"]}], diff --git a/package.json b/package.json index 3335e57..fc8ca00 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,16 @@ "version": "1.0.0", "description": "Run or walk for your transport?", "main": "./server/start.js", + "engines": { + "node": "6.1.9" + }, "scripts": { "start": "node ./server/start.js", "start:dev": "nodemon ./server/start.js", "dev": "node ./src/utils/dev-server.js", "postinstall": "webpack --config ./webpack.production.config.js", "build": "webpack --config webpack.dev.config.js", + "lint": "eslint src/**/*.js server/**/*.js test/**/*.js", "test": "tape --require babel-register --require ignore-styles --require ./test/utils/test_helpers.js 'test/tape/**/*.es6'", "test:mocha": "node_modules/mocha/bin/mocha --compilers js:babel-core/register --require ./test/utils/test_helpers.js 'test/unit/**/*.@(js|jsx)'" }, @@ -54,10 +58,12 @@ "babel-eslint": "^7.0.0", "chai": "^3.5.0", "eslint": "^3.8.1", + "eslint-plugin-import": "^2.2.0", "eslint-plugin-react": "^6.4.1", "jsdom": "^9.8.0", "mocha": "^3.1.2", "react-addons-test-utils": "^15.3.2", + "tap-spec": "^4.1.1", "webpack-dev-server": "^1.16.2" } } diff --git a/test/unit/app-container.js b/test/unit/app-container.js index 60f8d17..92e5029 100644 --- a/test/unit/app-container.js +++ b/test/unit/app-container.js @@ -2,14 +2,10 @@ import React from 'react'; import { renderIntoDocument } from 'react-addons-test-utils'; -import { scryRenderedDOMComponentsWithTag } from 'react-addons-test-utils'; import { scryRenderedDOMComponentsWithClass } from 'react-addons-test-utils'; import { expect } from 'chai'; -import shallowRenderer from '../utils/shallowRenderer.js'; - -import AppContainer from '../../public/src/components/app-container.jsx'; -import DirectionButtons from '../../public/src/components/direction-buttons.jsx'; +import AppContainer from '../../src/js/containers/app.jsx'; describe('AppContainer', function () { @@ -27,11 +23,4 @@ describe('AppContainer', function () { expect(_ArrivalsContainer.length).to.equal(1); }); - - it('renders DirectionButtons correctly', function () { - - const _directionButtons = shallowRenderer(); - - expect(_directionButtons.props.children.length).to.equal(2); - }); }); diff --git a/test/unit/arrivals.js b/test/unit/arrivals.js index abd0eb9..7694cc5 100644 --- a/test/unit/arrivals.js +++ b/test/unit/arrivals.js @@ -1,15 +1,13 @@ 'use strict'; import React from 'react'; -import { renderIntoDocument } from 'react-addons-test-utils'; -import { scryRenderedDOMComponentsWithTag } from 'react-addons-test-utils'; -import { scryRenderedDOMComponentsWithClass } from 'react-addons-test-utils'; +import { + renderIntoDocument, + scryRenderedDOMComponentsWithClass +} from 'react-addons-test-utils'; import { expect } from 'chai'; -import shallowRenderer from '../utils/shallowRenderer.js'; - -import AppContainer from '../../public/src/components/app-container.jsx'; -import DirectionButtons from '../../public/src/components/direction-buttons.jsx'; +import AppContainer from '../../src/js/containers/app.jsx'; describe('AppContainer', function () { diff --git a/test/utils/shallowRenderer.js b/test/utils/shallowRenderer.js index 3236bd2..1d72fe1 100644 --- a/test/utils/shallowRenderer.js +++ b/test/utils/shallowRenderer.js @@ -1,6 +1,5 @@ 'use strict'; -import React from 'react'; import { createRenderer } from 'react-addons-test-utils'; export default function shallowRenderer (component) { diff --git a/test/utils/test_helpers.js b/test/utils/test_helpers.js index 05dc000..fa11765 100644 --- a/test/utils/test_helpers.js +++ b/test/utils/test_helpers.js @@ -6,9 +6,6 @@ import jsdom from 'jsdom'; const doc = jsdom.jsdom(''); const win = doc.defaultView; -function doNothing () { - return null; -} // require('ignore-styles');