eslint-plugin-file-header

0.0.1 • Public • Published

eslint-plugin-file-header

Rule to check if file contains specified comment.

Installation

yarn add -D eslint-plugin-file-header

Example:

module.exports = {
  plugins: ["file-header"],
  rules: {
    "file-header/file-header": [
      "error",
      [
        "This Source Code Form is subject to the terms of the Mozilla Public",
        "License, v. 2.0. If a copy of the MPL was not distributed with this",
        "file, You can obtain one at <http://mozilla.org/MPL/2.0/>."
      ],
      "block",
      ["-\\*-(.*)-\\*-", "eslint(.*)", "vim(.*)"]
    ]
  }
};

Options:

  1. header - array of text lines (without comment tags).
  2. commentType - either block, line or null. Plugin will use this option to search for headers and to fix missing header.
  3. ignoredComments - array of patterns that this rule will ignore (they won't be replaced by the rule and new header will be inserted after last ignoredComment if any).

Hardcoded rules:

  • Header must not be intended.
  • Header must start in 6 first lines of file.

Dependents (0)

Package Sidebar

Install

npm i eslint-plugin-file-header

Weekly Downloads

971

Version

0.0.1

License

MIT

Unpacked Size

34.4 kB

Total Files

9

Last publish

Collaborators

  • sekhmet