Skip to content

Commit 98404bf

Browse files
authored
feat(sort-imports)!: drop deprecated selectors
1 parent 513d13e commit 98404bf

File tree

4 files changed

+99
-413
lines changed

4 files changed

+99
-413
lines changed

rules/sort-imports.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import { singleCustomGroupJsonSchema } from './sort-imports/types'
4545
import { sortNodesByGroups } from '../utils/sort-nodes-by-groups'
4646
import { allModifiers, allSelectors } from './sort-imports/types'
4747
import { createEslintRule } from '../utils/create-eslint-rule'
48-
import { allDeprecatedSelectors } from './sort-imports/types'
4948
import { reportAllErrors } from '../utils/report-all-errors'
5049
import { shouldPartition } from '../utils/should-partition'
5150
import { computeGroup } from '../utils/compute-group'
@@ -105,7 +104,7 @@ export default createEslintRule<Options, MessageId>({
105104
)
106105

107106
validateGeneratedGroupsConfiguration({
108-
selectors: [...allSelectors, ...allDeprecatedSelectors],
107+
selectors: allSelectors,
109108
modifiers: allModifiers,
110109
options,
111110
})
@@ -160,14 +159,6 @@ export default createEslintRule<Options, MessageId>({
160159
let group: Group | null = null
161160

162161
if (node.type !== 'VariableDeclaration' && node.importKind === 'type') {
163-
if (node.type === 'ImportDeclaration') {
164-
for (let selector of commonSelectors) {
165-
if (selector !== 'subpath' && selector !== 'tsconfig-path') {
166-
selectors.push(`${selector}-type`)
167-
}
168-
}
169-
}
170-
171162
selectors.push('type')
172163
modifiers.push('type')
173164
}

rules/sort-imports/types.ts

Lines changed: 19 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -140,32 +140,6 @@ export type Options = Partial<{
140140
alphabet: string
141141
}>[]
142142

143-
/**
144-
* Union type of all available import selectors. Used to categorize different
145-
* types of import statements.
146-
*/
147-
export type Selector =
148-
| SideEffectStyleSelector
149-
| InternalTypeSelector
150-
| ExternalTypeSelector
151-
| TsconfigPathSelector
152-
| SiblingTypeSelector
153-
| BuiltinTypeSelector
154-
| SideEffectSelector
155-
| ParentTypeSelector
156-
| IndexTypeSelector
157-
| ExternalSelector
158-
| InternalSelector
159-
| BuiltinSelector
160-
| SiblingSelector
161-
| SubpathSelector
162-
| ImportSelector
163-
| ObjectSelector
164-
| ParentSelector
165-
| IndexSelector
166-
| StyleSelector
167-
| TypeSelector
168-
169143
/**
170144
* Defines a custom group for import categorization.
171145
*
@@ -193,6 +167,25 @@ export type SingleCustomGroup = {
193167
elementNamePattern?: RegexOption
194168
}
195169

170+
/**
171+
* Union type of all available import selectors. Used to categorize different
172+
* types of import statements.
173+
*/
174+
export type Selector =
175+
| SideEffectStyleSelector
176+
| TsconfigPathSelector
177+
| SideEffectSelector
178+
| ExternalSelector
179+
| InternalSelector
180+
| BuiltinSelector
181+
| SiblingSelector
182+
| SubpathSelector
183+
| ImportSelector
184+
| ParentSelector
185+
| IndexSelector
186+
| StyleSelector
187+
| TypeSelector
188+
196189
/**
197190
* Represents a sorting node for an import statement. Extends the base sorting
198191
* node with dependency information and ignore flag.
@@ -236,12 +229,6 @@ type TypeGroup = JoinWithDash<[TypeModifier, Selector]>
236229
/** Selector for side-effect imports that are style files (CSS, SCSS, etc.). */
237230
type SideEffectStyleSelector = 'side-effect-style'
238231

239-
/** @deprecated Since v4.12.0. Will be removed in v5.0.0. */
240-
type InternalTypeSelector = 'internal-type'
241-
242-
/** @deprecated Since v4.12.0. Will be removed in v5.0.0. */
243-
type ExternalTypeSelector = 'external-type'
244-
245232
/** Selector for imports using TypeScript path aliases defined in tsconfig.json. */
246233
type TsconfigPathSelector = 'tsconfig-path'
247234

@@ -251,27 +238,15 @@ type TsconfigPathSelector = 'tsconfig-path'
251238
*/
252239
type ValueGroup = JoinWithDash<[Selector]>
253240

254-
/** @deprecated Since v4.12.0. Will be removed in v5.0.0. */
255-
type SiblingTypeSelector = 'sibling-type'
256-
257-
/** @deprecated Since v4.12.0. Will be removed in v5.0.0. */
258-
type BuiltinTypeSelector = 'builtin-type'
259-
260241
/** Selector for side-effect imports (imports without bindings). */
261242
type SideEffectSelector = 'side-effect'
262243

263-
/** @deprecated Since v4.12.0. Will be removed in v5.0.0. */
264-
type ParentTypeSelector = 'parent-type'
265-
266244
/** Modifier for side-effect imports. */
267245
type SideEffectModifier = 'side-effect'
268246

269247
/** Modifier for single-line imports. */
270248
type SinglelineModifier = 'singleline'
271249

272-
/** @deprecated Since v4.12.0. Will be removed in v5.0.0. */
273-
type IndexTypeSelector = 'index-type'
274-
275250
/** Modifier for multiline imports. */
276251
type MultilineModifier = 'multiline'
277252

@@ -308,9 +283,6 @@ type RequireModifier = 'require'
308283
/** Selector for parent module imports (from parent directories). */
309284
type ParentSelector = 'parent'
310285

311-
/** @deprecated This selector is never matched. Will be removed in v5.0.0. */
312-
type ObjectSelector = 'object'
313-
314286
/** Base selector for all import statements. */
315287
type ImportSelector = 'import'
316288

@@ -352,22 +324,6 @@ export let allSelectors: Selector[] = [
352324
'type',
353325
]
354326

355-
/**
356-
* List of deprecated import selectors. Maintained for backward compatibility
357-
* but should not be used in new configurations.
358-
*
359-
* Will be removed in v5.0.0.
360-
*/
361-
export let allDeprecatedSelectors: Selector[] = [
362-
'internal-type',
363-
'external-type',
364-
'sibling-type',
365-
'builtin-type',
366-
'parent-type',
367-
'index-type',
368-
'object',
369-
]
370-
371327
/**
372328
* Complete list of available import modifiers. Used for validation and JSON
373329
* schema generation.

rules/sort-object-types/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ export type Options = Partial<
5757
hasNumericKeysOnly?: boolean
5858
}
5959

60-
/**
61-
* Custom groups for organizing object type members. Can be a structured
62-
* configuration or the deprecated format.
63-
*/
60+
/** Custom groups for organizing object type members. */
6461
customGroups: CustomGroupsOption<
6562
SingleCustomGroup,
6663
{

0 commit comments

Comments
 (0)