Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Proposal: Blocklists #201

Closed
aleinin opened this issue Feb 27, 2024 · 5 comments · Fixed by #223
Closed

Feature Proposal: Blocklists #201

aleinin opened this issue Feb 27, 2024 · 5 comments · Fixed by #223

Comments

@aleinin
Copy link

aleinin commented Feb 27, 2024

Hello, thank you for making ls-lint!

It would be nice to be able to block certain files. Here is my use case:

ls:
  # tsx
  .router.test.tsx: PascalCase
  .router.tsx: PascalCase
  .types.tsx: PascalCase
  # Pascal case regex allowing for prefix use for hooks
  .tsx: regex:^(use)*[A-Z][a-z]+(?:[A-Z][a-z]+)*$
  .test.tsx: regex:^(use)*[A-Z][a-z]+(?:[A-Z][a-z]+)*$
  # scss
  .module.scss: PascalCase
  # block list
  .modules.scss: regex:module-not-modules
  .test.ts: regex:spec-for-ts
  .spec.tsx: regex:test-for-tsx
  .css: regex:use-scss
  .jsx: regex:use-tsx

ignore:
  - .git
  - node_modules

2024/02/27 01:35:29 src/app/Cool.jsx failed for rules: regex (use-tsx)

As you can see, I have a small blocklist where I'm using the regex rule to error on certain file types to enforce a particular usage. Honestly, this works quite well. But, it would be nice if there was a more natural way to go about this than misusing the regex rule.

@ccoVeille
Copy link

For anyone interested. You can now use exists:0 as a rule. Please check the documentation

@loeffel-io
Copy link
Owner

@ccoVeille v2.3.0 is not released yet - there is one single piece that is missing

@ccoVeille
Copy link

Author opened the issue 5 months ago. I assumed he could wait a few more days/week.

But you are right, it's not yet available or documented

@loeffel-io
Copy link
Owner

As far i can tell this is one of the most challenging tasks for me - its beautiful how wildcard extensions, selected files and exists working together magically

@loeffel-io
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants