TypeScript · architecture
no-restricted-library-load
eslint:no-restricted-library-load Apply a configured library-replacement policy to literal dynamic imports, CommonJS loads, and TypeScript import-equals declarations.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
Runtime module loads can bypass the replacement policy enforced for static imports.
Fix
Load the configured replacement library instead of the restricted module.
Before / after
Executed by this rule’s unit tests.
Before
Do not load a restricted library at runtime
const client = require('axios'); After
Static imports remain the static-import rule's responsibility
import axios from 'axios'; Limits
- Only literal dynamic imports, unshadowed CommonJS loads, and TypeScript import-equals declarations are checked.
Message IDs
restrictedLibraryLoad