Closed jeffryang24 closed 4 years ago
Currently, I only want to know if
import-name
rule supports regex pattern matching
Alas, right now it does not. That would be a feature request.
maybe I can help to fix this issue if possible
Yes please! That'd be great!
However, we should note that there might be backwards compatibility issues: if an existing rule configuration is meant to explicitly refer to a single path, and that path happens to include characters that mean something in a regular expression, adding in regex support would change the rule's behavior. How can the rule support regular expressions in a non-breaking way?
Related: #452
☠️ It's time! ☠️
Per #876, this repository is no longer accepting feature pull requests. TSLint is being deprecated and we recommend you switch to https://typescript-eslint.io.
Thanks for open sourcing with us, everyone!
Rule Suggestion
Is your rule for a general problem or is it specific to your development style?
I think it is only for my development style, but it could be useful for the general problem too.
What does your suggested rule do?
Currently,
import-name
only supports static name matching, such as:underscore
to_
, etc. But, I actually found that theimport-name
rule also supports regex matching while the documentation (README.md) doesn't tell it so.List several examples where your rule could be used
I have many container components with
(\w+)Container.tsx
pattern, such asRebookModalButtonContainer.tsx
, etc. I thought thatimport-name
rule could accept regex pattern, so I add the rule below.path/to/someFile.tsx
tslint.json
And the warning for import script above is gone away. But, this is my question for this issue.
import-name
rule officially support regex pattern for current version?Additional context
Currently, I only want to know if
import-name
rule supports regex pattern matching, which is very helpful for handling the same import-name pattern instead of manually register it one by one. If it doesn't support it, maybe I can help to fix this issue if possible. :smile: