{"record":{"id":"bbc0255b531c6930","repo":"oxc-project/oxc","slug":"do-not-access-object-prototype-method-method-name","errorCode":null,"errorMessage":"do not access Object.prototype method {method_name:?} from target object","messagePattern":"do not access Object\\.prototype method (.+?) from target object","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/no_prototype_builtins.rs","lineNumber":9,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn no_prototype_builtins_diagnostic(method_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"do not access Object.prototype method {method_name:?} from target object\"\n    ))\n    .with_help(format!(\n        \"to avoid prototype pollution, use `Object.prototype.{method_name}.call` instead\"\n    ))\n    .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoPrototypeBuiltins;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow calling some `Object.prototype` methods directly on objects.\n    ///\n    /// ### Why is this bad?\n    ///","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_prototype_builtins.rs#L1-L27","documentation":"Lint diagnostic from eslint/no-prototype-builtins: hasOwnProperty, isPrototypeOf, or propertyIsEnumerable was called directly on an object (obj.hasOwnProperty(k)). Objects without a prototype (Object.create(null)) or with shadowed methods throw or lie; calling from Object.prototype is always safe.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/no_prototype_builtins.rs:9 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use Object.prototype.hasOwnProperty.call(obj, key) as the help suggests","Prefer Object.hasOwn(obj, key) in modern runtimes","Use a Map or Set instead of relying on prototype-based key checks"],"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-14T00:17:10.932Z"}