Skip to content

no-restricted-imports: allow some specific imports in some specific directories #17047

Answered by mdjermanovic
avasuro asked this question in Ideas
Discussion options

You must be logged in to vote

I could disabe no-restricted-imports rule inside src/components/Button folder using "overrides" section of eslint like this:

overrides: {
  "files": ["src/components/Button/*"],
  "rules": {"no-restricted-imports": "off"}
}

but that will disable all no-restricted-import paths (and I have several there, like separate path for every UI component of the MUI library), which is not what I need - I need to allow import of "@mui/material/Button" but keep all the rest imports specified in no-restricted-imports rule prevented.

Instead of disabling the rule, you could use overrides to set a configuration that doesn't disallow "@mui/material/Button".

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@avasuro
Comment options

@mdjermanovic
Comment options

@avasuro
Comment options

Answer selected by avasuro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants