73 lines
1.3 KiB
Plaintext

== Why is this an issue?
Shared naming conventions allow teams to collaborate efficiently.
This rule raises an issue when a function or a method name does not match a provided regular expression.
For example, with the default regular expression ``++^[a-z][a-zA-Z0-9]*$++``, the function:
[source,javascript]
----
function DoSomething(){...} // Noncompliant
----
should be renamed to
[source,javascript]
----
function doSomething(){...}
----
=== Exceptions
This rule ignores React Functional Components, JavaScript functions named with a capital letter and returning a React element (JSX syntax).
[source,javascript]
----
function Welcome() { // Compliant by exception
const greeting = 'Hello, World!';
// ...
return (
<div className="Welcome">
<p>{greeting}</p>
</div>
);
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
=== Parameters
.format
****
_STRING_
----
^[_a-z][a-zA-Z0-9]*$
----
Regular expression used to check the [method|function|subroutine] names against
****
'''
== Comments And Links
(visible only on this page)
=== on 21 May 2015, 14:42:13 Linda Martin wrote:
Reviewed.
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]