{"record":{"id":"07b1b05cc9534563","repo":"oxc-project/oxc","slug":"missing-file-extension-in-import-or-export-decla","errorCode":null,"errorMessage":"Missing file extension in {import_or_export} declaration.","messagePattern":"Missing file extension in (.+?) declaration\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/extensions.rs","lineNumber":40,"sourceCode":"\nfn extension_should_not_be_included_in_diagnostic(\n    span: Span,\n    extension: &str,\n    is_import: bool,\n) -> OxcDiagnostic {\n    let import_or_export = if is_import { \"import\" } else { \"export\" };\n\n    OxcDiagnostic::warn(format!(\n        r#\"File extension \"{extension}\" should not be included in the {import_or_export} declaration.\"#\n    ))\n    .with_help(format!(\"Remove the file extension from this {import_or_export}.\"))\n    .with_label(span)\n}\n\nfn extension_missing_diagnostic(span: Span, is_import: bool) -> OxcDiagnostic {\n    let import_or_export = if is_import { \"import\" } else { \"export\" };\n\n    OxcDiagnostic::warn(format!(\"Missing file extension in {import_or_export} declaration.\"))\n        .with_help(format!(\"Add a file extension to this {import_or_export}.\"))\n        .with_label(span)\n}\n\n/// Extension rule configuration; Copy to avoid extra indirection.\n#[repr(u8)]\n#[derive(Copy, Clone, Debug, PartialEq, Eq, JsonSchema, Serialize)]\n#[serde(rename_all = \"camelCase\")]\npub enum ExtensionRule {\n    Always = 0,\n    Never = 1,\n    IgnorePackages = 2,\n}\n\nimpl ExtensionRule {\n    /// Parse a string into an ExtensionRule variant.\n    #[inline]\n    pub fn from_str(s: &str) -> Option<ExtensionRule> {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/extensions.rs#L22-L58","documentation":"Raised by the import/extensions rule when a module specifier lacks a file extension while the rule's mode (e.g. 'always' or per-path 'always') requires one for that group. The helper builds the message from whether the declaration is an import or export.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/extensions.rs:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the appropriate file extension to the import/export path","Adjust the rule config if extensions should not be required here"],"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"}