Skip to content

Commit aecd47e

Browse files
authored
chore: upgrade prettier to 3.1 (#10134)
1 parent 2e9e8e8 commit aecd47e

File tree

31 files changed

+130
-133
lines changed

31 files changed

+130
-133
lines changed

documentation/examples/20-7guis/05-7guis-crud/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
? people.filter((person) => {
1717
const name = `${person.last}, ${person.first}`;
1818
return name.toLowerCase().startsWith(prefix.toLowerCase());
19-
})
19+
})
2020
: people;
2121
2222
$: selected = filteredPeople[i];

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"build:sites": "pnpm -r --filter=./sites/* build",
1919
"preview-site": "npm run build --prefix sites/svelte-5-preview",
2020
"check": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r check",
21-
"format": "prettier --write --plugin prettier-plugin-svelte .",
22-
"lint": "prettier --check --plugin prettier-plugin-svelte . && eslint ./",
21+
"format": "prettier --write .",
22+
"lint": "prettier --check . && eslint ./",
2323
"test": "vitest run --coverage",
2424
"test-output": "vitest run --reporter=json --outputFile=sites/svelte-5-preview/src/routes/status/results.json",
2525
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
@@ -38,8 +38,8 @@
3838
"eslint-plugin-lube": "^0.1.7",
3939
"jsdom": "22.0.0",
4040
"playwright": "^1.35.1",
41-
"prettier": "^3.0.1",
42-
"prettier-plugin-svelte": "^3.0.3",
41+
"prettier": "^3.1.1",
42+
"prettier-plugin-svelte": "^3.1.2",
4343
"typescript": "^5.2.2",
4444
"vitest": "^0.34.6"
4545
}

packages/svelte/src/compiler/errors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ const attributes = {
234234
type === 'no-each'
235235
? `An element that uses the animate directive must be the immediate child of a keyed each block`
236236
: type === 'each-key'
237-
? `An element that uses the animate directive must be used inside a keyed each block. Did you forget to add a key to your each block?`
238-
: `An element that uses the animate directive must be the sole child of a keyed each block`,
237+
? `An element that uses the animate directive must be used inside a keyed each block. Did you forget to add a key to your each block?`
238+
: `An element that uses the animate directive must be the sole child of a keyed each block`,
239239
'duplicate-animation': () => `An element can only have one 'animate' directive`,
240240
/** @param {string[] | undefined} [modifiers] */
241241
'invalid-event-modifier': (modifiers) =>
@@ -262,7 +262,7 @@ const attributes = {
262262
? `An element can only have one '${directive1}' directive`
263263
: `An element cannot have both ${describe(directive1)} directive and ${describe(
264264
directive2
265-
)} directive`;
265+
)} directive`;
266266
},
267267
'invalid-let-directive-placement': () => 'let directive at invalid position'
268268
};

packages/svelte/src/compiler/legacy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function convert(source, ast) {
108108
// @ts-ignore
109109
delete node.parent;
110110
}
111-
})
111+
})
112112
: undefined
113113
};
114114
},

packages/svelte/src/compiler/phases/1-parse/state/element.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ export default function tag(parser) {
108108
const type = meta_tags.has(name)
109109
? meta_tags.get(name)
110110
: regex_capital_letter.test(name[0]) || name === 'svelte:self' || name === 'svelte:component'
111-
? 'Component'
112-
: name === 'title' && parent_is_head(parser.stack)
113-
? 'TitleElement'
114-
: name === 'slot'
115-
? 'SlotElement'
116-
: 'RegularElement';
111+
? 'Component'
112+
: name === 'title' && parent_is_head(parser.stack)
113+
? 'TitleElement'
114+
: name === 'slot'
115+
? 'SlotElement'
116+
: 'RegularElement';
117117

118118
/** @type {import('#compiler').ElementLike} */
119119
// @ts-expect-error TODO can't figure out this error
@@ -132,7 +132,7 @@ export default function tag(parser) {
132132
can_delegate_events: null
133133
},
134134
parent: null
135-
}
135+
}
136136
: {
137137
type: /** @type {import('#compiler').ElementLike['type']} */ (type),
138138
start,
@@ -141,7 +141,7 @@ export default function tag(parser) {
141141
attributes: [],
142142
fragment: create_fragment(true),
143143
parent: null
144-
};
144+
};
145145

146146
parser.allow_whitespace();
147147

packages/svelte/src/compiler/phases/1-parse/utils/mapped_code.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export function combine_sourcemaps(filename, sourcemap_list) {
275275
sourcemap_list,
276276
() => null,
277277
true // skip optional field `sourcesContent`
278-
)
278+
)
279279
: remapping(
280280
// use loader interface
281281
sourcemap_list[0], // last map
@@ -291,7 +291,7 @@ export function combine_sourcemaps(filename, sourcemap_list) {
291291
}
292292
),
293293
true
294-
);
294+
);
295295

296296
if (!map.file) delete map.file; // skip optional field `file`
297297

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -713,12 +713,12 @@ const runes_scope_tweaker = {
713713
rune === '$state'
714714
? 'state'
715715
: rune === '$state.frozen'
716-
? 'frozen_state'
717-
: rune === '$derived'
718-
? 'derived'
719-
: path.is_rest
720-
? 'rest_prop'
721-
: 'prop';
716+
? 'frozen_state'
717+
: rune === '$derived'
718+
? 'derived'
719+
: path.is_rest
720+
? 'rest_prop'
721+
: 'prop';
722722
}
723723

724724
if (rune === '$props') {

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export function client_component(source, analysis, options) {
201201
b.call('$.validate_store', store_reference, b.literal(name.slice(1))),
202202
store_get
203203
])
204-
)
204+
)
205205
: b.thunk(store_get)
206206
)
207207
);

packages/svelte/src/compiler/phases/3-transform/client/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ export function get_assignment_value(node, { state, visit }) {
2020
return operator === '='
2121
? /** @type {import('estree').Expression} */ (visit(node.right))
2222
: // turn something like x += 1 into x = x + 1
23-
b.binary(
23+
b.binary(
2424
/** @type {import('estree').BinaryOperator} */ (operator.slice(0, -1)),
2525
serialize_get_binding(node.left, state),
2626
/** @type {import('estree').Expression} */ (visit(node.right))
27-
);
27+
);
2828
} else if (
2929
node.left.type === 'MemberExpression' &&
3030
node.left.object.type === 'ThisExpression' &&
@@ -35,11 +35,11 @@ export function get_assignment_value(node, { state, visit }) {
3535
return operator === '='
3636
? /** @type {import('estree').Expression} */ (visit(node.right))
3737
: // turn something like x += 1 into x = x + 1
38-
b.binary(
38+
b.binary(
3939
/** @type {import('estree').BinaryOperator} */ (operator.slice(0, -1)),
4040
/** @type {import('estree').Expression} */ (visit(node.left)),
4141
/** @type {import('estree').Expression} */ (visit(node.right))
42-
);
42+
);
4343
} else {
4444
return /** @type {import('estree').Expression} */ (visit(node.right));
4545
}

packages/svelte/src/compiler/phases/3-transform/client/visitors/javascript-runes.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ export const javascript_visitors_runes = {
8787
field.kind === 'state'
8888
? b.call('$.source', should_proxy_or_freeze(init) ? b.call('$.proxy', init) : init)
8989
: field.kind === 'frozen_state'
90-
? b.call('$.source', should_proxy_or_freeze(init) ? b.call('$.freeze', init) : init)
91-
: b.call('$.derived', b.thunk(init));
90+
? b.call(
91+
'$.source',
92+
should_proxy_or_freeze(init) ? b.call('$.freeze', init) : init
93+
)
94+
: b.call('$.derived', b.thunk(init));
9295
} else {
9396
// if no arguments, we know it's state as `$derived()` is a compile error
9497
value = b.call('$.source');

0 commit comments

Comments
 (0)