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

How to disable some specific names? #39

Closed
basharov opened this issue Jan 14, 2021 · 15 comments · Fixed by #223
Closed

How to disable some specific names? #39

basharov opened this issue Jan 14, 2021 · 15 comments · Fixed by #223
Labels

Comments

@basharov
Copy link

I'd like to prohibit using filename index.css in my components but cannot find details about the syntax of regex used in the project to build a proper expression.

Please advise.

@loeffel-io
Copy link
Owner

So everything for .css should be allowed expect index.css?

@basharov
Copy link
Author

You're right, I want to allow any css filenames except index.css

@loeffel-io
Copy link
Owner

https://regex101.com/r/xYtUN5/1 could work

@basharov
Copy link
Author

@loeffel-io It showd the error:

error parsing regexp: invalid or unsupported Perl syntax: (?!

@loeffel-io
Copy link
Owner

"Go regex does not support lookarounds." - thats sad

In this case you have to find a way to convert your lookarounds to std regex

@loeffel-io
Copy link
Owner

just keep in mind that there is the ignore pattern: https://ls-lint.org/1.x/configuration/the-basics.html#creating-configuration
maybe this can help you too

@loeffel-io
Copy link
Owner

@basharov to make it more easy we could provide a not_regex rule in v2 🤔

@LaamGinghong
Copy link

I also encountered the same scene. In my scenario, I want all tsx files except for the file name use***.tsx to use the pascal case rule, and use***.tsx to use the camel case rule. It doesn’t seem to meet my needs so far

@jfairley
Copy link

jfairley commented Feb 2, 2022

I also encountered the same scene. In my scenario, I want all tsx files except for the file name use***.tsx to use the pascal case rule, and use***.tsx to use the camel case rule. It doesn’t seem to meet my needs so far

@LaamGinghong I keep all of my hooks in a separate directory (src/hooks). That way, I can set up a separate rule for my hooks directory.

@jfairley
Copy link

jfairley commented Feb 2, 2022

@loeffel-io I'm here looking for something similar. It would be nice to define reject patterns. index.css is one example, but similarly, imagine a project using something like SASS or LESS. I would want to forbid all .css files.

In my specific case, I'm trying to target inconsistent naming between .types.ts and .type.ts. I want to blacklist one of those. I tried .type.ts: "regex:" but empty regex isn't allowed. Admittedly, that's a hack anyway.


Edit: Ah, I'm interested in the proposed "Strict Mode" #32.

@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 3 years 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants