Skip to main content

no-require-imports

Disallow invocation of require().

Prefer the newer ES6-style imports over require().

.eslintrc.cjs
module.exports = {
"rules": {
"@typescript-eslint/no-require-imports": "warn"
}
};

Examples

const lib1 = require('lib1');
const { lib2 } = require('lib2');
import lib3 = require('lib3');

Options

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.

Resources