{"record":{"id":"735cd58cd6e11788","repo":"oxc-project/oxc","slug":"member-name-of-the-import-declaration-should-b","errorCode":null,"errorMessage":"Member '{name}' of the import declaration should be sorted alphabetically.","messagePattern":"Member '(.+?)' of the import declaration should be sorted alphabetically\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"info","filePath":"crates/oxc_linter/src/rules/eslint/sort_imports.rs","lineNumber":36,"sourceCode":"    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn unexpected_syntax_order_diagnostic(\n    curr_kind: &ImportKind,\n    prev_kind: &ImportKind,\n    span: Span,\n) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Expected '{curr_kind}' syntax before '{prev_kind}' syntax.\"))\n        .with_label(span)\n}\n\nfn sort_imports_alphabetically_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Imports should be sorted alphabetically.\").with_label(span)\n}\n\nfn sort_members_alphabetically_diagnostic(name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"Member '{name}' of the import declaration should be sorted alphabetically.\"\n    ))\n    .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct SortImports(Box<SortImportsOptions>);\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct SortImportsOptions {\n    /// When `true`, the rule ignores case-sensitivity when sorting import names.\n    ignore_case: bool,\n    /// When `true`, the rule ignores the sorting of import declarations (the order of `import` statements).\n    ignore_declaration_sort: bool,\n    /// When `true`, the rule ignores the sorting of import members within a single import declaration.\n    ignore_member_sort: bool,\n    /// When `true`, the rule allows import groups separated by blank lines to be treated independently.","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/sort_imports.rs#L18-L54","documentation":"oxlint `eslint/sort-imports`: within a single import declaration the named specifiers are not alphabetically sorted. `sort_members_alphabetically_diagnostic` (sort_imports.rs:36) formats 'Member \\'{name}\\' of the import declaration should be sorted alphabetically.' This is the member-sort half of the rule, controlled independently by `ignoreMemberSort`.","triggerScenarios":"`import { b, a } from 'mod.js'` — specifiers within one declaration out of order; also fires for type/value mixed specifiers compared by name. `ignoreCase: true` makes the comparison case-insensitive.","commonSituations":"Auto-added imports by an IDE appending to the end; merge conflicts combining two specifier lists; large barrel imports edited by hand.","solutions":["Sort the named specifiers: `import { b, a } from 'mod'` becomes `import { a, b } from 'mod'`.","Use your editor's 'organize imports'/'sort members' action, which fixes this class wholesale.","Set `ignoreMemberSort: true` if your team does not want intra-declaration ordering enforced."],"exampleFix":"// before\nimport { useState, useEffect, memo } from 'react';\n\n// after\nimport { useEffect, memo, useState } from 'react';","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 'organize imports' / 'sort named imports' editor commands when adding specifiers.","When merging two import lists, sort the combined specifier list in the same edit.","Leave `ignoreMemberSort` off so the rule enforces it; the fix is a one-keystroke sort."],"tags":["eslint","oxlint","imports","sorting","style","lint"],"backgroundTag":"import-sorting","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"}