ls-lint
ls-lint copied to clipboard
Wildcard support for file extensions?
Hi!
First of all, I'd like to say that I love this! Exactly what I was looking for! Thanks!
One feature that seems to be missing (or would be great to have) is the option to set a general rule for all files. Specifically to say that all files and folders should be lowercase, regardless of their extension.
It seems that something like this isn't possible:
ls:
.*: lowercase
.dir: kebab-case
.js: kebab-case
...
Correct?
The alternative would be to find out what extensions are in a project and what extensions could come up in the future, which isn't really feasible.
Or do you have another idea?
Thanks in advance!
P.S. One could, of course, run something like this to find all files and folders that have uppercase letters in them:
find . -path ./node_modules -prune -false -o -name "*[[:upper:]]*"
But depending on the number of folders to ignore, this can quickly get pretty messy.
I've found myself wanting to use wildcards (i.e. glob) for other things like ignore paths as well. For examples I'd like to ignore **/node_modules
. When I specify just node_modules
, my first assumption was that whenever it runs across any file/directory located in any node_modules it'll ignore it, but node_modules
just means the node_modules
folder in the root where the configuration is.
Is it possible to use globs wherever matching needs to happen (e.g., extensions, paths, ignore)?
Indeed, using a default rule for all files (possibly in a subdirectory) would be super helpful. My use case : checking that image files are all kebab case. Currently I cannot use ls-lint
for that as for instance I don't know how to write a rule for don_t_like_this_name.JPG
because it's the extension that is breaking the naming convention...
Hey,
agree to all of you and i'll try to bring more and more glob patterns to ls-lint.
@aphecetche .JPG: kebeb-case
isn't working?
Hey,
agree to all of you and i'll try to bring more and more glob patterns to ls-lint.
@aphecetche
.JPG: kebeb-case
isn't working?
sorry for the late answer : no, it does not work (at least for what I want to do, I.e. have the full filename be kebab-case), as the casing of the extension itself is not checked as far as I can tell.
Wildcard support would be perfect (but not only for ignores) I plan to define a regexp to forbid some file-extensions
ls:
components/assets:
.dir: kebab-case
.png: kebab-case
.*: regex:only-png-files-allowed
wildcard support, or default rule, please
I think this would be also useful for files without extensions. For example binary/executable files are often without extension.
Love the library! Thanks for making it.
I'm going to add another use case for this that I've run into, which is sub-extensions. My app uses SvelteKit and Vite, which means I'm dealing with .d.ts, .config.ts, .server.ts. For all of those I want camelCase for the base name and would love to be able to do .*.ts: camelcase
instead of individually calling out all those sub-extensions.