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
77
88## Fixed
99* [ ` 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 )
1011
12+ [ #2816 ] : https://github.com/yannickcr/eslint-plugin-react/issues/2816
1113[ #2807 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2807
1214
1315## [ 7.21.2] - 2020.09.24
Original file line number Diff line number Diff line change @@ -240,8 +240,10 @@ module.exports = {
240240 }
241241
242242 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+ }
245247 } ) ;
246248 }
247249 } ;
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
3333const ruleTester = new RuleTester ( ) ;
3434ruleTester . run ( 'no-typos' , rule , {
3535 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+ {
3652 code : `
3753 class First {
3854 static PropTypes = {key: "myValue"};
You can’t perform that action at this time.
0 commit comments