@@ -9,9 +9,17 @@ import {
99 buildCustomGroupsArrayJsonSchema ,
1010 partitionByCommentJsonSchema ,
1111 partitionByNewLineJsonSchema ,
12+ newlinesBetweenJsonSchema ,
1213 commonJsonSchemas ,
1314 groupsJsonSchema ,
1415} from '../utils/common-json-schemas'
16+ import {
17+ MISSED_SPACING_ERROR ,
18+ EXTRA_SPACING_ERROR ,
19+ GROUP_ORDER_ERROR ,
20+ ORDER_ERROR ,
21+ } from '../utils/report-errors'
22+ import { validateNewlinesAndPartitionConfiguration } from '../utils/validate-newlines-and-partition-configuration'
1523import {
1624 singleCustomGroupJsonSchema ,
1725 allModifiers ,
@@ -23,7 +31,6 @@ import { validateCustomSortConfiguration } from '../utils/validate-custom-sort-c
2331import { generatePredefinedGroups } from '../utils/generate-predefined-groups'
2432import { getEslintDisabledLines } from '../utils/get-eslint-disabled-lines'
2533import { isNodeEslintDisabled } from '../utils/is-node-eslint-disabled'
26- import { GROUP_ORDER_ERROR , ORDER_ERROR } from '../utils/report-errors'
2734import { doesCustomGroupMatch } from '../utils/does-custom-group-match'
2835import { sortNodesByGroups } from '../utils/sort-nodes-by-groups'
2936import { createEslintRule } from '../utils/create-eslint-rule'
@@ -37,6 +44,8 @@ import { complete } from '../utils/complete'
3744
3845type MESSAGE_ID =
3946 | 'unexpectedNamedExportsGroupOrder'
47+ | 'missedSpacingBetweenNamedExports'
48+ | 'extraSpacingBetweenNamedExports'
4049 | 'unexpectedNamedExportsOrder'
4150
4251/**
@@ -49,6 +58,7 @@ let defaultOptions: Required<Options[0]> = {
4958 specialCharacters : 'keep' ,
5059 partitionByNewLine : false ,
5160 partitionByComment : false ,
61+ newlinesBetween : 'ignore' ,
5262 type : 'alphabetical' ,
5363 ignoreAlias : false ,
5464 groupKind : 'mixed' ,
@@ -75,6 +85,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
7585 selectors : allSelectors ,
7686 options,
7787 } )
88+ validateNewlinesAndPartitionConfiguration ( options )
7889
7990 let { sourceCode, id } = context
8091 let eslintDisabledLines = getEslintDisabledLines ( {
@@ -199,6 +210,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
199210
200211 reportAllErrors < MESSAGE_ID > ( {
201212 availableMessageIds : {
213+ missedSpacingBetweenMembers : 'missedSpacingBetweenNamedExports' ,
214+ extraSpacingBetweenMembers : 'extraSpacingBetweenNamedExports' ,
202215 unexpectedGroupOrder : 'unexpectedNamedExportsGroupOrder' ,
203216 unexpectedOrder : 'unexpectedNamedExportsOrder' ,
204217 } ,
@@ -230,6 +243,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
230243 } ) ,
231244 partitionByComment : partitionByCommentJsonSchema ,
232245 partitionByNewLine : partitionByNewLineJsonSchema ,
246+ newlinesBetween : newlinesBetweenJsonSchema ,
233247 groups : groupsJsonSchema ,
234248 } ,
235249 additionalProperties : false ,
@@ -238,15 +252,17 @@ export default createEslintRule<Options, MESSAGE_ID>({
238252 uniqueItems : true ,
239253 type : 'array' ,
240254 } ,
255+ messages : {
256+ missedSpacingBetweenNamedExports : MISSED_SPACING_ERROR ,
257+ extraSpacingBetweenNamedExports : EXTRA_SPACING_ERROR ,
258+ unexpectedNamedExportsGroupOrder : GROUP_ORDER_ERROR ,
259+ unexpectedNamedExportsOrder : ORDER_ERROR ,
260+ } ,
241261 docs : {
242262 url : 'https://perfectionist.dev/rules/sort-named-exports' ,
243263 description : 'Enforce sorted named exports.' ,
244264 recommended : true ,
245265 } ,
246- messages : {
247- unexpectedNamedExportsGroupOrder : GROUP_ORDER_ERROR ,
248- unexpectedNamedExportsOrder : ORDER_ERROR ,
249- } ,
250266 type : 'suggestion' ,
251267 fixable : 'code' ,
252268 } ,
0 commit comments