src/utils/reflection/function.reflection.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

require statement not part of an import statement
Open

const parser = require("espree");

Rule: no-var-requires

Disallows the use of require statements except in import statements.

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

Rationale

AMD-style require([]) and CommonJS-style require("") statements are environment-specific and more difficult to statically analyze.

ES2015-style imports are part of the JavaScript language specfication and recommended as the path going forward. TypeScript will compile them to environment-specific forms as needed.

Notes
  • TypeScript Only

Config

Not configurable.

Examples
"no-var-requires": true

For more information see this page.

There are no issues that match your filters.

Category
Status