1.0.4 • Published 3 years ago
babel-plugin-disallow-unsafe-global-references-and-module-importing v1.0.4
Rule
- THE GLOBAL IDENTIFIER BLACKLIST:(All references to the below identifiers will be disallowed)
window
,global
,globalThis
eval
,Function
localStorage
,sessionStorage
,indexedDB
document.cookie
require
(CommonJS)- Additional identifiers defined in plugin options:
globalIndentifierBlacklist
- THE MODULE SOURCE WHITELIST:(Only the below module sources are allowed to be imported)
- Modules of the
zalo
categoryE.g.import foo from 'zalo/foo'
- All local module sources
- Additional module sources defined in plugin options:
moduleSourceWhitelist
- Modules of the
Options
{ globalIndentifierBlacklist: ['foo'] }
- Data type:
Array<string>
- Usage: Specify additional items for the THE GLOBAL IDENTIFIER BLACKLIST
- Note: Subjects must be global-scoped objects.
{ moduleSourceWhitelist: ['bar'] }
- Data type:
Array<string>
- Usage: Specify additional items for the THE MODULE SOURCE WHITELIST
- Note:
- All local modules is whitelisted by default. So there's no need to specify them here.
- Each module is treated as a module category, hence all sub-categories will be whitelisted as a result.E.g. Category:
'lodash'
-> Sub-categories:'lodash/foo'
,'lodash/bar'
, etc.