JavaScript

JavaScript

By DeepSource

Found unreachable code JS-0025
Performance

Some code paths are unreachable because the return, throw, break, and continue statements unconditionally exit a block of code. The code statements after the above keywords (which exit the code block) will not execute.

Forbid certain props on Components JS-0394
Performance

Using reserved prop-names like className and style on custom components hurts readability, and makes the code harder to maintain. These props should only be used for DOM nodes like div, a, span, etc.

Avoid using setState in componentDidMount JS-0442
Performance

componentDidMount() is invoked immediately after a component is mounted. This method is a good place to load data from an endpoint as it is invoked before the browser updates the screen. Using setState() in componentDidMount() will trigger an extra rendering, so it causes performance issues as render() will be called twice.

Bad usage of RegExp#exec and String#match JS-D007
Performance

RegExp#exec and String#match should only be used when we need to use the parts of a string that match a specific pattern: