Skip to content

Commit 94549f7

Browse files
committed
Update packages + Tweak eslint + Fix lint errors + Fix tests
- Hold back on updating babel-loader due to many changes and some as of yet unclear new configuration - Changed test: Enzyme no longer finds by component className if displayName is set
1 parent 91a22ea commit 94549f7

File tree

8 files changed

+2635
-3776
lines changed

8 files changed

+2635
-3776
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,16 @@ module.exports = {
3838
'class-methods-use-this': 0,
3939
'default-case': 0,
4040
'no-mixed-operators': 0,
41+
'operator-linebreak': 0,
42+
'react/destructuring-assignment': 0,
43+
'implicit-arrow-linebreak': 0,
44+
'react/jsx-one-expression-per-line': 0,
45+
'react/jsx-props-no-multi-spaces': 0,
46+
'react/jsx-wrap-multilines': 0,
4147

4248
// Maybe enable later:
4349
'jsx-a11y/click-events-have-key-events': 0,
50+
'jsx-a11y/label-has-associated-control': 0,
4451
'jsx-a11y/label-has-for': 0,
4552
'jsx-a11y/no-static-element-interactions': 0,
4653
'prefer-template': 0,
@@ -49,6 +56,7 @@ module.exports = {
4956
'object-curly-newline': 0,
5057
'react/jsx-indent': 0,
5158
'react/prop-types': 0,
59+
'react/forbid-prop-types': 0,
5260

5361
// For importing react-lifecycle-visualizer from /src instead of /node_modules:
5462
'import/no-unresolved': [2, { ignore: ['^react-lifecycle-visualizer$'] }],

examples/parent-child-demo/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
"start": "echo \"Error: This dummy package.json is only for StackBlitz deployment. Use top-level package.json instead.\" && exit 1"
99
},
1010
"devDependencies": {
11-
"react-scripts": "^1.1.4"
11+
"react-scripts": "^1.1.5"
1212
},
1313
"dependencies": {
14-
"prop-types": "^15.6.1",
15-
"react": "16.4.1",
16-
"react-dom": "16.4.1",
17-
"react-hot-loader": "4.3.3",
18-
"react-lifecycle-visualizer": "^2.1.0",
19-
"react-scripts": "^1.1.4"
14+
"prop-types": "^15.6.2",
15+
"react": "16.5.1",
16+
"react-dom": "16.5.1",
17+
"react-hot-loader": "4.3.8",
18+
"react-lifecycle-visualizer": "^2.1.0"
2019
}
2120
}

package-lock.json

Lines changed: 2563 additions & 3722 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,46 +45,47 @@
4545
}
4646
},
4747
"devDependencies": {
48-
"@types/react": "^16.4.0",
49-
"@types/react-dom": "^16.0.6",
48+
"@types/react": "^16.4.14",
49+
"@types/react-dom": "^16.0.7",
50+
"ajv": "^6.5.3",
5051
"babel-cli": "^6.26.0",
51-
"babel-eslint": "^8.2.3",
52-
"babel-jest": "^23.0.1",
53-
"babel-loader": "^7.1.4",
52+
"babel-eslint": "^8.2.6",
53+
"babel-jest": "^23.6.0",
54+
"babel-loader": "^7.1.5",
5455
"babel-plugin-transform-decorators-legacy": "^1.3.5",
5556
"babel-plugin-transform-react-jsx-source": "^6.22.0",
56-
"babel-plugin-transform-rename-import": "^2.2.0",
57+
"babel-plugin-transform-rename-import": "^2.3.0",
5758
"babel-preset-env": "^1.7.0",
5859
"babel-preset-react": "^6.24.1",
5960
"babel-preset-stage-2": "^6.24.1",
60-
"css-loader": "^0.28.11",
61-
"enzyme": "^3.3.0",
62-
"enzyme-adapter-react-16": "^1.1.1",
63-
"eslint": "^4.19.1",
64-
"eslint-config-airbnb": "^16.1.0",
65-
"eslint-loader": "^2.0.0",
66-
"eslint-plugin-import": "^2.12.0",
67-
"eslint-plugin-jest": "^21.17.0",
68-
"eslint-plugin-jsx-a11y": "^6.0.3",
69-
"eslint-plugin-react": "^7.9.1",
61+
"css-loader": "^1.0.0",
62+
"enzyme": "^3.6.0",
63+
"enzyme-adapter-react-16": "^1.5.0",
64+
"eslint": "^5.6.0",
65+
"eslint-config-airbnb": "^17.1.0",
66+
"eslint-loader": "^2.1.0",
67+
"eslint-plugin-import": "^2.14.0",
68+
"eslint-plugin-jest": "^21.22.0",
69+
"eslint-plugin-jsx-a11y": "^6.1.1",
70+
"eslint-plugin-react": "^7.11.1",
7071
"husky": "^1.0.0-rc.9",
71-
"jest": "^23.1.0",
72+
"jest": "^23.6.0",
7273
"jest-css-modules": "^1.1.0",
7374
"mock-local-storage": "^1.0.5",
74-
"node-sass": "^4.9.0",
75-
"react": "^16.4.1",
76-
"react-dom": "^16.4.1",
77-
"react-hot-loader": "^4.3.3",
78-
"sass-loader": "^7.0.3",
79-
"style-loader": "^0.21.0",
80-
"typescript": "^2.9.2",
81-
"webpack": "^4.12.0",
82-
"webpack-cli": "^3.0.8",
83-
"webpack-dev-server": "^3.1.4"
75+
"node-sass": "^4.9.3",
76+
"react": "^16.5.1",
77+
"react-dom": "^16.5.1",
78+
"react-hot-loader": "^4.3.8",
79+
"sass-loader": "^7.1.0",
80+
"style-loader": "^0.23.0",
81+
"typescript": "^3.0.3",
82+
"webpack": "^4.19.0",
83+
"webpack-cli": "^3.1.0",
84+
"webpack-dev-server": "^3.1.8"
8485
},
8586
"dependencies": {
86-
"hoist-non-react-statics": "^2.5.5",
87-
"prop-types": "^15.6.1",
87+
"hoist-non-react-statics": "^3.0.1",
88+
"prop-types": "^15.6.2",
8889
"react-redux": "^5.0.7",
8990
"redux": "^4.0.0",
9091
"redux-thunk": "^2.3.0"

src/components/Log.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ class Log extends Component {
2929
}
3030
}
3131
}
32+
3233
componentDidMount() {
3334
document.addEventListener('keydown', this.onKeyDown);
3435
}
36+
3537
componentWillUnmount() {
3638
document.removeEventListener('keydown', this.onKeyDown);
3739
}

src/components/LogEntries.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ export default class LogEntries extends Component {
44
highlight = (index) => {
55
this.props.highlight(index);
66
}
7+
78
componentDidUpdate(prevProps) {
89
if (prevProps.entries.length !== this.props.entries.length) {
910
this.messagesElt.scrollTop = this.messagesElt.scrollHeight - this.messagesElt.clientHeight;
1011
}
1112
}
13+
1214
render() {
1315
const indexWidth = Math.max(2, 1 + Math.log10(this.props.entries.length));
1416
const componentNameWidth = 2 +
@@ -23,8 +25,9 @@ export default class LogEntries extends Component {
2325
className='entry'
2426
data-is-highlighted={i === this.props.highlightedIndex}
2527
onMouseEnter={() => this.highlight(i)}
26-
>{ ('' + i).padStart(indexWidth) + ' ' +
27-
(componentName + '-' + instanceId + ':').padEnd(componentNameWidth) +
28+
>
29+
{ ('' + i).padStart(indexWidth) + ' ' +
30+
(componentName + '-' + instanceId + ':').padEnd(componentNameWidth) +
2831
methodName }
2932
</div>
3033
</div>

src/redux/actionCreators.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ import * as util from '../util';
55

66
// Primitive actions:
77

8-
const addLogEntry = (componentName, instanceId, methodName) =>
9-
({type: 'ADD_LOG_ENTRY', componentName, instanceId, methodName});
8+
const addLogEntry = (componentName, instanceId, methodName) => (
9+
{type: 'ADD_LOG_ENTRY', componentName, instanceId, methodName}
10+
);
1011

11-
const clearLogEntries = () =>
12-
({type: 'CLEAR_LOG_ENTRIES'});
12+
const clearLogEntries = () => (
13+
{type: 'CLEAR_LOG_ENTRIES'}
14+
);
1315

14-
const setHighlight = (highlightedIndex) =>
15-
({type: 'SET_HIGHLIGHT', highlightedIndex});
16+
const setHighlight = (highlightedIndex) => (
17+
{type: 'SET_HIGHLIGHT', highlightedIndex}
18+
);
1619

17-
const setReplayTimerId = (replayTimerId) =>
18-
({type: 'SET_REPLAY_TIMER_ID', replayTimerId});
20+
const setReplayTimerId = (replayTimerId) => (
21+
{type: 'SET_REPLAY_TIMER_ID', replayTimerId}
22+
);
1923

20-
const setReplayTimerDelayPrim = (replayTimerDelay) =>
21-
({type: 'SET_REPLAY_TIMER_DELAY', replayTimerDelay});
24+
const setReplayTimerDelayPrim = (replayTimerDelay) => (
25+
{type: 'SET_REPLAY_TIMER_DELAY', replayTimerDelay}
26+
);
2227

2328
// Thunk actions:
2429

test/unsafe.test.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint camelcase: 0, react/no-multi-comp: 0 */
1+
/* eslint camelcase: 0, react/no-multi-comp: 0, lines-between-class-members: 0 */
22
import React, { Component } from 'react';
33
import { mount } from 'enzyme';
44
import { traceLifecycle, VisualizerProvider } from '../src';
@@ -14,7 +14,7 @@ describe('unsafe', () => {
1414
}
1515
});
1616

17-
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('TracedComponent').instance();
17+
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('Unsafe').instance();
1818
expect(tracedInstance).toHaveProperty('componentWillMount');
1919
expect(tracedInstance).toHaveProperty('componentWillReceiveProps');
2020
expect(tracedInstance).toHaveProperty('componentWillUpdate');
@@ -33,7 +33,7 @@ describe('unsafe', () => {
3333
}
3434
});
3535

36-
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('TracedComponent').instance();
36+
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('Unsafe').instance();
3737
expect(tracedInstance).not.toHaveProperty('componentWillMount');
3838
expect(tracedInstance).not.toHaveProperty('componentWillReceiveProps');
3939
expect(tracedInstance).not.toHaveProperty('componentWillUpdate');
@@ -51,7 +51,7 @@ describe('unsafe', () => {
5151
return '';
5252
}
5353
});
54-
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('TracedComponent').instance();
54+
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('Unsafe').instance();
5555
expect(tracedInstance).not.toHaveProperty('componentWillReceiveProps');
5656
expect(tracedInstance).not.toHaveProperty('componentWillUpdate');
5757
expect(tracedInstance).toHaveProperty('UNSAFE_componentWillReceiveProps');
@@ -65,7 +65,7 @@ describe('unsafe', () => {
6565
return '';
6666
}
6767
});
68-
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('TracedComponent').instance();
68+
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('Unsafe').instance();
6969
expect(tracedInstance).not.toHaveProperty('componentWillMount');
7070
expect(tracedInstance).toHaveProperty('UNSAFE_componentWillMount');
7171
});
@@ -84,7 +84,7 @@ describe('unsafe', () => {
8484
}
8585
});
8686

87-
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('TracedComponent').instance();
87+
const tracedInstance = mount(<VisualizerProvider><Comp/></VisualizerProvider>).find('Unsafe').instance();
8888
expect(tracedInstance).toHaveProperty('componentWillMount');
8989
expect(tracedInstance).toHaveProperty('componentWillReceiveProps');
9090
expect(tracedInstance).toHaveProperty('componentWillUpdate');

0 commit comments

Comments
 (0)