# import/no-amd

> Disallow AMD `define()` and `require()` calls

AMD is RequireJS's module format: `define(["dep"], function (dep) { ... })`. Bun, Node.js and browsers don't run it without a loader, and tools can't follow its dependencies the way they follow `import`. In a project that uses ES modules, an AMD call is a leftover.

A call to `define` or `require` is reported if it has exactly two arguments and the first is an array. Only calls at the top level of a module are reported, not calls inside a function or a block. A CommonJS `require("name")` is fine.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"import/no-amd" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
define(["./logger"], function (logger) {
  logger.info("ready");
});
```

{/* bad */}
```js
require(["./logger", "./config"], function (logger, config) {
  logger.info(config.name);
});
```

Not reported:

{/* good */}
```js
import logger from "./logger.js";
import config from "./config.js";

logger.info(config.name);
```

{/* good */}
```js
const logger = require("./logger");

function loadLegacyPlugin(done) {
  require(["./legacy-plugin"], done);
}
```
