{"record":{"id":"7f6a5c23e9fce714","repo":"oxc-project/oxc","slug":"file-extension-extension-should-not-be-include","errorCode":null,"errorMessage":"File extension \"{extension}\" should not be included in the {import_or_export} declaration.","messagePattern":"File extension \"(.+?)\" should not be included in the (.+?) declaration\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/extensions.rs","lineNumber":30,"sourceCode":"use schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse serde_json::Value;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{MixedTupleRuleConfig, Rule},\n};\n\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\")]","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/extensions.rs#L12-L48","documentation":"Raised by the import/extensions rule when a module specifier in an import or export declaration contains a file extension while the rule's configured mode forbids extensions for that path group. The extension string and whether the declaration is an import or export are interpolated into the message.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/extensions.rs:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the file extension from the module specifier","Configure the rule's settings to allow extensions for this path type (e.g. inline scripts or CSS assets)"],"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"}