Closed chrisgrieser closed 8 months ago
This will also allow ls-lint
to be used as a pre-commit hook.
This feature is now available in the v2.3.0-beta.1
release.
Please test it and let me know if there are any issues ❤️
The upcoming v2.3.0 blog post: https://ls-lint.org/blog/announcements/v2.3.0.html The docs: https://ls-lint.org/2.3/getting-started/introduction.html The release notes: https://github.com/loeffel-io/ls-lint/releases/tag/v2.3.0-beta.1
I upgrade to v2.3.0-beta.1
, but still lint full project.
It looks like lint full project but only error output passed files. Expected only lint passed files.
I run command:
pnpm exec ls-lint --debug ABCD.ts
My .ls-lint.yml
:
ls:
.*: kebab-case
ignore:
- ./.git
- ./.husky
- ./.vscode
- "**/.turbo"
- "**/dist"
- "**/node_modules"
- "**/README.md"
Output:
-----------------------------
statistics
-----------------------------
time: 37.049546s
paths: 5485
file skips: 17
dirs: 548
dir skips: 30
=============================
ABCD.ts failed for `.*` rules: kebabcase
Thank you @fkworld for your contribution!
So the error looks right, right?
ls-lint still lints the full workdir but errors only for the passed files - this is because the new exists
rule makes it very hard to pass only the passed files to the filesystem
that are needed for exists
. exists
works on directories which makes it impossible to only pass ABAC.ts
to the filesystem
.
There is definitely room for optimizations and i try to target them in future releases.
I never saw ls-lint running for 37s btw - can you please provide the ls-lint time running with ls-lint v2.2.3 🙏
Thank you!
@loeffel-io I understand.
About running for 37s, I fixed that, now less than 1s. I was started another issue #246 to provide more information.
Right now, ls-lint only allows us to lint all files/folders in the current directory, or a directory specified via
--workdir
. I'd like to propose the ability to also lint an individual filename (or technically: a string containing a filename)Example
Rationale
Linting individual files would make ls-lint more flexible to use. For instance, this would allow us to integrate it into an IDE and provide live information when a file was renamed into an undesired form. Another possible use case would be to directly validate user input for file creation or file renaming operations in a script.