🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-license-header

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-license-header

Validates the presence of a license header

0.8.0
latest
Source
npm
Version published
Weekly downloads
61K
46.62%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-license-header

CI Code coverage

Rules to validate the presence of license headers in source files.

Installation

npm install eslint-plugin-license-header --save-dev

Usage

Add license-header to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "license-header"
  ]
}

Header configuration

When enabling the rule specify the license header template as a path:

{
  "rules": {
    "license-header/header": [ "error", "./resources/license-header.js" ]
  }
}

Alternatively, specify the license header as raw text:

{
  "rules": {
    "license-header/header": [
      "error",
      [
          "/***********************************************",
          " * Copyright My Company",
          " * Copyright " + new Date().getFullYear(),
          " ***********************************************/",
      ]
    ]
  }
}

Flat config

In eslint@9 you can consume the library using a flat configuration, too:

import licenseHeader from "eslint-plugin-license-header";

export default [
  {
    files: '**/*.js',
    plugins: {
      'license-header': licenseHeader
    },
    rules: {
      "license-header/header": ...
    }
  }
];

Autofix

You may auto-fix your source files, adding or updating a given license header:

eslint --fix .

Supported rules

  • license-header/header: checks a source file for the presence of a license header

License

MIT

Keywords

eslint

FAQs

Package last updated on 20 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts