Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: sort-imports sort order by group order in line-length #142

Closed
2 tasks done
matheusdsilva01 opened this issue Apr 30, 2024 · 1 comment
Closed
2 tasks done
Labels
enhancement New feature or request

Comments

@matheusdsilva01
Copy link

What rule do you want to change?

sort-imports

Describe the problem

The possibility of sorting by group order.
I believe it would be something like: "sort-order-groups": true

sort-order-groups rule with first create after get:

"perfectionist/sort-imports": [
      "warn",
      {
        "type": "line-length",
        "order": "desc",
        "groups": [
          ["create", "get"],
          ["builtin", "external"]
        ],
        "custom-groups": {
          "value": {
            "get": "../utils/get/**/*",
            "create": "../utils/create/**/*"
          }
        },
        "newlines-between": "always",
        "sort-groups": true
      }
    ]

Code example

without sort-order-groups rule, sort this:

import { createEslintRule } from '../utils/create'
import { createEslint } from '../utils/create'
import { getLinesBetween } from '../utils/get'
import { getGroupNumber } from '../utils/get'
import { createRule } from '../utils/create'
import { getNodeRange } from '../utils/get'
import { getGroup } from '../utils/get'

with "sort-order-groups": true rule:

import { createEslintRule } from '../utils/create'
import { createEslint } from '../utils/create'
import { createRule } from '../utils/create'
import { getLinesBetween } from '../utils/get'
import { getGroupNumber } from '../utils/get'
import { getNodeRange } from '../utils/get'
import { getGroup } from '../utils/get'

Additional comments

I used Google Translate for this issue, sorry if there are some grammatical errors 😄

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@matheusdsilva01 matheusdsilva01 added the enhancement New feature or request label Apr 30, 2024
@azat-io
Copy link
Owner

azat-io commented Jul 22, 2024

Thank you for your issue!

Thank you for your idea. I don't think it will be in demand at this time. And at the moment we have no plans to implement this feature.

@azat-io azat-io closed this as completed Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants