global-require
UnreleasedConfiguration
rslint.config.ts
Rule Details
Requires require() calls to appear at the top level of a module. Calls inside functions, blocks, loops, and other nested statements are reported. Calls to a locally declared require are ignored.
Top-level variable declarations, assignments, member access, calls, and conditional expressions are allowed. Other enclosing expressions, such as arrays, objects, logical expressions, and optional chains, are reported even at the top level.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
This rule has no options and does not provide automatic fixes or suggestions.