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:
function DoSomething(){...} // Noncompliant
should be renamed to
function doSomething(){...}
Exceptions
This rule ignores React Functional Components, JavaScript functions named with a capital letter and returning a React element (JSX syntax).
function Welcome() { // Compliant by exception
const greeting = 'Hello, World!';
// ...
return (
<div className="Welcome">
<p>{greeting}</p>
</div>
);
}