Validates the presence of a license header
npm install eslint-plugin-license-header

Rules to validate the presence of license headers in source files.
``sh`
npm install eslint-plugin-license-header --save-dev
Add license-header to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
`json`
{
"plugins": [
"license-header"
]
}
When enabling the rule specify the license header template as a path:
`json`
{
"rules": {
"license-header/header": [ "error", "./resources/license-header.js" ]
}
}
Alternatively, specify the license header as raw text:
`js`
{
"rules": {
"license-header/header": [
"error",
[
"/*",
" * Copyright My Company",
" * Copyright " + new Date().getFullYear(),
" */",
]
]
}
}
In eslint@9 you can consume the library using a flat configuration, too:
`js
import licenseHeader from "eslint-plugin-license-header";
export default [
{
files: '*/.js',
plugins: {
'license-header': licenseHeader
},
rules: {
"license-header/header": ...
}
}
];
`
You may auto-fix your source files, adding or updating a given license header:
`sh`
eslint --fix .
* license-header/header`: checks a source file for the presence of a license header