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

feat: makes partitionByComment support line and block filters #433

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

hugop95
Copy link
Contributor

@hugop95 hugop95 commented Dec 24, 2024

Resolves #432

Most of the lines added are tests and documentation.

Description

Updates the partitionByComment option to support block and line filters:

type T = {
        block?: string[] | boolean | string;
        line?: string[] | boolean | string;
    }
    | string[]
    | boolean
    | string

Affected rules

  • sort-enums
  • sort-array-includes
  • sort-sets
  • sort-decorators
  • sort-object-types
  • sort-interfaces
  • sort-modules
  • sort-classes
  • sort-variable-declarations
  • sort-union-types
  • sort-intersection-types
  • sort-objects
  • sort-named-imports
  • sort-named-exports
  • sort-maps
  • sort-imports
  • sort-exports

What is the purpose of this pull request?

  • New Feature

@hugop95 hugop95 force-pushed the feat/partition-by-comment branch 4 times, most recently from b06e023 to 3200b45 Compare December 25, 2024 12:34
@hugop95 hugop95 force-pushed the feat/partition-by-comment branch from 3200b45 to fe4841f Compare December 25, 2024 12:44
@hugop95 hugop95 force-pushed the feat/partition-by-comment branch from fe4841f to cb30325 Compare December 25, 2024 15:32
@hugop95 hugop95 force-pushed the feat/partition-by-comment branch 3 times, most recently from 4a7198e to 4b5cd3b Compare December 25, 2024 18:15
@hugop95 hugop95 force-pushed the feat/partition-by-comment branch from 4b5cd3b to 731bbe1 Compare December 25, 2024 23:46
@hugop95 hugop95 marked this pull request as ready for review December 25, 2024 23:48
@@ -192,6 +192,11 @@ Allows you to group array elements by their kind, determining whether spread val

### partitionByComment

<sub>
- type:
- `boolean | string | string[]` (`BaseType`)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we need this block? We just have default values in other places.

@@ -200,6 +205,7 @@ Allows you to use comments to separate the members of arrays into logical groups
- `false` — Comments will not be used as delimiters.
- `string` — A regexp pattern to specify which comments should act as delimiters.
- `string[]` — A list of regexp patterns to specify which comments should act as delimiters.
- `{ block: BaseType; line: BaseType }` — Specify which block and line comments should act as delimiters.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's clear what BaseType means here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azat-io The idea is to tell that block and line can be string | string[] | boolean.

I felt that

`{ block: string | string[] | boolean; line: string | string[] | boolean }`

was a bit hard to read but we can do that if you feel that it's better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: partitionByComment support line and block
3 participants