# function-name

Rule `sonarjs/function-name`. Function and method names should comply with a naming convention

- Source: sonarjs
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2137 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/function-name` | no | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-100/) |

## Code examples

### Incorrect: the rule reports this

```js
function DoSomething(){...}  // Noncompliant
```

### Correct: the rule accepts this

```js
function doSomething(){...}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/function-name": "error",
    },
  },
];
```

## Related rules

- [sonarjs/for-in](https://lintradar.dev/rules/sonarjs/for-in.md): "for...in" loops should filter properties before acting on them
- [sonarjs/max-lines](https://lintradar.dev/rules/sonarjs/max-lines.md): Files should not have too many lines of code
- [sonarjs/file-name-differ-from-class](https://lintradar.dev/rules/sonarjs/file-name-differ-from-class.md): Default export names and file names should match
- [sonarjs/max-lines-per-function](https://lintradar.dev/rules/sonarjs/max-lines-per-function.md): Functions should not have too many lines of code
- [sonarjs/file-header](https://lintradar.dev/rules/sonarjs/file-header.md): Track lack of copyright and license headers
- [sonarjs/max-union-size](https://lintradar.dev/rules/sonarjs/max-union-size.md): Union types should not have too many elements

---

Web page: https://lintradar.dev/rules/sonarjs/function-name. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
