-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react/require-render-return shouldn't warn if render is defined using (stage 1) class property syntax #564
Comments
Instance properties are not yet standard - and doing this (instead of |
@ljharb why would it be much slower? Doesn't React already bind all standard component methods to the instance in the constructor anyway? |
@billyjanitsch only in |
@yannickcr this change is breaking something in eslint-config-airbnb Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at getPropertyName ($PROJECT/node_modules/eslint-plugin-react/lib/rules/require-render-return.js:54:20)
at Object.ArrowFunctionExpression ($PROJECT/node_modules/eslint-plugin-react/lib/rules/require-render-return.js:93:40)
at EventEmitter.updatedRuleInstructions.(anonymous function) ($PROJECT/node_modules/eslint-plugin-react/lib/util/Components.js:457:75)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)
at NodeEventGenerator.enterNode ($PROJECT/node_modules/eslint/lib/util/node-event-generator.js:40:22)
at CodePathAnalyzer.enterNode ($PROJECT/node_modules/eslint/lib/code-path-analysis/code-path-analynpm ERR! Test failed. See above for more details. |
@ljharb Ho. Do you know what code makes it crash ? |
@yannickcr It looks similar to this issue in eslint-plugin-import: import-js/eslint-plugin-import#317 |
I'm afraid I don't - it doesn't tell me which. |
fwiw I'm not using any proposed ES syntax. |
Ok, the following pattern trigger the crash: var Hello = () => (
<div></div>
); I'll do a quick fix. |
react/require-render-return
will error if a class is defined with this syntax:We use this syntax to make our class function declarations consistent between render and event handler functions.
http://babeljs.io/docs/plugins/transform-class-properties/
The text was updated successfully, but these errors were encountered: