Skip to content

Commit dd1f012

Browse files
committed
chore: add privateImportsFeatureFlag option to order rule
1 parent 31854ca commit dd1f012

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/rules/order.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,7 @@ export interface Options {
11511151
pathGroups?: PathGroup[]
11521152
sortTypesGroup?: boolean
11531153
warnOnUnassignedImports?: boolean
1154+
privateImportsFeatureFlag?: boolean
11541155
}
11551156

11561157
type MessageId =
@@ -1273,6 +1274,10 @@ export default createRule<[Options?], MessageId>({
12731274
type: 'boolean',
12741275
default: false,
12751276
},
1277+
privateImportsFeatureFlag: {
1278+
type: 'boolean',
1279+
default: false,
1280+
},
12761281
},
12771282
additionalProperties: false,
12781283
dependencies: {
@@ -1391,7 +1396,10 @@ export default createRule<[Options?], MessageId>({
13911396
options.pathGroups || [],
13921397
)
13931398
const { groups, omittedTypes } = convertGroupsToRanks(
1394-
options.groups || defaultGroups,
1399+
options.groups ||
1400+
(options.privateImportsFeatureFlag
1401+
? defaultGroups
1402+
: defaultGroups.slice(1)),
13951403
)
13961404
ranks = {
13971405
groups,

test/rules/order.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4818,6 +4818,11 @@ import { localA } from "./a";
48184818
console.log({ internA, scopeA, localA });
48194819
`,
48204820
...parserConfig,
4821+
options: [
4822+
{
4823+
privateImportsFeatureFlag: true,
4824+
},
4825+
],
48214826
}),
48224827
],
48234828
invalid: [

0 commit comments

Comments
 (0)