{"record":{"id":"4dd9e37e50718eb2","repo":"oxc-project/oxc","slug":"import-type-with-empty-attribute-list-is-not-all","errorCode":null,"errorMessage":"{import_type} with empty attribute list is not allowed.","messagePattern":"(.+?) with empty attribute list is not allowed\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/require_module_attributes.rs","lineNumber":19,"sourceCode":"use oxc_allocator::ArenaVec;\nuse oxc_ast::{\n    AstKind,\n    ast::{Expression, ObjectProperty, PropertyKind, WithClause},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    fixer::{RuleFix, RuleFixer},\n    rule::Rule,\n    utils::is_empty_object_expression,\n};\n\nfn require_module_attributes_diagnostic(span: Span, import_type: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"{import_type} with empty attribute list is not allowed.\"))\n        .with_label(span)\n        .with_help(\"Remove the unused import attribute.\")\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireModuleAttributes;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule enforces a non-empty attribute list in `import`/`export` statements and `import()` expressions.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Import attributes are meant to provide metadata about how a module should be loaded\n    /// (e.g., `with { type: \"json\" }`). An empty attribute object provides no information\n    /// and should be removed.\n    ///","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/require_module_attributes.rs#L1-L37","documentation":"Emitted by the unicorn/require-module-attributes rule when an import or export declaration carries an empty import-attributes object (`with {}`). It fires on the with-clause span because an empty attribute list is meaningless syntax — either attributes are needed (they must be non-empty) or the `with` clause should be removed entirely.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/require_module_attributes.rs:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the empty `with {}` clause if no attributes are needed","Add the intended attributes, e.g. `with { type: 'json' }`"],"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"}