File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
7
7
8
8
## Fixed
9
9
* [ ` prop-types ` ] : fix Cannot read property 'type' of undefined error when destructured param ([ #2807 ] [ ] @minwe )
10
+ * [ ` no-typos ` ] : avoid crash on spread syntax in createReactClass object ([ #2816 ] [ ] @ljharb @Songyu-Wang )
10
11
12
+ [ #2816 ] : https://github.com/yannickcr/eslint-plugin-react/issues/2816
11
13
[ #2807 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2807
12
14
13
15
## [ 7.21.2] - 2020.09.24
Original file line number Diff line number Diff line change @@ -240,8 +240,10 @@ module.exports = {
240
240
}
241
241
242
242
node . properties . forEach ( ( property ) => {
243
- reportErrorIfPropertyCasingTypo ( property . value , property . key , false ) ;
244
- reportErrorIfLifecycleMethodCasingTypo ( property ) ;
243
+ if ( property . type !== 'SpreadElement' ) {
244
+ reportErrorIfPropertyCasingTypo ( property . value , property . key , false ) ;
245
+ reportErrorIfLifecycleMethodCasingTypo ( property ) ;
246
+ }
245
247
} ) ;
246
248
}
247
249
} ;
Original file line number Diff line number Diff line change @@ -33,6 +33,22 @@ const ERROR_MESSAGE_STATIC = (method) => `Lifecycle method should be static: ${m
33
33
const ruleTester = new RuleTester ( ) ;
34
34
ruleTester . run ( 'no-typos' , rule , {
35
35
valid : [ {
36
+ code : `
37
+ import createReactClass from 'create-react-class'
38
+ function hello (extra = {}) {
39
+ return createReactClass({
40
+ noteType: 'hello',
41
+ renderItem () {
42
+ return null
43
+ },
44
+ ...extra
45
+ })
46
+ }
47
+ ` ,
48
+ parser : parsers . TYPESCRIPT_ESLINT ,
49
+ parserOptions
50
+ } ,
51
+ {
36
52
code : `
37
53
class First {
38
54
static PropTypes = {key: "myValue"};
You can’t perform that action at this time.
0 commit comments