{"record":{"id":"ba7e300856e64627","repo":"oxc-project/oxc","slug":"do-not-use-amd-require-and-define-calls","errorCode":null,"errorMessage":"Do not use AMD `require` and `define` calls.","messagePattern":"Do not use AMD `require` and `define` calls\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/no_amd.rs","lineNumber":12,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{Argument, Expression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn no_amd_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Do not use AMD `require` and `define` calls.\")\n        .with_help(format!(\"Expected imports instead of AMD {name}()\"))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoAmd;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Forbids the use of AMD `require` and `define` calls.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// AMD (Asynchronous Module Definition) is an older module format\n    /// that is less common in modern JavaScript development, especially\n    /// with the widespread use of ES modules and CommonJS in Node.js.\n    /// AMD introduces unnecessary complexity and is often considered outdated.","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/no_amd.rs#L1-L30","documentation":"Fires from import/no-amd when an AMD-style define() or require() call (dependency-array callback form) is detected. The run visitor identifies the call by name and passes it to the diagnostic helper, whose help text notes ES imports were expected instead.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/no_amd.rs:12 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the AMD define()/require() call with ES import/export statements","Use a bundler or loader that supports ES module syntax"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}