Skip to content

Commit

Permalink
update npm packages and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Oct 22, 2016
1 parent 8b1324a commit 600ed0d
Show file tree
Hide file tree
Showing 23 changed files with 130 additions and 125 deletions.
4 changes: 2 additions & 2 deletions node_package/src/handleError.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function handleGeneratorFunctionIssue(options) {

let shouldBeGeneratorError =
`ERROR: ReactOnRails is incorrectly detecting generator function to be false. The React
component \'${name}\' seems to be a generator function.\n${lastLine}`;
component '${name}' seems to be a generator function.\n${lastLine}`;
const reMatchShouldBeGeneratorError = /Can't add property context, object is not extensible/;
if (reMatchShouldBeGeneratorError.test(e.message)) {
msg += `${shouldBeGeneratorError}\n\n`;
Expand All @@ -22,7 +22,7 @@ component \'${name}\' seems to be a generator function.\n${lastLine}`;

shouldBeGeneratorError =
`ERROR: ReactOnRails is incorrectly detecting generatorFunction to be true, but the React
component \'${name}\' is not a generator function.\n${lastLine}`;
component '${name}' is not a generator function.\n${lastLine}`;

const reMatchShouldNotBeGeneratorError = /Cannot call a class as a function/;

Expand Down
4 changes: 2 additions & 2 deletions node_package/tests/buildConsoleReplay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ test('consoleReplay replays converts script tag inside of object string to be sa
];
const actual = consoleReplay();

const expected = `console.log.apply(console, ["some message (/script><script>alert(\'WTF\')\
(/script>","{\\"a\\":\\"Wow(/script><script>alert(\'WTF\')(/script>\\",\\"b\\":2}"]);
const expected = `console.log.apply(console, ["some message (/script><script>alert('WTF')\
(/script>","{\\"a\\":\\"Wow(/script><script>alert('WTF')(/script>\\",\\"b\\":2}"]);
console.warn.apply(console, ["other message","{\\"c\\":3,\\"d\\":4}"]);`;

assert.equals(actual, expected, 'Unexpected value for console replay history');
Expand Down
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@
"doc": "docs"
},
"devDependencies": {
"babel-cli": "^6.6.5",
"babel-core": "^6.7.4",
"babel-loader": "^6.2.4",
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-flow-strip-types": "^6.8.0",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"babel-runtime": "^6.6.1",
"babel-plugin-transform-flow-strip-types": "^6.14.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babel-runtime": "^6.11.6",
"babel-tape-runner": "^2.0.1",
"babel-types": "^6.7.2",
"babelify": "^7.2.0",
"blue-tape": "^0.2.0",
"eslint": "^3.3.1",
"babel-types": "^6.16.0",
"babelify": "^7.3.0",
"blue-tape": "^1.0.0",
"eslint": "^3.8.1",
"eslint-config-shakacode": "^6.0.0",
"eslint-plugin-import": "^1.13.0",
"eslint-plugin-jsx-a11y": "^2.1.0",
"eslint-plugin-react": "^6.1.2",
"flow-bin": "^0.30.0",
"eslint-plugin-import": "^2.0.1",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.4.1",
"flow-bin": "^0.33.0",
"jscs": "^2.11.0",
"jsdom": "^8.2.0",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"jsdom": "^9.8.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"react-transform-hmr": "^1.0.4",
"redux": "^3.3.1",
"release-it": "^2.3.1",
"redux": "^3.6.0",
"release-it": "^2.4.3",
"tap-spec": "^4.1.1",
"tape": "^4.5.1",
"webpack": "^1.12.14"
"tape": "^4.6.2",
"webpack": "^1.13.2"
},
"peerDependencies": {
"react": ">= 0.14",
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,4 @@ DEPENDENCIES
web-console

BUNDLED WITH
1.12.3
1.13.5
2 changes: 2 additions & 0 deletions spec/dummy/client/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ extends: eslint-config-shakacode

rules:
no-console: 0
import/no-unresolved: 0
import/no-extraneous-dependencies: 0
1 change: 1 addition & 0 deletions spec/dummy/client/app/actions/HelloWorldActions.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as actionTypes from '../constants/HelloWorldConstants';

/* eslint-disable import/prefer-default-export */
export function updateName(name) {
return {
type: actionTypes.HELLO_WORLD_NAME_UPDATE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/prop-types */
import React from 'react';

import styles from './CssModulesImagesFontsExample.scss'
import styles from './CssModulesImagesFontsExample.scss';

export default (_props, _railsContext) => (
<div>
Expand All @@ -10,19 +10,19 @@ export default (_props, _railsContext) => (
<h2>
Last Call (relative path)
</h2>
<div className={styles.lastCall}/>
<div className={styles.lastCall} />
</div>
<div>
<h2>
Check (URL encoded)
</h2>
<div className={styles.check}/>
<div className={styles.check} />
</div>
<div>
<h2>
Rails on Maui Logo (absolute path)
</h2>
<div className={styles.railsOnMaui}/>
<div className={styles.railsOnMaui} />
</div>
</div>
);
6 changes: 3 additions & 3 deletions spec/dummy/client/app/components/HelloWorld.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class HelloWorld extends React.Component {
}

render() {
console.log(`\HelloWorld demonstrating a call to console.log in \
spec/dummy/client/app/components/HelloWorld.jsx:18`);
console.log('HelloWorld demonstrating a call to console.log in ' +
'spec/dummy/client/app/components/HelloWorld.jsx:18');

const { name } = this.state;
const { railsContext } = this.props;
Expand All @@ -54,7 +54,7 @@ spec/dummy/client/app/components/HelloWorld.jsx:18`);
onChange={this.handleChange}
/>
</p>
{ railsContext && <RailsContext {...{railsContext}} /> }
{ railsContext && <RailsContext {...{ railsContext }} /> }
</div>
);
}
Expand Down
12 changes: 5 additions & 7 deletions spec/dummy/client/app/components/HelloWorldContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ import HelloWorldRedux from './HelloWorldRedux';

import * as helloWorldActions from '../actions/HelloWorldActions';

const HelloWorldContainer = ({ actions, data, railsContext }) => {
return (
<HelloWorldRedux {...{actions, data, railsContext}} />
);
}
const HelloWorldContainer = ({ actions, data, railsContext }) => (
<HelloWorldRedux {...{ actions, data, railsContext }} />
);
HelloWorldContainer.propTypes = {
actions: PropTypes.object.isRequired,
data: PropTypes.object.isRequired,
railsContext: PropTypes.object.isRequired
railsContext: PropTypes.object.isRequired,
};

function mapStateToProps(state) {
return {
return {
data: state.helloWorldData,
railsContext: state.railsContext,
};
Expand Down
8 changes: 4 additions & 4 deletions spec/dummy/client/app/components/HelloWorldRedux.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {PropTypes} from 'react';
import React, { PropTypes } from 'react';
import RailsContext from './RailsContext';

// Super simple example of the simplest possible React component
Expand Down Expand Up @@ -27,8 +27,8 @@ export default class HelloWorldRedux extends React.Component {
}

render() {
const {data, railsContext} = this.props;
const {name} = data;
const { data, railsContext } = this.props;
const { name } = data;

// If this creates an alert, we have a problem!
// see file node_package/src/scriptSanitizedVal.js for the fix to this prior issue.
Expand All @@ -52,7 +52,7 @@ export default class HelloWorldRedux extends React.Component {
onChange={this.handleChange}
/>
</p>
<RailsContext {...{railsContext}} />
<RailsContext {...{ railsContext }} />
</div>
);
}
Expand Down
19 changes: 7 additions & 12 deletions spec/dummy/client/app/components/HelloWorldWithLogAndThrow.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
/* eslint-disable no-unused-vars */
import React from 'react';

// Example of logging and throw error handling

class HelloWorldWithLogAndThrow extends React.Component {
constructor(props, context) {
super(props, context);
}

render() {
console.log('console.log in HelloWorld');
console.warn('console.warn in HelloWorld');
console.error('console.error in HelloWorld');
throw new Error('throw in HelloWorldContainer');
}
}
const HelloWorldWithLogAndThrow = (props, context) => {
console.log('console.log in HelloWorld');
console.warn('console.warn in HelloWorld');
console.error('console.error in HelloWorld');
throw new Error('throw in HelloWorldContainer');
};

export default HelloWorldWithLogAndThrow;
20 changes: 10 additions & 10 deletions spec/dummy/client/app/components/RailsContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { PropTypes } from 'react';
import _ from 'lodash';

function renderContextRows(railsContext) {
console.log('railsContext.serverSide is ', railsContext.serverSide)
console.log('railsContext.serverSide is ', railsContext.serverSide);
return _.transform(railsContext, (accum, value, key) => {
if (key !== 'serverSide') {
const className = `js-${key}`;
Expand All @@ -11,7 +11,7 @@ function renderContextRows(railsContext) {
<td><strong>
{key}:&nbsp;
</strong></td>
<td className={className}>{value + ''}</td>
<td className={className}>{`${value}`}</td>
</tr>
);
}
Expand All @@ -21,23 +21,23 @@ function renderContextRows(railsContext) {
const RailsContext = (props) => (
<table>
<thead>
<tr>
<th><i>
<tr>
<th><i>
key
</i></th>
<th><i>
</i></th>
<th><i>
value
</i></th>
</tr>
</i></th>
</tr>
</thead>
<tbody>
{renderContextRows(props.railsContext)}
{renderContextRows(props.railsContext)}
</tbody>
</table>
);

RailsContext.propTypes = {
railsContext: PropTypes.object.isRequired
railsContext: PropTypes.object.isRequired,
};

export default RailsContext;
1 change: 1 addition & 0 deletions spec/dummy/client/app/constants/HelloWorldConstants.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* eslint-disable import/prefer-default-export */
export const HELLO_WORLD_NAME_UPDATE = 'HELLO_WORLD_NAME_UPDATE';
1 change: 1 addition & 0 deletions spec/dummy/client/app/reducers/RailsContextReducer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const initialState = {
// Why name function the same as the reducer?
// https://github.com/gaearon/redux/issues/428#issuecomment-129223274
// Naming the function will help with debugging!
/* eslint-disable no-unused-vars */
export default function railsContextReducer(state = initialState, action) {
return state;
}
2 changes: 1 addition & 1 deletion spec/dummy/client/app/reducers/reducersIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import railsContextReducer from './RailsContextReducer';

// This is how you do a directory of reducers.
// The `import * as reducers` does not work for a directory, but only with a single file
export default {
export default {
helloWorldData: helloWorldReducer,
railsContext: railsContextReducer,
};
8 changes: 4 additions & 4 deletions spec/dummy/client/app/startup/ClientReduxApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import HelloWorldContainer from '../components/HelloWorldContainer';
export default (props, railsContext) => {
const combinedReducer = combineReducers(reducers);
const combinedProps = composeInitialState(props, railsContext);

// This is where we'll put in the middleware for the async function. Placeholder.
// store will have helloWorldData as a top level property
const store = applyMiddleware(middleware)(createStore)(combinedReducer, combinedProps);

// Provider uses the this.props.children, so we're not typical React syntax.
// This allows redux to add additional props to the HelloWorldContainer.
return (
<Provider store={store}>
<HelloWorldContainer />
</Provider>
<Provider store={store}>
<HelloWorldContainer />
</Provider>
);
};
10 changes: 5 additions & 5 deletions spec/dummy/client/app/startup/ClientReduxSharedStoreApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
// Compare this to the ./ServerApp.jsx file which is used for server side rendering.

import React from 'react';
import { Provider } from 'react-redux';
import ReactOnRails from 'react-on-rails';

import HelloWorldContainer from '../components/HelloWorldContainer';
import { Provider } from 'react-redux';

/*
* Export a function that returns a ReactComponent, depending on a store named SharedReduxStore.
* This is used for the client rendering hook after the page html is rendered.
* React will see that the state is the same and not do anything.
*/
export default () => {

// This is where we get the existing store.
const store = ReactOnRails.getStore('SharedReduxStore');

return (
<Provider store={store}>
<HelloWorldContainer />
</Provider>
<Provider store={store}>
<HelloWorldContainer />
</Provider>
);
};
9 changes: 5 additions & 4 deletions spec/dummy/client/app/startup/ServerReduxSharedStoreApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

import React from 'react';
import ReactOnRails from 'react-on-rails';
import HelloWorldContainer from '../components/HelloWorldContainer';
import { Provider } from 'react-redux';

import HelloWorldContainer from '../components/HelloWorldContainer';

/*
* Export a function that returns a ReactComponent, depending on a store named SharedReduxStore.
* This is used for the server rendering.
Expand All @@ -16,8 +17,8 @@ export default () => {
const store = ReactOnRails.getStore('SharedReduxStore');

return (
<Provider store={store}>
<HelloWorldContainer />
</Provider>
<Provider store={store}>
<HelloWorldContainer />
</Provider>
);
};
Loading

0 comments on commit 600ed0d

Please sign in to comment.