Skip to main content


Disallow require statements except in import statements.

In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.

module.exports = {
"rules": {
"@typescript-eslint/no-var-requires": "error"
Try this rule in the playground ↗


var foo = require('foo');
const foo = require('foo');
let foo = require('foo');
Open in Playground


This rule is not configurable.

When Not To Use It

If you don't care about using newer module syntax, then you will not need this rule.