Correctness |
Correctness rules check the code for syntax errors.
Index
Rule | Description | Type | Severity |
---|---|---|---|
RCT010101: Don't use 'return false' in a React event handler | To stop event propagation in React you should call the 'preventDefault' method on the 'event' object rather than returning 'false' | React component | Error |
RCT010102: Style property of a React DOM element should be an object | To define inline styles in React, you need to specify them as an object rather than a string | React component | Error |
RCT010103: Don't specify children when using dangerouslySetInnerHTML | When using 'dangerouslySetInnerHTML' don't specify children elements | React component | Error |
RCT010104: Don't pass HTML as a string to the 'dangerouslySetInnerHTML' property | To specify HTML to render using the 'dangerouslySetInnerHTML' use the '__html' property | React component | Error |
RCT010105: Don't use Generator as a child of a React element | When working with generator functions, don't use the returned Generator object directly as a child of a React element | React component | Error |
RCT010106: Don't check the 'array.length' property when conditionally rendering elements | To avoid rendering empty arrays, you should explicitly check the array for items using 'array.length > 0' | React component | Error |
RCT010107: React lifecycle method doesn't return a valid value | React lifecycle methods must return correct values | React component | Error |
RCT010108: Don't override React component methods supported only in createReactClass() in ES6 class component | When building ES6 class components, don't override React component methods that are supported only in the 'createReactClass' API | React component | Error |
RCT010109: Don't specify React event handlers as a string | When specifying event handlers in React, always specify them using a function and not a string | React component | Error |
RCT010110: Don't use invalid CSS style names and values | When working with CSS styles in React, you need to ensure that the names and values of properties are valid in React | React component | Error |
RCT010111: Don't use the return value of the 'ReactDOM.render()' method | When working with the 'ReactDOM.render()' method don't use its return value | TypeScript file | Warning |
RCT010112: Don't use incorrectly spelled React APIs | When calling React APIs, pay extra attention that they are properly spelled | React component | Error |
RCT010113: Don't use incorrect casing for DOM attributes and properties in React | DOM attributes and properties in React must be used camel-cased | React component | Error |
RCT010114: Don't access special React properties | Don't access the values of the 'ref' and 'key' special React properties directly | React component | Error |
RCT010115: The initial state in an ES6 class component is not an object | The initial state in an ES6 class component must be set to an object | React component | Error |
RCT010116: Don't call 'setState' in the specific lifecycle methods | Don't call 'setState' in the specific lifecycle methods | React component | Error |
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.