biome
biome copied to clipboard
feat(biome_js_analyze): noRestrictedImports - Added option to allow import from specific locations
Summary
Sometimes we want to forbid the use of a module in the application but allow in specific places.
One great example of this is when we want to define a linear folder structure and enforce that a folder should not reference the folders above it, but allow referencing all the folders below.
Test Plan
{
"noRestrictedImports": {
"options": {
"paths": {
"@/features": {
"message": "Using lodash is not encouraged",
"allowedFrom": ["./src/routes"]
},
"underscore": {
"message": "Using underscore is not encouraged",
}
}
}
}
}
In the example above we would be able to allow using @/features
module from within ./src/routes
but not from other places.