ls-lint icon indicating copy to clipboard operation
ls-lint copied to clipboard

Strict mode?

Open stubar opened this issue 5 years ago • 7 comments

At the moment the rules kick in if an extension has been matched. It would be nice to stipulate that only files of a certain extension are allowed (with case rules enforced).

stubar avatar Sep 21 '20 13:09 stubar

Please provide more infos

loeffel-io avatar Sep 21 '20 13:09 loeffel-io

Sorry I seem to have pressed the return key prematurely!

stubar avatar Sep 21 '20 13:09 stubar

Haha, no problem! Could you please make an example about that

loeffel-io avatar Sep 21 '20 13:09 loeffel-io

I have this setup for my components folder...

ls:
  src/components/**:
  .dir: PascalCase
  .ts: camelCase
  .test.ts: camelCase
  .tsx: PascalCase
  .test.tsx: PascalCase
  .stories.tsx: PascalCase
  .d.ts: kebab-case

I would like to stop people creating js files in here

stubar avatar Sep 21 '20 13:09 stubar

Got it! Like https://github.com/loeffel-io/ls-lint/issues/30 we could create something like not_exists rule

What do you think?

loeffel-io avatar Sep 21 '20 13:09 loeffel-io

Yes that sounds like it would work, you could have exists(count). Same rule could enforce no occurrences exists(0) and may theres a case where you only ever want one occurrence of that extension exists(1).

Also I thought as a work around for my js rule, I could for now set a regex that insists on a char not allowed by filesystems.

stubar avatar Sep 21 '20 13:09 stubar

yea, i will think about that some time

I think this will be added in v2 👍

loeffel-io avatar Sep 21 '20 13:09 loeffel-io