35 lines
908 B
Plaintext
35 lines
908 B
Plaintext
![]() |
Shared coding conventions allow teams to collaborate efficiently. This rule checks that all members of a ``++propTypes++`` structure match a provided regular expression.
|
||
|
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
Using the default regular expressions: ``++^(is|has)[A-Z]([A-Za-z0-9]?)+++``, ``++^[a-z]([A-Za-z0-9]?)+++``
|
||
|
|
||
|
|
||
|
----
|
||
|
static propTypes = {
|
||
|
enabled: React.PropTypes.bool.isRequired, // Noncompliant
|
||
|
max_loops: React.PropTypes.number.isRequired, // Noncompliant
|
||
|
FrameSrc: React.PropTypes.string.isRequired, // Noncompliant
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
static propTypes = {
|
||
|
isEnabled: React.PropTypes.bool.isRequired,
|
||
|
maxLoops: React.PropTypes.number.isRequired,
|
||
|
frameSrc: React.PropTypes.string.isRequired,
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
ifdef::env-github,rspecator-view[]
|
||
|
== Comments And Links
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::comments-and-links.adoc[]
|
||
|
endif::env-github,rspecator-view[]
|