Skip to content

Commit 30614af

Browse files
authored
feat(object-property-newline)!: remove deprecated option (#809)
1 parent 3a6aff2 commit 30614af

5 files changed

Lines changed: 4 additions & 33 deletions

File tree

packages/eslint-plugin/rules/object-property-newline/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Another benefit of this rule is specificity of diffs when a property is changed:
8484

8585
### Optional Exception
8686

87-
The rule offers one object option, `allowAllPropertiesOnSameLine` (a deprecated synonym is `allowMultiplePropertiesPerLine`). If you set it to `true`, object literals such as the first two above, with all property specifications on the same line, will be permitted, but one like
87+
The rule offers one object option, `allowAllPropertiesOnSameLine`. If you set it to `true`, object literals such as the first two above, with all property specifications on the same line, will be permitted, but one like
8888

8989
```js
9090
const newObject = {

packages/eslint-plugin/rules/object-property-newline/object-property-newline._js_.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ run<RuleOptions, MessageIds>({
5353
{ code: 'var obj = {k1: [\'foo\', \'bar\'], k2: \'val1\', k3: \'val2\'};', options: [{ allowAllPropertiesOnSameLine: true }] },
5454
{ code: 'var obj = {\nk1: [\'foo\', \'bar\'], k2: \'val1\', k3: \'val2\'\n};', options: [{ allowAllPropertiesOnSameLine: true }] },
5555
{ code: 'var obj = {\nk1: \'val1\', k2: {e1: \'foo\', e2: \'bar\'}, k3: \'val2\'\n};', options: [{ allowAllPropertiesOnSameLine: true }] },
56-
57-
// allowMultiplePropertiesPerLine: true (deprecated)
58-
{ code: 'var obj = { k1: \'val1\', k2: \'val2\', k3: \'val3\' };', options: [{ allowMultiplePropertiesPerLine: true }] },
5956
],
6057

6158
invalid: [
@@ -643,22 +640,5 @@ run<RuleOptions, MessageIds>({
643640
},
644641
],
645642
},
646-
647-
// allowMultiplePropertiesPerLine: true (deprecated)
648-
{
649-
code: 'var obj = {\nk1: \'val1\',\nk2: \'val2\', k3: \'val3\'\n};',
650-
output: 'var obj = {\nk1: \'val1\',\nk2: \'val2\',\nk3: \'val3\'\n};',
651-
options: [{ allowMultiplePropertiesPerLine: true }],
652-
errors: [
653-
{
654-
messageId: 'propertiesOnNewlineAll',
655-
type: 'ObjectExpression',
656-
line: 3,
657-
column: 13,
658-
endLine: 3,
659-
endColumn: 15,
660-
},
661-
],
662-
},
663643
],
664644
})

packages/eslint-plugin/rules/object-property-newline/object-property-newline._ts_.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ function createValidRule(input: string[], option: boolean) {
1616
return Object.entries(prefixOfNodes).flatMap(([_, prefix]) => {
1717
const res: ValidTestCase<RuleOptions>[] = [
1818
{ code: `${prefix}${code}`, options: [{ allowAllPropertiesOnSameLine: option }] },
19-
{ code: `${prefix}${code}`, options: [{ /* deprecated */ allowMultiplePropertiesPerLine: option }] },
2019
]
2120
if (!option)
2221
res.push({ code: `${prefix}${code}` })
@@ -38,7 +37,6 @@ function createInvalidRule(input: string[], out: string[], err: TestCaseError<Me
3837

3938
const res: InvalidTestCase<RuleOptions, MessageIds>[] = [
4039
{ code: `${prefix}${code}`, output: `${prefix}${output}`, errors, options: [{ allowAllPropertiesOnSameLine: option }] },
41-
{ code: `${prefix}${code}`, output: `${prefix}${output}`, errors, options: [{ /* deprecated */ allowMultiplePropertiesPerLine: option }] },
4240
]
4341
if (!option)
4442
res.push({ code: `${prefix}${code}`, output: `${prefix}${output}`, errors })

packages/eslint-plugin/rules/object-property-newline/object-property-newline.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ export default createRule<RuleOptions, MessageIds>({
1717
type: 'boolean',
1818
default: false,
1919
},
20-
allowMultiplePropertiesPerLine: { // Deprecated
21-
type: 'boolean',
22-
default: false,
23-
},
2420
},
2521
additionalProperties: false,
2622
},
@@ -34,14 +30,12 @@ export default createRule<RuleOptions, MessageIds>({
3430
defaultOptions: [
3531
{
3632
allowAllPropertiesOnSameLine: false,
37-
allowMultiplePropertiesPerLine: false,
3833
},
3934
],
4035

4136
create(context) {
42-
const allowSameLine = context.options[0] && (
43-
(context.options[0].allowAllPropertiesOnSameLine || context.options[0].allowMultiplePropertiesPerLine /* Deprecated */)
44-
)
37+
const allowSameLine = context.options[0] && (context.options[0].allowAllPropertiesOnSameLine)
38+
4539
const messageId = allowSameLine
4640
? 'propertiesOnNewlineAll'
4741
: 'propertiesOnNewline'

packages/eslint-plugin/rules/object-property-newline/types.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/* GENERATED, DO NOT EDIT DIRECTLY */
22

3-
/* @checksum: 5Mb8fSzqK56KnzBecs-OMMnNTvsiNJ4SHgS3e2dzAPY */
3+
/* @checksum: soIHpiM5cFCk368MarW27c-YxxnV_-4kK7HlPO1MR1A */
44

55
export interface ObjectPropertyNewlineSchema0 {
66
allowAllPropertiesOnSameLine?: boolean
7-
allowMultiplePropertiesPerLine?: boolean
87
}
98

109
export type ObjectPropertyNewlineRuleOptions = [

0 commit comments

Comments
 (0)