diff --git a/docs/content/rules/sort-classes.mdx b/docs/content/rules/sort-classes.mdx index 7dc03378e..7976cec2b 100644 --- a/docs/content/rules/sort-classes.mdx +++ b/docs/content/rules/sort-classes.mdx @@ -266,6 +266,10 @@ Specifies how new lines should be handled between class member groups. - `always` — Enforce one new line between each group, and forbid new lines inside a group. - `never` — No new lines are allowed in object types. +You can also enforce the newline behavior between two specific groups through the `groups` options. + +See the [`groups`](#newlines-between-groups) option. + This option is only applicable when `partitionByNewLine` is `false`. ### ignoreCallbackDependenciesPatterns @@ -556,6 +560,25 @@ abstract class Example extends BaseExample { } ``` +#### Newlines between groups + +You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups. + +See the [`newlinesBetween`](#newlinesbetween) option. + +This feature is only applicable when `partitionByNewLine` is false. + +```ts +{ + newlinesBetween: 'always', + groups: [ + 'a', + { newlinesBetween: 'never' }, // Overrides the global newlinesBetween option + 'b', + ] +} +``` + ### customGroups diff --git a/docs/content/rules/sort-interfaces.mdx b/docs/content/rules/sort-interfaces.mdx index 3448d2c7b..467dde9af 100644 --- a/docs/content/rules/sort-interfaces.mdx +++ b/docs/content/rules/sort-interfaces.mdx @@ -248,6 +248,10 @@ Specifies how new lines should be handled between interface groups. - `always` — Enforce one new line between each group, and forbid new lines inside a group. - `never` — No new lines are allowed between interface members. +You can also enforce the newline behavior between two specific groups through the `groups` options. + +See the [`groups`](#newlines-between-groups) option. + This option is only applicable when `partitionByNewLine` is `false`. ### [DEPRECATED] groupKind @@ -433,6 +437,25 @@ interface Interface { method(): string ``` +#### Newlines between groups + +You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups. + +See the [`newlinesBetween`](#newlinesbetween) option. + +This feature is only applicable when `partitionByNewLine` is false. + +```ts +{ + newlinesBetween: 'always', + groups: [ + 'a', + { newlinesBetween: 'never' }, // Overrides the global newlinesBetween option + 'b', + ] +} +``` + ### customGroups diff --git a/docs/content/rules/sort-intersection-types.mdx b/docs/content/rules/sort-intersection-types.mdx index ae214ff62..3b518f3a2 100644 --- a/docs/content/rules/sort-intersection-types.mdx +++ b/docs/content/rules/sort-intersection-types.mdx @@ -176,6 +176,10 @@ Specifies how new lines should be handled between intersection type groups. - `always` — Enforce one new line between each group, and forbid new lines inside a group. - `never` — No new lines are allowed in intersection types. +You can also enforce the newline behavior between two specific groups through the `groups` options. + +See the [`groups`](#newlines-between-groups) option. + This option is only applicable when `partitionByNewLine` is `false`. ### groups @@ -296,6 +300,25 @@ type Example = } ``` +#### Newlines between groups + +You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups. + +See the [`newlinesBetween`](#newlinesbetween) option. + +This feature is only applicable when `partitionByNewLine` is false. + +```ts +{ + newlinesBetween: 'always', + groups: [ + 'a', + { newlinesBetween: 'never' }, // Overrides the global newlinesBetween option + 'b', + ] +} +``` + ## Usage