org.sonar.l10n.javascript.rules.javascript.S100.html Maven / Gradle / Ivy
Shared naming conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.
Noncompliant Code Example
With the default regular expression ^[a-z][a-zA-Z0-9]*$
:
function DoSomething(){...} // Noncompliant
Compliant Solution
function doSomething(){...}
Exceptions
This rule ignores React Functional Components, which are JavaScript functions named with a capital letter and returning a React element (JSX
syntax).
function Welcome() {
const greeting = 'Hello, World!';
// ...
return (
<div className="Welcome">
<p>{greeting}</p>
</div>
);
}