React Life-Cycle Methods Flags as Unused

The inspection in WebStorm doesn't seem to recognize that the various React life-cycle methods (such as "getInitialState", "componentWillMount", etc.) are used. I can suppress the inspection by using the "//noinspection JSUnusedGlobalSymbols" comment, or completely disabling it in the settings. But I'm curious as to why WS doesn't do the same for "render" and if this is an indication of a configuration issue that I can address.

2 comments
Comment actions Permalink

Please vote for https://youtrack.jetbrains.com/issue/WEB-14576. The problem is that unused properties handling is based on static code analysis, so methods/properties that are not called explicitly and are only used by framework internals will be marked as unused. We have to add filters for all React stuff to avoid violations. For now I can only suggest suppressing inspection for these methods: Alt+Enter on method, hit Right, choose 'Suppress for statement'

1

Please sign in to leave a comment.