Import NextRules
no-barrel-import
Disallow imports from barrel files to improve build performance and tree-shaking
š¼ This rule is enabled in the following configs: recommended, typescript.
š” This rule is automatically fixable by the --fix CLI option.
Disallow imports from barrel files to improve build performance and tree-shaking
Rule Details
This rule aims to prevent issues related to barrel-import.
Options
[
{
"type": "object",
"properties": {
"knownBarrels": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Regex patterns for paths known to be barrels"
},
"ignoreNodeModules": {
"type": "boolean",
"default": true,
"description": "Ignore imports from node_modules"
},
"ignoredPackages": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Packages to ignore (good tree-shaking support)"
}
},
"additionalProperties": false
}
]Implementation
OWASP Foundation
- Category: A00:2021 - General Security