Skip to content

Commit 5b70335

Browse files
authored
breaking: remove deprecated options (#382)
1 parent d1cfc0b commit 5b70335

File tree

4 files changed

+3
-37
lines changed

4 files changed

+3
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- (breaking) requires node version 14 or higher
77
- (breaking) Whether or not empty elements/components should self-close is now left to the user - in other words, if you write `<div />` or `<Component />` that stays as is, and so does `<div></div>`/`<Component></Component>`. If `svelteStrictMode` is turned on, it will still only allow `<div></div>` notation for elements (but it will leave your components alone)
88
- (breaking) `svelteAllowShorthand` now takes precedence over `svelteStrictMode`, which no longer has any effect on that behavior. Set `svelteAllowShorthand` to `false` to get back the v2 behavior
9+
- (breaking) remove deprecated `svelteSortOrder` options
910

1011
## 2.10.1
1112

src/options.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ export const options: Record<keyof PluginOptions, SupportOption> = {
4646
makeChoice('styles-markup-scripts-options'),
4747
makeChoice('styles-scripts-markup-options'),
4848
makeChoice('none'),
49-
// Deprecated, keep in 2.x for backwards-compatibility. svelte:options will be moved to the top
50-
makeChoice('scripts-markup-styles'),
51-
makeChoice('scripts-styles-markup'),
52-
makeChoice('markup-styles-scripts'),
53-
makeChoice('markup-scripts-styles'),
54-
makeChoice('styles-markup-scripts'),
55-
makeChoice('styles-scripts-markup'),
5649
],
5750
},
5851
svelteStrictMode: {
@@ -108,16 +101,7 @@ export type SortOrder =
108101
| 'markup-scripts-styles-options'
109102
| 'styles-markup-scripts-options'
110103
| 'styles-scripts-markup-options'
111-
| 'none'
112-
| DeprecatedSortOrder;
113-
114-
export type DeprecatedSortOrder =
115-
| 'scripts-markup-styles'
116-
| 'scripts-styles-markup'
117-
| 'markup-styles-scripts'
118-
| 'markup-scripts-styles'
119-
| 'styles-markup-scripts'
120-
| 'styles-scripts-markup';
104+
| 'none';
121105

122106
export type SortOrderPart = 'scripts' | 'markup' | 'styles' | 'options';
123107

@@ -133,10 +117,7 @@ export function parseSortOrder(
133117
const order = sortOrder.split(sortOrderSeparator) as SortOrderPart[];
134118
// For backwards compatibility: Add options to beginning if not present
135119
if (!order.includes('options')) {
136-
console.warn(
137-
'svelteSortOrder is missing option `options`. This will be an error in prettier-plugin-svelte version 3.',
138-
);
139-
order.unshift('options');
120+
throw new Error('svelteSortOrder is missing option `options`');
140121
}
141122
return order;
142123
}

test/printer/samples/sort-without-options-defaults-options-to-top.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/printer/samples/sort-without-options-defaults-options-to-top.options.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)