Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Latest commit

 

History

History
28 lines (18 loc) · 712 Bytes

no-var-requires.md

File metadata and controls

28 lines (18 loc) · 712 Bytes

Disallows the use of require statements except in import statements (no-var-requires)

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.

Rule Details

Examples of incorrect code for this rule:

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

Examples of correct code for this rule:

import foo = require("foo");
require("foo");

When Not To Use It

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

Compatibility