
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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)
|
|
|
|
=== on 23 Feb 2018, 11:54:24 Alexandre Gigleux wrote:
|
|
Partially covered by ESLint for React: \https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/boolean-prop-naming.md (react/boolean-prop-naming)
|
|
|
|
endif::env-github,rspecator-view[]
|