Socket
Book a DemoInstallSign in
Socket

eslint-plugin-validate-filename

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-validate-filename

ESLint plugin validate filename.

1.2.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

eslint-plugin-validate-filename

ESLint rule to force file names format. Create common rules for file names by folder name or regex pattern.

Install

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

Usage

{
  "plugins": ["validate-filename"]
}

validate-filename/naming-rules

Create a rule in the name of ESLint. You can set multiple rules.

{
  "rules": {
    "validate-filename/naming-rules": [
      "error",
      {
        rules: [
          {
            case: 'pascal', // camel or pascal or snake or kebab or flat
            target: "**/components/**", // target "components" folder
            excludes: ['hooks'], // "hooks" folder is excluded.
          },
          {
            case: 'camel',
            target: "**/hooks/**", // target "hooks" folder
            patterns: '^use', // file names begin with "use".
          },
          {
            target: '/schemas/**', // target "schemas" folder
            patterns: '^[a-z][a-zA-Z0-9]*\\.schema\\.ts$', // file names that contain 'schema'. ex: user.schema.ts
          },
        ],
      },
    ],
  },
}

validate-filename/limit-extensions

Only certain extensions are allowed. target is a regular expression that identifies the folder. extensions you want to allow for extensions.

{
  "rules": {
    "validate-filename/limit-extensions": [
      "error",
      {
        rules: [
          {
            target: "**/hooks/**",
            extensions: ['.ts', '.tsx'], // This cannot be created except for .ts or .tsx under the hooks folder.
          },
        ],
      },
    ],
  },
}

Development

First, install npm dependencies.

npm install

Running unit test. This library uses vitest.

npm run test

Build modules.

npm run build

Next.js structure settings example

See Next.js naming conventions are checked with ESLint rules article.

License

MIT License.© hiro08gh

Keywords

eslint

FAQs

Package last updated on 12 Jul 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.