1.0.0 • Published 2 years ago

eslint-plugin-forbid-filename v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

eslint-plugin-forbid-filename

npm

Custom ESLint rules to forbid certain filename pattern.

Installation

To add eslint-plugin-forbid-filename to your project, run:

yarn add -D eslint-plugin-forbid-filename

or

npm install --save-dev eslint-plugin-forbid-filename

Usage

  • Add "forbid-filename" to the plugin list of your ESLint config file
  • Add your list of forbidden pattern in the patterns option
  • You can also ignore files with the ignores option

Example

This config will throw an error if you have any .d.ts files in your codebase :

{
  plugins: [
   "forbid-filename"
  ],
  rules: {
    "forbid-filename/match": [
      "error", 
      { 
        patterns: [/\.d\.ts$/],
        ignores: ["next-env.d.ts"],
      }
    ],
  }
}