38 lines
952 B
Plaintext
38 lines
952 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]?)+++``
|
|
|
|
|
|
[source,javascript]
|
|
----
|
|
static propTypes = {
|
|
enabled: React.PropTypes.bool.isRequired, // Noncompliant
|
|
max_loops: React.PropTypes.number.isRequired, // Noncompliant
|
|
FrameSrc: React.PropTypes.string.isRequired, // Noncompliant
|
|
}
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,javascript]
|
|
----
|
|
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[]
|