diff --git a/rules/S6774/javascript/rule.adoc b/rules/S6774/javascript/rule.adoc index f0bdfcec1e4..712d4cd97bd 100644 --- a/rules/S6774/javascript/rule.adoc +++ b/rules/S6774/javascript/rule.adoc @@ -4,6 +4,12 @@ In JavaScript, props are typically passed as plain objects, which can lead to er By defining types for component props, developers can enforce type safety and provide clear documentation for the expected props of a component. This helps catch potential errors at compile-time. It also improves code maintainability by making it easier to understand how components should be used and what props they accept. +== How to fix it + +=== Code examples + +==== Noncompliant code example + [source,javascript,diff-id=1,diff-type=noncompliant] ---- import PropTypes from 'prop-types'; @@ -27,6 +33,8 @@ Hello.propTypes = { }; ---- +==== Compliant solution + [source,javascript,diff-id=1,diff-type=compliant] ---- import PropTypes from 'prop-types';