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 request: add whitelist for dependency rules #855

Open
henricazottes opened this issue Oct 26, 2022 · 0 comments
Open

Feature request: add whitelist for dependency rules #855

henricazottes opened this issue Oct 26, 2022 · 0 comments

Comments

@henricazottes
Copy link

henricazottes commented Oct 26, 2022

Hi,

First of all thanks for the work, it's a very useful package :) I however ran into a kinda specific problem.

Context: I'm using the no-restricted-dependencies rule with the following configuration :

'no-restricted-dependencies': [
  'error',
  [
    ...
    'ts-*',
    ...
  ],
],

Problem: I would like to use the package ts-predicate (which can't be used as dev dependency because it's needed at runtime). And of course I get a lint error because the name matches the rule.

I couldn't find in the documentation if I could use some sort of regex to exclude a particular name. It seems only the wildcard is available but it doesn't fit my situation.

Proposition: Add a whitelist array as an optional array after the matching array. Configuration example:

'no-restricted-dependencies': [
  'error',
  [
    ...
    'ts-*',
    ...
  ],
  [
    'ts-predicate',
  ]
],

What do you think?

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

No branches or pull requests

1 participant