Update lint config, dependencies, fix issues
This also fixes messages from new synthetic events warnings
Paul O’Shannessy committed
Mar 2, 2016 at 15:07 UTC
093bb220301ab8a1fc5b6248ca433d413d043021
5 files changed
+39
-31
.eslintrc.js
+2
-2
@@ -30,7 +30,6 @@ module.exports = {
30
'indent': [ERROR, 2, {SwitchCase: 1}],
31
'jsx-quotes': [ERROR, 'prefer-double'],
32
'no-bitwise': OFF,
33
- 'no-dupe-class-members': ERROR,
33
'no-multi-spaces': ERROR,
34
'no-restricted-syntax': [ERROR, 'WithStatement'],
35
'no-shadow': ERROR,
@@ -39,6 +38,7 @@ module.exports = {
38
'quotes': [ERROR, 'single', 'avoid-escape'],
39
'space-after-keywords': ERROR,
40
'space-before-blocks': ERROR,
41
+ 'space-before-function-paren': [ERROR, {anonymous: 'never', named: 'never'}],
42
'space-before-keywords': ERROR,
43
'strict': [ERROR, 'global'],
44
@@ -57,7 +57,7 @@ module.exports = {
57
'react/no-did-update-set-state': OFF,
58
// We define multiple components in test files
59
'react/no-multi-comp': OFF,
60
- 'react/no-unknown-property': ERROR,
60
+ 'react/no-unknown-property': OFF,
61
// This isn't useful in our test code
62
'react/prop-types': OFF,
63
'react/react-in-jsx-scope': ERROR,
package.json
+2
-2
@@ -32,8 +32,8 @@
32
"del": "^2.0.2",
33
"derequire": "^2.0.3",
34
"envify": "^3.0.0",
35
- "eslint": "1.9.0",
36
- "eslint-plugin-react": "3.8.0",
35
+ "eslint": "1.10.3",
36
+ "eslint-plugin-react": "4.1.0",
37
"eslint-plugin-react-internal": "file:eslint-rules",
38
"fbjs": "^0.6.1",
39
"fbjs-scripts": "0.6.0-alpha.2",
src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js
+31
-23
@@ -86,11 +86,14 @@ describe('SyntheticEvent', function() {
86
expect(syntheticEvent.type).toBe(null);
87
expect(syntheticEvent.nativeEvent).toBe(null);
88
expect(syntheticEvent.target).toBe(null);
89
- expect(console.error.calls.length).toBe(3); // once for each property accessed
90
- expect(console.error.argsForCall[0][0]).toBe( // assert the first warning for accessing `type`
91
- 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' +
92
- 'you\'re accessing the property `type` on a released/nullified synthetic event. This is set to null. ' +
93
- 'If you must keep the original synthetic event around, use event.persist(). ' +
89
+ // once for each property accessed
90
+ expect(console.error.calls.length).toBe(3);
91
+ // assert the first warning for accessing `type`
92
+ expect(console.error.argsForCall[0][0]).toBe(
93
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
94
+ 'you\'re seeing this, you\'re accessing the property `type` on a ' +
95
+ 'released/nullified synthetic event. This is set to null. If you must ' +
96
+ 'keep the original synthetic event around, use event.persist(). ' +
97
'See https://fb.me/react-event-pooling for more information.'
98
);
99
});
@@ -103,10 +106,11 @@ describe('SyntheticEvent', function() {
106
expect(syntheticEvent.type = 'MouseEvent').toBe('MouseEvent');
107
expect(console.error.calls.length).toBe(1);
108
expect(console.error.argsForCall[0][0]).toBe(
106
- 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' +
107
- 'you\'re setting the property `type` on a released/nullified synthetic event. This is ' +
108
- 'effectively a no-op. If you must keep the original synthetic event around, use ' +
109
- 'event.persist(). See https://fb.me/react-event-pooling for more information.'
109
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
110
+ 'you\'re seeing this, you\'re setting the property `type` on a ' +
111
+ 'released/nullified synthetic event. This is effectively a no-op. If you must ' +
112
+ 'keep the original synthetic event around, use event.persist(). ' +
113
+ 'See https://fb.me/react-event-pooling for more information.'
114
);
115
});
116
@@ -117,10 +121,11 @@ describe('SyntheticEvent', function() {
121
syntheticEvent.preventDefault();
122
expect(console.error.calls.length).toBe(1);
123
expect(console.error.argsForCall[0][0]).toBe(
120
- 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' +
121
- 'you\'re accessing the method `preventDefault` on a released/nullified synthetic event. ' +
122
- 'This is a no-op function. If you must keep the original synthetic event around, ' +
123
- 'use event.persist(). See https://fb.me/react-event-pooling for more information.'
124
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
125
+ 'you\'re seeing this, you\'re accessing the method `preventDefault` on a ' +
126
+ 'released/nullified synthetic event. This is a no-op function. If you must ' +
127
+ 'keep the original synthetic event around, use event.persist(). ' +
128
+ 'See https://fb.me/react-event-pooling for more information.'
129
);
130
});
131
@@ -131,10 +136,11 @@ describe('SyntheticEvent', function() {
136
syntheticEvent.stopPropagation();
137
expect(console.error.calls.length).toBe(1);
138
expect(console.error.argsForCall[0][0]).toBe(
134
- 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' +
135
- 'you\'re accessing the method `stopPropagation` on a released/nullified synthetic event. ' +
136
- 'This is a no-op function. If you must keep the original synthetic event around, ' +
137
- 'use event.persist(). See https://fb.me/react-event-pooling for more information.'
139
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
140
+ 'you\'re seeing this, you\'re accessing the method `stopPropagation` on a ' +
141
+ 'released/nullified synthetic event. This is a no-op function. If you must ' +
142
+ 'keep the original synthetic event around, use event.persist(). ' +
143
+ 'See https://fb.me/react-event-pooling for more information.'
144
);
145
});
146
@@ -154,9 +160,10 @@ describe('SyntheticEvent', function() {
160
161
expect(console.error.calls.length).toBe(1);
162
expect(console.error.argsForCall[0][0]).toBe(
157
- 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' +
158
- 'you\'re accessing the property `nativeEvent` on a released/nullified synthetic event. ' +
159
- 'This is set to null. If you must keep the original synthetic event around, use event.persist(). ' +
163
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
164
+ 'you\'re seeing this, you\'re accessing the property `nativeEvent` on a ' +
165
+ 'released/nullified synthetic event. This is set to null. If you must ' +
166
+ 'keep the original synthetic event around, use event.persist(). ' +
167
'See https://fb.me/react-event-pooling for more information.'
168
);
169
});
@@ -170,9 +177,10 @@ describe('SyntheticEvent', function() {
177
if (typeof Proxy === 'function') {
178
expect(console.error.calls.length).toBe(1);
179
expect(console.error.argsForCall[0][0]).toBe(
173
- 'Warning: This synthetic event is reused for performance reasons. If you\'re ' +
174
- 'seeing this, you\'re adding a new property in the synthetic event object. ' +
175
- 'The property is never released. See https://fb.me/react-event-pooling for more information.'
180
+ 'Warning: This synthetic event is reused for performance reasons. If ' +
181
+ 'you\'re seeing this, you\'re adding a new property in the synthetic ' +
182
+ 'event object. The property is never released. ' +
183
+ 'See https://fb.me/react-event-pooling for more information.'
184
);
185
} else {
186
expect(console.error.calls.length).toBe(0);
src/renderers/dom/shared/DOMPropertyOperations.js
+3
-2
@@ -18,8 +18,9 @@ var ReactPerf = require('ReactPerf');
18
var quoteAttributeValueForBrowser = require('quoteAttributeValueForBrowser');
19
var warning = require('warning');
20
21
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR +
22
- '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
21
+var VALID_ATTRIBUTE_NAME_REGEX = new RegExp(
22
+ '^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'
23
+);
24
var illegalAttributeNameCache = {};
25
var validatedAttributeNameCache = {};
26
src/test/__tests__/ReactTestUtils-test.js
+1
-2
@@ -206,8 +206,7 @@ describe('ReactTestUtils', function() {
206
ref={() => {}}
207
onClick={this.handleUserClick}
208
className={this.state.clicked ? 'clicked' : ''}
209
- >
210
- </div>
209
+ />
210
);
211
},
212
});