# file-header

Rule `sonarjs/file-header`. Track lack of copyright and license headers

- 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: #2133 by reach

## Linters

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

## Code examples

### Correct: the rule accepts this

```js
/*
 * SonarQube, open source software quality management tool.
 * Copyright (C) 2008-2013 SonarSource
 * mailto:contact AT sonarsource DOT com
 *
 * SonarQube is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * SonarQube is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
```

Examples from the ESLint documentation.

## Enable it

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

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

## Related rules

- [sonarjs/expression-complexity](https://lintradar.dev/rules/sonarjs/expression-complexity.md): Expressions should not be too complex
- [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/elseif-without-else](https://lintradar.dev/rules/sonarjs/elseif-without-else.md): "if ... else if" constructs should end with "else" clauses
- [sonarjs/for-in](https://lintradar.dev/rules/sonarjs/for-in.md): "for...in" loops should filter properties before acting on them
- [sonarjs/destructuring-assignment-syntax](https://lintradar.dev/rules/sonarjs/destructuring-assignment-syntax.md): Destructuring syntax should be used for assignments
- [sonarjs/declarations-in-global-scope](https://lintradar.dev/rules/sonarjs/declarations-in-global-scope.md): Variables and functions should not be declared in the global scope

---

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