Skip to content

Commit 2f9d620

Browse files
hugop95azat-io
authored andcommitted
feat(sort-object)!: drop deprecated destructure only option
1 parent 24d1db9 commit 2f9d620

File tree

4 files changed

+1
-82
lines changed

4 files changed

+1
-82
lines changed

docs/content/rules/sort-objects.mdx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,6 @@ Specifies whether this rule should be applied to styled-components like librarie
299299
- `true` — Apply the rule to styled-components.
300300
- `false` — Disable the rule for styled-components.
301301

302-
### [DEPRECATED] destructureOnly
303-
304-
<sub>default: `false`</sub>
305-
306-
Use the [objectDeclarations](#objectdeclarations) and [destructuredObjects](#destructuredobjects) options instead.
307-
308-
Restricts sorting to objects that are part of a destructuring pattern. When set to `true`, the rule will apply sorting exclusively to destructured objects, leaving other object declarations unchanged.
309-
310302
### objectDeclarations
311303

312304
<sub>default: `true`</sub>

rules/sort-objects.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ let defaultOptions: Required<Options[number]> = {
7272
destructuredObjects: true,
7373
objectDeclarations: true,
7474
styledComponents: true,
75-
destructureOnly: false,
7675
useConfigurationIf: {},
7776
type: 'alphabetical',
7877
ignorePattern: [],
@@ -115,7 +114,7 @@ export default createEslintRule<Options, MessageId>({
115114
if (!options.destructuredObjects) {
116115
return
117116
}
118-
} else if (options.destructureOnly || !options.objectDeclarations) {
117+
} else if (!options.objectDeclarations) {
119118
return
120119
}
121120

@@ -429,11 +428,6 @@ export default createEslintRule<Options, MessageId>({
429428
callingFunctionNamePattern: regexJsonSchema,
430429
},
431430
}),
432-
destructureOnly: {
433-
description:
434-
'[DEPRECATED] Controls whether to sort only destructured objects.',
435-
type: 'boolean',
436-
},
437431
objectDeclarations: {
438432
description: 'Controls whether to sort object declarations.',
439433
type: 'boolean',

rules/sort-objects/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ export type Options = Partial<
110110
* @default true
111111
*/
112112
styledComponents: boolean
113-
114-
/**
115-
* @deprecated For {@link `destructuredObjects`} and
116-
* {@link `objectDeclarations`}. Will be removed in v5.0.0.
117-
*/
118-
destructureOnly: boolean
119113
} & CommonOptions
120114
>[]
121115

test/rules/sort-objects.test.ts

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8979,67 +8979,6 @@ describe('sort-objects', () => {
89798979
})
89808980
})
89818981

8982-
it('sorts only destructured objects when destructureOnly is enabled', async () => {
8983-
await valid({
8984-
code: dedent`
8985-
let obj = {
8986-
c: 'c',
8987-
b: 'b',
8988-
a: 'a',
8989-
}
8990-
8991-
let { a, b, c } = obj
8992-
`,
8993-
options: [
8994-
{
8995-
destructureOnly: true,
8996-
},
8997-
],
8998-
})
8999-
9000-
await invalid({
9001-
errors: [
9002-
{
9003-
data: {
9004-
right: 'b',
9005-
left: 'c',
9006-
},
9007-
messageId: 'unexpectedObjectsOrder',
9008-
},
9009-
{
9010-
data: {
9011-
right: 'a',
9012-
left: 'b',
9013-
},
9014-
messageId: 'unexpectedObjectsOrder',
9015-
},
9016-
],
9017-
output: dedent`
9018-
let obj = {
9019-
c: 'c',
9020-
b: 'b',
9021-
a: 'a',
9022-
}
9023-
9024-
let { a, b, c } = obj
9025-
`,
9026-
code: dedent`
9027-
let obj = {
9028-
c: 'c',
9029-
b: 'b',
9030-
a: 'a',
9031-
}
9032-
9033-
let { c, b, a } = obj
9034-
`,
9035-
options: [
9036-
{
9037-
destructureOnly: true,
9038-
},
9039-
],
9040-
})
9041-
})
9042-
90438982
it('skips object declarations when objectDeclarations is disabled', async () => {
90448983
await valid({
90458984
code: dedent`

0 commit comments

Comments
 (0)