Skip to content

linter: eslint/sort-imports/allowSeparatedGroups does not work with single empty line #15990

@ryansuhartanto

Description

@ryansuhartanto

What version of Oxlint are you using?

1.29.0

What command did you run?

oxlint --type-aware --config linter/eslint/sort-imports/allowSeparatedGroups/.oxlintrc.json linter/eslint/sort-imports/allowSeparatedGroups

What does your .oxlintrc.json config file look like?

{
  "plugins": [
    "eslint"
  ],
  "rules": {
    "eslint/sort-imports": [
      "error",
      {
        "allowSeparatedGroups": true
      }
    ],
  }
}

What happened?

Checkout this file or visit this repo https://github.com/ryansuhartanto/oxc-issues/blob/main/linter/eslint/sort-imports/allowSeparatedGroups/fail.ts:

// oxlint-disable no-unused-vars
import { format } from "oxfmt";

import { defineRule } from "oxlint";

This snippet will throw this error:

> oxc-issues@ lint /home/nexus/Dokumen/suhartanto/VCS/oxc-issues
> oxlint --type-aware --config linter/eslint/sort-imports/allowSeparatedGroups/.oxlintrc.json linter/eslint/sort-imports/allowSeparatedGroups


  × eslint(sort-imports): Imports should be sorted alphabetically.
   ╭─[linter/eslint/sort-imports/allowSeparatedGroups/fail.ts:4:1]
 3 │ 
 4 │ import { defineRule } from "oxlint";
   · ────────────────────────────────────
   ╰────

Found 0 warnings and 1 error.
Finished in 105ms on 2 files with 53 rules using 8 threads.
 ELIFECYCLE  Command failed with exit code 1.

Whereas this file will pass (note the extra empty line):

// oxlint-disable no-unused-vars
import { format } from "oxfmt";


import { defineRule } from "oxlint";

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions