https://github.com/fallaciousreasoning/eslint-plugin-licenses
An eslint plugin for detecting and generating missing license headers
https://github.com/fallaciousreasoning/eslint-plugin-licenses
eslint eslint-plugin eslint-rules javascript license license-header license-management typescript
Last synced: about 2 months ago
JSON representation
An eslint plugin for detecting and generating missing license headers
- Host: GitHub
- URL: https://github.com/fallaciousreasoning/eslint-plugin-licenses
- Owner: fallaciousreasoning
- License: mit
- Created: 2022-11-03T02:14:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-03T21:50:28.000Z (4 months ago)
- Last Synced: 2026-03-04T01:41:23.881Z (4 months ago)
- Topics: eslint, eslint-plugin, eslint-rules, javascript, license, license-header, license-management, typescript
- Language: JavaScript
- Homepage:
- Size: 156 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-licenses
Ensures all source files have a license header
## Installation
You'll first need to install [ESLint](https://eslint.org/):
```sh
npm i eslint --save-dev
```
Next, install `eslint-plugin-licenses`:
```sh
npm install eslint-plugin-licenses --save-dev
```
## Usage
Add `licenses` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"licenses"
]
}
```
Then configure the header you want to use
```json
{
"rules": {
"licenses/header": [
2,
{
"comment": "line",
"header": [
"Copyright (c) {YEAR} fallaciousreasoning. All rights reserved."
]
}
]
}
}
```
The {YEAR} placeholder will be generated as the current year when running `eslint --fix` and will match any year (including ones in the future).
If you have existing headers with different formats, you can add them as `altHeaders`
```json
{
"rules": {
"licenses/header": [
2,
{
"comment": "line",
"header": [
"Copyright (c) {YEAR} fallaciousreasoning. All rights reserved."
],
"altHeaders": [
{
"comment": "block",
"header": [
"",
"Copyright (c) Me, always & forever",
""
]
}
]
}
]
}
}
```
This will match the headers
```js
// Copyright (c) 2022 fallaciousreasoning. All rights reserved
```
and
```js
/*
* Copyright (c) Me, always & forever
*/
```
but when generating fixes will use the first format.