Error: unknown node type: Script
Trying to add Prettier to my project: https://github.com/hrishikesh-k/blog. Running npx prettier . --write fails with the above error. Here's the entire output:
Terminal output
npx prettier . --write
package-lock.json 285ms (unchanged)
package.json 2ms (unchanged)
packages/adapter/index.ts 549ms (unchanged)
packages/adapter/package.json 2ms (unchanged)
packages/adapter/tsconfig.json 3ms (unchanged)
packages/archive/index.ts 31ms (unchanged)
packages/archive/package.json 1ms (unchanged)
packages/archive/tsconfig.json 4ms (unchanged)
packages/cache/index.ts 28ms (unchanged)
packages/cache/package.json 2ms (unchanged)
packages/cache/tsconfig.json 3ms (unchanged)
packages/image/index.ts 24ms (unchanged)
packages/image/package.json 2ms (unchanged)
packages/image/tsconfig.json 3ms (unchanged)
packages/site/deno/image.ts 21ms (unchanged)
packages/site/package.json 2ms (unchanged)
packages/site/postcss.config.js 18ms (unchanged)
packages/site/src/app.d.ts 17ms (unchanged)
packages/site/src/app.html 34ms (unchanged)
packages/site/src/components/c-button.svelte{
"type": "Script",
"start": 0,
"end": 4615,
"context": "default",
"content": {
"type": "Program",
"start": 4604,
"end": 4606,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4606
}
},
"body": [
{
"type": "BlockStatement",
"start": 4604,
"end": 4606,
"loc": {
"start": {
"line": 1,
"column": 4604
},
"end": {
"line": 1,
"column": 4606
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/components/c-button.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/components/c-icon.svelte{
"type": "Script",
"start": 0,
"end": 363,
"context": "default",
"content": {
"type": "Program",
"start": 352,
"end": 354,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 354
}
},
"body": [
{
"type": "BlockStatement",
"start": 352,
"end": 354,
"loc": {
"start": {
"line": 1,
"column": 352
},
"end": {
"line": 1,
"column": 354
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/components/c-icon.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/components/c-notion-code.svelte{
"type": "Script",
"start": 0,
"end": 419,
"context": "default",
"content": {
"type": "Program",
"start": 408,
"end": 410,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 410
}
},
"body": [
{
"type": "BlockStatement",
"start": 408,
"end": 410,
"loc": {
"start": {
"line": 1,
"column": 408
},
"end": {
"line": 1,
"column": 410
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/components/c-notion-code.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/components/c-notion-image.svelte{
"type": "Script",
"start": 0,
"end": 799,
"context": "default",
"content": {
"type": "Program",
"start": 788,
"end": 790,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 790
}
},
"body": [
{
"type": "BlockStatement",
"start": 788,
"end": 790,
"loc": {
"start": {
"line": 1,
"column": 788
},
"end": {
"line": 1,
"column": 790
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/components/c-notion-image.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/components/c-tooltip.svelte{
"type": "Script",
"start": 0,
"end": 963,
"context": "default",
"content": {
"type": "Program",
"start": 952,
"end": 954,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 954
}
},
"body": [
{
"type": "BlockStatement",
"start": 952,
"end": 954,
"loc": {
"start": {
"line": 1,
"column": 952
},
"end": {
"line": 1,
"column": 954
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/components/c-tooltip.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/lib/constants.ts 14ms (unchanged)
packages/site/src/lib/functions.ts 19ms (unchanged)
packages/site/src/lib/server/constants.ts 36ms (unchanged)
packages/site/src/lib/server/functions.ts 37ms
packages/site/src/lib/types.ts 38ms (unchanged)
packages/site/src/partials/p-animation/p-animation.svelte{
"type": "Script",
"start": 0,
"end": 29087,
"context": "default",
"content": {
"type": "Program",
"start": 29076,
"end": 29078,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29078
}
},
"body": [
{
"type": "BlockStatement",
"start": 29076,
"end": 29078,
"loc": {
"start": {
"line": 1,
"column": 29076
},
"end": {
"line": 1,
"column": 29078
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/partials/p-animation/p-animation.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/partials/p-animation/p-svg-group.svelte{
"type": "Script",
"start": 0,
"end": 423,
"context": "default",
"content": {
"type": "Program",
"start": 412,
"end": 414,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 414
}
},
"body": [
{
"type": "BlockStatement",
"start": 412,
"end": 414,
"loc": {
"start": {
"line": 1,
"column": 412
},
"end": {
"line": 1,
"column": 414
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/partials/p-animation/p-svg-group.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/partials/p-header.svelte{
"type": "Script",
"start": 0,
"end": 327,
"context": "default",
"content": {
"type": "Program",
"start": 316,
"end": 318,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 318
}
},
"body": [
{
"type": "BlockStatement",
"start": 316,
"end": 318,
"loc": {
"start": {
"line": 1,
"column": 316
},
"end": {
"line": 1,
"column": 318
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/partials/p-header.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/routes/+layout.svelte{
"type": "Script",
"start": 0,
"end": 407,
"context": "default",
"content": {
"type": "Program",
"start": 396,
"end": 398,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 398
}
},
"body": [
{
"type": "BlockStatement",
"start": 396,
"end": 398,
"loc": {
"start": {
"line": 1,
"column": 396
},
"end": {
"line": 1,
"column": 398
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/routes/+layout.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/routes/+layout.ts 11ms (unchanged)
packages/site/src/routes/+page.svelte{
"type": "Script",
"start": 0,
"end": 283,
"context": "default",
"content": {
"type": "Program",
"start": 272,
"end": 274,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 274
}
},
"body": [
{
"type": "BlockStatement",
"start": 272,
"end": 274,
"loc": {
"start": {
"line": 1,
"column": 272
},
"end": {
"line": 1,
"column": 274
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/routes/+page.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/routes/about/+page.svelte 14ms (unchanged)
packages/site/src/routes/posts/[id]/[[slug]]/+page.server.ts 77ms (unchanged)
packages/site/src/routes/posts/[id]/[[slug]]/+page.svelte{
"type": "Script",
"start": 0,
"end": 279,
"context": "default",
"content": {
"type": "Program",
"start": 268,
"end": 270,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 270
}
},
"body": [
{
"type": "BlockStatement",
"start": 268,
"end": 270,
"loc": {
"start": {
"line": 1,
"column": 268
},
"end": {
"line": 1,
"column": 270
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/routes/posts/[id]/[[slug]]/+page.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/routes/posts/+page.server.ts 24ms (unchanged)
packages/site/src/routes/posts/+page.svelte{
"type": "Script",
"start": 0,
"end": 147,
"context": "default",
"content": {
"type": "Program",
"start": 136,
"end": 138,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 138
}
},
"body": [
{
"type": "BlockStatement",
"start": 136,
"end": 138,
"loc": {
"start": {
"line": 1,
"column": 136
},
"end": {
"line": 1,
"column": 138
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] packages/site/src/routes/posts/+page.svelte: Error: unknown node type: Script
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
[error] at mainPrintInternal (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20854:18)
[error] at mainPrint (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20837:14)
[error] at AstPath.call (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:19316:14)
[error] at printTopLevelParts (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at Object.print (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:59544)
[error] at callPluginPrintFunction (file:///home/hrishikesh/projects/ntl-blog/node_modules/prettier/index.mjs:20871:20)
packages/site/src/tailwind.css 33ms (unchanged)
packages/site/svelte.config.js 13ms (unchanged)
packages/site/tailwind.config.ts 55ms (unchanged)
packages/site/tsconfig.json 3ms (unchanged)
packages/site/vite.config.ts 9ms (unchanged)
packages/utils/index.ts 16ms (unchanged)
packages/utils/package.json 2ms (unchanged)
packages/utils/tsconfig.json 2ms (unchanged)
prettier.config.js 6ms (unchanged)
turbo.json 4ms (unchanged)
I'm using Node.js 20 in Ubuntu 24.04 (WSL).
Trying to add Prettier to my project: https://github.com/hrishikesh-k/blog. Running
npx prettier . --writefails with the above error. Here's the entire output:Terminal output I'm using Node.js 20 in Ubuntu 24.04 (WSL).
Just had this issue, refer to the documentselectors setting in the readme and it works after.
this is a regression, however, and this is a workaround not a solution
I could be wrong, but documentselectors looks to be VSCode-spcific. Forgot to mention that I'm not using VSCode but WebStorm.
Yeah i just worked around it I’m not sure where the equivalent prettierrc setting is
On Tue, 6 Aug 2024 at 9:41 AM Hrishikesh Kokate @.***> wrote:
I could be wrong, but documentselectors looks to be VSCode-spcific. Forgot to mention that I'm not using VSCode but WebStorm.
— Reply to this email directly, view it on GitHub https://github.com/sveltejs/prettier-plugin-svelte/issues/456#issuecomment-2270500702, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFY5BLLZQS7QHSOX4NKEW3ZQBV27AVCNFSM6AAAAABL664XKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQGUYDANZQGI . You are receiving this because you commented.Message ID: @.***>
Not sure what’s wrong it stopped working now, 3.2.5 works fine
On Tue, 6 Aug 2024 at 9:41 AM Hrishikesh Kokate @.***> wrote:
I could be wrong, but documentselectors looks to be VSCode-spcific. Forgot to mention that I'm not using VSCode but WebStorm.
— Reply to this email directly, view it on GitHub https://github.com/sveltejs/prettier-plugin-svelte/issues/456#issuecomment-2270500702, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFY5BLLZQS7QHSOX4NKEW3ZQBV27AVCNFSM6AAAAABL664XKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQGUYDANZQGI . You are receiving this because you commented.Message ID: @.***>
I tried downgrading to 3.0.3, but it's still broken for me.
This has something to do with prettier-plugin-tailwindcss, if I remove it, it works
Pretty sure it's coming from this plugin itself, at least in my case. I tried to comment out the Tailwind plugin stuff, but I continue to get the same issue.
I'm also encountering this issue. I'm working on adding support for svelte files to biome's playground: biomejs/website#1010.
I've tracked down where this is being thrown from: https://github.com/sveltejs/prettier-plugin-svelte/blob/5630294dae5d125f7a21da8969c2c0279fef8751/src/print/index.ts#L736
Pretty sure it's coming from this plugin itself, at least in my case. I tried to comment out the Tailwind plugin stuff, but I continue to get the same issue.
@hrishikesh-k can you do a branch on your repo to show how you have commented it out and still get the error? Because I did also use your repo and the error went away after removing the tailwind plugin.
I've updated all the deps and pushed the changes to main. Feel free to explore.
With that being said, I'm likely moving off to biome instead of dealing with eslint + prettier. Svelte is not completely supported there yet, but that's bearable for now (the script gets correctly linted which is good enoug for me). So at this point, I'm no longer blocked by this issue.
Same here out of the blue
prettier error
2024-10-25 18:48:26[ERROR] Formatter 'prettier' error: {
"type": "Script",
"start": 0,
"end": 71,
"context": "default",
"content": {
"type": "Program",
"start": 60,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 62
}
},
"body": [
{
"type": "BlockStatement",
"start": 60,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 60
},
"end": {
"line": 1,
"column": 62
}
},
"body": []
}
],
"sourceType": "module"
}
}
[error] src/routes/ease/+page.svelte: Error: unknown node type: Script
[error] at Object.print (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier-plugin-svelte/plugin.js:1474:11)
[error] at callPluginPrintFunction (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8601:26)
[error] at mainPrintInternal (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8550:22)
[error] at mainPrint (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8537:18)
[error] at AstPath.call (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8359:24)
[error] at printTopLevelParts (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier-plugin-svelte/plugin.js:1515:33)
[error] at Object.print (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier-plugin-svelte/plugin.js:929:16)
[error] at callPluginPrintFunction (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8601:26)
[error] at mainPrintInternal (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8550:22)
[error] at mainPrint (/Users/melmassadian/dev/melmass/mtb/node_modules/prettier/index.js:8537:18)
Found the issue by checking the lockfile, I had a dep installing an old version of prettier (sveld and a farme plugin in my case). Removing them / purging submodules / re-installing the workspace worked
I was facing the same issue.
Check if your prettier config has.
"embeddedLanguageFormatting": "off"
Enabling it fixed the issue.