{"record":{"id":"19b09a2574bec5ab","repo":"oxc-project/oxc","slug":"obj-name-is-not-a-function-and-cannot-be-calle","errorCode":null,"errorMessage":"`{obj_name}` is not a function and cannot be called","messagePattern":"`(.+?)` is not a function and cannot be called","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/no_obj_calls.rs","lineNumber":16,"sourceCode":"use oxc_allocator::ArenaBox;\nuse oxc_ast::{\n    AstKind,\n    ast::{Expression, IdentifierReference, MemberExpression, match_member_expression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::AstNode;\nuse oxc_span::Span;\n\nuse crate::{context::LintContext, rule::Rule};\n\nconst GLOBAL_THIS: &str = \"globalThis\";\n\nfn no_obj_calls_diagnostic(obj_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"`{obj_name}` is not a function and cannot be called\"))\n        .with_help(\"This call will throw a TypeError at runtime.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, PartialEq, Eq)]\npub struct NoObjCalls;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow calling some global objects as functions.\n    ///\n    /// This rule can be disabled for TypeScript code, as the TypeScript compiler\n    /// enforces this check.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Some global objects are not intended to be called as functions.","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_obj_calls.rs#L1-L34","documentation":"Lint diagnostic from eslint/no-obj-calls (check_callee): the callee of a call expression resolves to a known non-callable global object such as Math, JSON, or Reflect. Calling it throws 'TypeError: X is not a function' at runtime; the diagnostic's help states exactly that.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/no_obj_calls.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the intended method on the object, e.g. Math.max(...), JSON.parse(...)","Fix the typo if a function was intended (e.g. JSON vs JSONp)"],"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"}