loeffel-io / ls-lint

An extremely fast directory and filename linter - Bring some structure to your project filesystem

Home Page:https://ls-lint.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature proposal: supporting .dir only for child folders

haili042 opened this issue · comments

Hi~

I have project like this:

src
|-- apps
|   |-- HomeApp # XxxXxxApp
|   |   |-- components
|   |   |-- utils
|   |-- UserApp

I want all child folders of src/apps follow PascalCase + App, and the other subdirectories follow kebab-case, so I try this:

ls: 
  src: 
    .dir: kebab-case

  src/apps:
    .dir:  regex:^[A-Z](([a-z0-9]+[A-Z]?)*)App$
src/apps/HomeApp/components failed for rules: kebabcase

But it's fail because .dir will applies for the current directory and all their subdirectories.
So I'd like to propose the ability to supporting rules configuration to add recursive option (or other options maybe)

ls: 
  src: 
    .dir: kebab-case

  src/apps:
    .dir: 
      rule: regex:^[A-Z](([a-z0-9]+[A-Z]?)*)App$
      recursive: false # true for all subdirectories, false for child folders

Hey @haili042,

this is supported - i think you can simple do this (please let me know if this works):

ls: 
    src: 
        .dir: kebab-case
    
        apps/*:
            .dir: regex:... # fyi: do not use ^..$ here: https://ls-lint.org/2.2/configuration/the-rules.html#example

                '**':
                    .dir: kebab-case