Skip to content

typescript/no-var-requires Restriction

What it does

Disallow require statements except in import statements

Why is this bad?

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.

typescript
var foo = require("foo");
const foo = require("foo");
let foo = require("foo");

References

Released under the MIT License.