{"record":{"id":"54071f78c7f51609","repo":"oxc-project/oxc","slug":"expected-longform-property-syntax","errorCode":null,"errorMessage":"Expected longform property syntax.","messagePattern":"Expected longform property syntax\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/object_shorthand.rs","lineNumber":38,"sourceCode":"    context::LintContext,\n    rule::{Rule, TupleRuleConfig},\n    utils::deserialize_regex_option,\n};\n\nfn expected_all_properties_shorthanded(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected shorthand for all properties.\").with_label(span)\n}\n\nfn expected_literal_method_longform(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected longform method syntax for string literal keys.\").with_label(span)\n}\n\nfn expected_property_shorthand(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected property shorthand.\").with_label(span)\n}\n\nfn expected_property_longform(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected longform property syntax.\").with_label(span)\n}\n\nfn expected_method_shorthand(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected method shorthand.\").with_label(span)\n}\n\nfn expected_method_longform(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected longform method syntax.\").with_label(span)\n}\n\nfn unexpected_mix(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected mix of shorthand and non-shorthand properties.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct ObjectShorthand(Box<ObjectShorthandConfig>);\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/oxc-project/oxc/blob/a3d33dda7cb69da23db4fcaa2c0c05de61e760a1/crates/oxc_linter/src/rules/eslint/object_shorthand.rs#L20-L56","documentation":"Diagnostic from `object-shorthand` configured as `never` (apply_never). The rule is inverted: shorthand properties are forbidden and every property must be written explicitly as `key: value`, so `{ x }` is reported with 'Expected longform property syntax.' Oxc sets apply_never from ShorthandType::Never in the tuple config.","triggerScenarios":"Config `[\"object-shorthand\", \"error\", \"never\"]` with code like `const o = { x, y };` or function-valued shorthand `const m = { run() {} };` (methods also flagged under never). Any ObjectProperty lacking an explicit value triggers it.","commonSituations":"Teams standardizing on explicit key-value style for grep-ability or to ease future key renames; codebases whose style guide predates ES6 and adopted oxlint with a never config.","solutions":["Expand the shorthand: `{ x }` -> `{ x: x }`.","Expand method shorthand: `{ run() {} }` -> `{ run: function () {} }`.","Autofix with `oxlint --fix`.","If you did not intend the inverted mode, fix the config to `\"always\"` (the default)."],"exampleFix":"// before\nconst o = { x, y };\n\n// after\nconst o = { x: x, y: y };","handlingStrategy":"validation","validationCode":"const hasShorthandProperty = /\\{\\s*[\\w$]+\\s*[,}]/.test(objectLiteralSource);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Under a `never` config, always write explicit `key: value` pairs.","Double-check the config string - `never` is easy to paste by accident when you meant `always`.","Use `oxlint --fix` to expand shorthands mechanically."],"tags":["lint","eslint","oxlint","object-literal","longform","style"],"backgroundTag":"object-shorthand-never-mode","analyzedSha":"a3d33dda7cb69da23db4fcaa2c0c05de61e760a1","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}