dukeluo / eslint-plugin-check-file

ESLint rules for consistent filename and folder. Allows you to enforce a consistent naming pattern for the filename and folder.

Home Page:https://www.npmjs.com/package/eslint-plugin-check-file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to support the configuration of multiple matching rules

iceycc opened this issue · comments

Project structure
I would like to support both canonical configurations. as follows:

└── src
    └── kebabCase.js
    └── kebab-case.js

Whether the following configurations are supported:

 "src/**/!(App).vue": "KEBAB_CASE|PASCAL_CASE",
commented

@iceycc Built in naming pattern cannot be combined currently. You need to create your own glob pattern for your case.

Could you take this as a feature request?

I have decided not to use this package specifically because it does not support this feature.

commented

It's actually quite simple to create your own glob pattern to combine the built in naming pattern. Here's a step-by-step guide to help you out:

  1. First, head over to the file where the built-in naming patterns are defined. You'll find the KEBAB_CASE pattern as +([a-z])*([a-z0-9])*(-+([a-z0-9])), and the PASCAL_CASE pattern as *([A-Z]*([a-z0-9])).
  2. To combine KEBAB_CASE and PASCAL_CASE, use the @(pattern1 | pattern2) syntax. In this case, the combined pattern will look like this: @(+([a-z])*([a-z0-9])*(-+([a-z0-9])) | *([A-Z]*([a-z0-9]))).
  3. Go to the website globster.xyz and verify your combined pattern.
  4. Once you are satisfied with the combined pattern, you can copy and integrate it into your .eslintrc.json configuration file.