Skip to content

Commit 0ea812c

Browse files
authored
test: enable testing on .svelte files (#628)
1 parent 188487b commit 0ea812c

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

.prettierrc

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"arrowParens": "avoid",
33
"singleQuote": true,
4-
"plugins": ["@prettier/plugin-pug", "prettier-plugin-pkg"],
4+
"plugins": [
5+
"@prettier/plugin-pug",
6+
"prettier-plugin-pkg",
7+
"prettier-plugin-svelte"
8+
],
59
"overrides": [
610
{
711
"files": ".changeset/**/*",

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"mocha": "^10.2.0",
9494
"prettier": "^3.1.1",
9595
"prettier-plugin-pkg": "^0.18.0",
96+
"prettier-plugin-svelte": "^3.1.2",
9697
"simple-git-hooks": "^2.9.0",
9798
"svelte": "^4.2.8",
9899
"vue-eslint-parser": "^9.3.2"

pnpm-lock.yaml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/prettier.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -283,20 +283,25 @@ runFixture('*.mdx', [
283283
],
284284
]);
285285

286+
/**
287+
* @see https://github.com/sveltejs/svelte/blob/226bf419f9b9b5f1a6da33bd6403dd70afe58b52/packages/svelte/package.json#L73
288+
*/
289+
const svelteUnsupported = +process.versions.node.split('.')[0] < 16;
290+
286291
runFixture(
287292
'eslint-plugin-svelte/*.svelte',
288293
[
289294
[
290295
{
291-
column: 5,
296+
column: 1,
292297
endColumn: 11,
293298
endLine: 2,
294299
fix: {
295-
range: [13, 19],
296-
text: 'name',
300+
range: [9, 19],
301+
text: ' let name',
297302
},
298303
line: 2,
299-
message: 'Replace `·name·` with `name`',
304+
message: 'Replace `let··name·` with `··let·name`',
300305
messageId: 'replace',
301306
nodeType: null,
302307
ruleId: 'prettier/prettier',
@@ -319,16 +324,10 @@ runFixture(
319324
},
320325
],
321326
],
322-
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
323-
true,
327+
svelteUnsupported,
324328
);
325329

326-
runFixture(
327-
'eslint-plugin-svelte3/*.svelte',
328-
[[], []],
329-
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
330-
true,
331-
);
330+
runFixture('eslint-plugin-svelte3/*.svelte', [[], []], svelteUnsupported);
332331

333332
/**
334333
* The `script` code style actually does not match `prettier`'s,

0 commit comments

Comments
 (0)