Skip to content

Commit

Permalink
test: enable testing on .svelte files (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Dec 24, 2023
1 parent 188487b commit 0ea812c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .prettierrc
@@ -1,7 +1,11 @@
{
"arrowParens": "avoid",
"singleQuote": true,
"plugins": ["@prettier/plugin-pug", "prettier-plugin-pkg"],
"plugins": [
"@prettier/plugin-pug",
"prettier-plugin-pkg",
"prettier-plugin-svelte"
],
"overrides": [
{
"files": ".changeset/**/*",
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -93,6 +93,7 @@
"mocha": "^10.2.0",
"prettier": "^3.1.1",
"prettier-plugin-pkg": "^0.18.0",
"prettier-plugin-svelte": "^3.1.2",
"simple-git-hooks": "^2.9.0",
"svelte": "^4.2.8",
"vue-eslint-parser": "^9.3.2"
Expand Down
13 changes: 13 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions test/prettier.js
Expand Up @@ -283,20 +283,25 @@ runFixture('*.mdx', [
],
]);

/**
* @see https://github.com/sveltejs/svelte/blob/226bf419f9b9b5f1a6da33bd6403dd70afe58b52/packages/svelte/package.json#L73
*/
const svelteUnsupported = +process.versions.node.split('.')[0] < 16;

runFixture(
'eslint-plugin-svelte/*.svelte',
[
[
{
column: 5,
column: 1,
endColumn: 11,
endLine: 2,
fix: {
range: [13, 19],
text: 'name',
range: [9, 19],
text: ' let name',
},
line: 2,
message: 'Replace `·name·` with `name`',
message: 'Replace `let··name·` with `··let·name`',
messageId: 'replace',
nodeType: null,
ruleId: 'prettier/prettier',
Expand All @@ -319,16 +324,10 @@ runFixture(
},
],
],
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
true,
svelteUnsupported,
);

runFixture(
'eslint-plugin-svelte3/*.svelte',
[[], []],
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
true,
);
runFixture('eslint-plugin-svelte3/*.svelte', [[], []], svelteUnsupported);

/**
* The `script` code style actually does not match `prettier`'s,
Expand Down

0 comments on commit 0ea812c

Please sign in to comment.