From d30b89b368fe56eea6c343415a227f5ff3b9c6b9 Mon Sep 17 00:00:00 2001 From: pushkine Date: Thu, 7 Jan 2021 19:11:35 +0100 Subject: [PATCH 01/10] init --- packages/svelte2tsx/package.json | 1 + packages/svelte2tsx/repl.js | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 packages/svelte2tsx/repl.js diff --git a/packages/svelte2tsx/package.json b/packages/svelte2tsx/package.json index 8437dba55..9904e8c6b 100644 --- a/packages/svelte2tsx/package.json +++ b/packages/svelte2tsx/package.json @@ -45,6 +45,7 @@ "build": "rollup -c", "prepublishOnly": "npm run build", "dev": "rollup -c -w", + "repl": "node repl.js", "test": "mocha --opts mocha.opts", "pretest": "rollup -c rollup.config.test.js" }, diff --git a/packages/svelte2tsx/repl.js b/packages/svelte2tsx/repl.js new file mode 100644 index 000000000..201e23cf1 --- /dev/null +++ b/packages/svelte2tsx/repl.js @@ -0,0 +1,26 @@ +/** + * Try your changes to the svelte2tsx source code + * Run the package script "repl" to run this file + * + * [VScode] Attach a debugger by clicking on the bug + * next to the play button at the "repl" package script + * + * Make sure to run an instance of npm dev to reflect your changes + * Don't forget to unstage changes to this file once you're done + * + * Thank you for your contribution! + */ + +const result = require('svelte2tsx')( + ` + + {#each arr as item} + {item} + {/each} +`, + { isTsFile: true } +); +result; +debugger; From b8c54c25c5869eaa91edb7d0be874a768de31570 Mon Sep 17 00:00:00 2001 From: pushkine Date: Fri, 8 Jan 2021 11:59:48 +0100 Subject: [PATCH 02/10] redo --- packages/svelte2tsx/.gitignore | 1 + packages/svelte2tsx/package.json | 11 ++-- packages/svelte2tsx/repl.js | 26 -------- packages/svelte2tsx/repl/debug.ts | 15 +++++ packages/svelte2tsx/repl/index.svelte | 0 packages/svelte2tsx/rollup.config.js | 31 ++++++++- packages/svelte2tsx/src/htmlxtojsx/index.ts | 4 +- packages/svelte2tsx/src/utils/htmlxparser.ts | 2 +- yarn.lock | 69 +++++++++++++++++++- 9 files changed, 121 insertions(+), 38 deletions(-) delete mode 100644 packages/svelte2tsx/repl.js create mode 100644 packages/svelte2tsx/repl/debug.ts create mode 100644 packages/svelte2tsx/repl/index.svelte diff --git a/packages/svelte2tsx/.gitignore b/packages/svelte2tsx/.gitignore index d4cd79f1f..6d23a7b94 100644 --- a/packages/svelte2tsx/.gitignore +++ b/packages/svelte2tsx/.gitignore @@ -5,3 +5,4 @@ node_modules /index.mjs test/typecheck/samples/**/input.svelte.tsx test/build +repl/output \ No newline at end of file diff --git a/packages/svelte2tsx/package.json b/packages/svelte2tsx/package.json index 9904e8c6b..19601133a 100644 --- a/packages/svelte2tsx/package.json +++ b/packages/svelte2tsx/package.json @@ -17,6 +17,10 @@ "main": "index.js", "types": "index.d.ts", "devDependencies": { + "@rollup/plugin-commonjs": "^15.0.0", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-node-resolve": "^9.0.0", + "@rollup/plugin-typescript": "^6.0.0", "@types/mocha": "^5.2.7", "@types/node": "^8.10.53", "@types/unist": "^2.0.3", @@ -25,13 +29,10 @@ "mocha": "^6.2.2", "periscopic": "^2.0.2", "rollup": "^2.28.0", - "@rollup/plugin-commonjs": "^15.0.0", "rollup-plugin-delete": "^2.0.0", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-node-resolve": "^9.0.0", - "@rollup/plugin-typescript": "^6.0.0", "source-map": "^0.6.1", "source-map-support": "^0.5.16", + "sucrase": "^3.17.0", "svelte": "3.28.0", "tiny-glob": "^0.2.6", "tslib": "^1.10.0", @@ -45,7 +46,7 @@ "build": "rollup -c", "prepublishOnly": "npm run build", "dev": "rollup -c -w", - "repl": "node repl.js", + "debug": "node -r sucrase/register/ts repl/debug.ts", "test": "mocha --opts mocha.opts", "pretest": "rollup -c rollup.config.test.js" }, diff --git a/packages/svelte2tsx/repl.js b/packages/svelte2tsx/repl.js deleted file mode 100644 index 201e23cf1..000000000 --- a/packages/svelte2tsx/repl.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Try your changes to the svelte2tsx source code - * Run the package script "repl" to run this file - * - * [VScode] Attach a debugger by clicking on the bug - * next to the play button at the "repl" package script - * - * Make sure to run an instance of npm dev to reflect your changes - * Don't forget to unstage changes to this file once you're done - * - * Thank you for your contribution! - */ - -const result = require('svelte2tsx')( - ` - - {#each arr as item} - {item} - {/each} -`, - { isTsFile: true } -); -result; -debugger; diff --git a/packages/svelte2tsx/repl/debug.ts b/packages/svelte2tsx/repl/debug.ts new file mode 100644 index 000000000..a9f0a0a1b --- /dev/null +++ b/packages/svelte2tsx/repl/debug.ts @@ -0,0 +1,15 @@ +import fs from 'fs'; +import svelte2tsx from '../src'; +const content = fs.readFileSync(`${__dirname}/index.svelte`, 'utf-8'); +svelte2tsx(content); +debugger; + +/** + * Run the "dev" package script to get started + * + * Inputs at "repl/index.svelte" use the modified source code + * and are compiled to "repl/output/" on save. + * + * Alternatively, attach a debugger to the "debug" package script + * and place breakpoints directly in the ts source files. + */ diff --git a/packages/svelte2tsx/repl/index.svelte b/packages/svelte2tsx/repl/index.svelte new file mode 100644 index 000000000..e69de29bb diff --git a/packages/svelte2tsx/rollup.config.js b/packages/svelte2tsx/rollup.config.js index b05719aaa..4a388ee79 100644 --- a/packages/svelte2tsx/rollup.config.js +++ b/packages/svelte2tsx/rollup.config.js @@ -1,9 +1,33 @@ -import typescript from '@rollup/plugin-typescript'; import commonjs from '@rollup/plugin-commonjs'; -import resolve from '@rollup/plugin-node-resolve'; import json from '@rollup/plugin-json'; +import resolve from '@rollup/plugin-node-resolve'; +import typescript from '@rollup/plugin-typescript'; import builtins from 'builtin-modules'; +import fs from 'fs'; +import path from 'path'; + +function repl() { + return { + name: 'dev-repl', + buildStart() { + this.addWatchFile('./repl/index.svelte'); + }, + writeBundle() { + if (!this.meta.watchMode) return; + + const repl = `${__dirname}/repl/`; + const output = `${__dirname}/repl/output/`; + + delete require.cache[path.resolve(__dirname, 'index.js')]; + const svelte2tsx = require('./index.js'); + + const tsx = svelte2tsx(fs.readFileSync(`${repl}/index.svelte`, 'utf-8')); + if (!fs.existsSync(output)) fs.mkdirSync(output); + fs.writeFileSync(`${repl}/output/code.tsx`, tsx.code); + } + }; +} export default [ { input: 'src/index.ts', @@ -22,7 +46,8 @@ export default [ resolve({ browser: false, preferBuiltins: true }), commonjs(), json(), - typescript({ include: ['src/**/*'] }) + typescript({ include: ['src/**/*'] }), + repl() ], watch: { clearScreen: false diff --git a/packages/svelte2tsx/src/htmlxtojsx/index.ts b/packages/svelte2tsx/src/htmlxtojsx/index.ts index aa1c7b007..2bdb53afc 100644 --- a/packages/svelte2tsx/src/htmlxtojsx/index.ts +++ b/packages/svelte2tsx/src/htmlxtojsx/index.ts @@ -1,12 +1,11 @@ import { Node } from 'estree-walker'; import MagicString from 'magic-string'; -import svelte from 'svelte/compiler'; +import * as svelte from 'svelte/compiler'; import { parseHtmlx } from '../utils/htmlxparser'; import { handleActionDirective } from './nodes/action-directive'; import { handleAnimateDirective } from './nodes/animation-directive'; import { handleAttribute } from './nodes/attribute'; import { handleAwait } from './nodes/await'; -import { handleKey } from './nodes/key'; import { handleBinding } from './nodes/binding'; import { handleClassDirective } from './nodes/class-directive'; import { handleComment } from './nodes/comment'; @@ -16,6 +15,7 @@ import { handleEach } from './nodes/each'; import { handleElement } from './nodes/element'; import { handleEventHandler } from './nodes/event-handler'; import { handleElse, handleIf } from './nodes/if-else'; +import { handleKey } from './nodes/key'; import { handleRawHtml } from './nodes/raw-html'; import { handleSvelteTag } from './nodes/svelte-tag'; import { handleTransitionDirective } from './nodes/transition-directive'; diff --git a/packages/svelte2tsx/src/utils/htmlxparser.ts b/packages/svelte2tsx/src/utils/htmlxparser.ts index 38ae98fbe..f880eee99 100644 --- a/packages/svelte2tsx/src/utils/htmlxparser.ts +++ b/packages/svelte2tsx/src/utils/htmlxparser.ts @@ -1,5 +1,5 @@ -import compiler from 'svelte/compiler'; import { Node } from 'estree-walker'; +import * as compiler from 'svelte/compiler'; function parseAttributeValue(value: string): string { return /^['"]/.test(value) ? value.slice(1, -1) : value; diff --git a/yarn.lock b/yarn.lock index a49b2b207..d15b1e54e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -484,6 +484,11 @@ ansi-styles@^4.1.0: "@types/color-name" "^1.1.1" color-convert "^2.0.1" +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= + anymatch@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" @@ -678,6 +683,11 @@ colorette@^1.1.0: resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -1270,7 +1280,7 @@ glob@7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.3, glob@^7.1.6: +glob@7.1.6, glob@^7.1.3, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -1837,6 +1847,15 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +mz@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -1877,6 +1896,11 @@ node-environment-flags@1.0.6: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" +node-modules-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= + normalize-package-data@^2.3.2: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -1892,6 +1916,11 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + object-inspect@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" @@ -2108,6 +2137,13 @@ pify@^2.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= +pirates@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" @@ -2487,6 +2523,18 @@ strip-json-comments@^3.1.0: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +sucrase@^3.17.0: + version "3.17.0" + resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.17.0.tgz#d9fe5d7e359d884cdb31130358fbdfc18bfb4c24" + integrity sha512-wtiqaokYRjFSSrv8fQu7pThKTIZSLwiffW+PHQG52hlI8eJO47v1tXbKt6fYb8Z1kCyuCkNH9etpTUebb7g+pA== + dependencies: + commander "^4.0.0" + glob "7.1.6" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" + supports-color@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a" @@ -2553,6 +2601,20 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + tiny-glob@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.6.tgz#9e056e169d9788fe8a734dfa1ff02e9b92ed7eda" @@ -2568,6 +2630,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +ts-interface-checker@^0.1.9: + version "0.1.13" + resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" + integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== + ts-node@^8.6.2: version "8.6.2" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.6.2.tgz#7419a01391a818fbafa6f826a33c1a13e9464e35" From 19aff523bff156ccda4ff38a6df93e41cdc00d85 Mon Sep 17 00:00:00 2001 From: pushkine Date: Fri, 8 Jan 2021 12:14:15 +0100 Subject: [PATCH 03/10] lint --- packages/svelte2tsx/repl/debug.ts | 5 ++--- packages/svelte2tsx/src/svelte2tsx/index.ts | 8 ++++---- packages/svelte2tsx/tsconfig.json | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/svelte2tsx/repl/debug.ts b/packages/svelte2tsx/repl/debug.ts index a9f0a0a1b..69587e821 100644 --- a/packages/svelte2tsx/repl/debug.ts +++ b/packages/svelte2tsx/repl/debug.ts @@ -2,14 +2,13 @@ import fs from 'fs'; import svelte2tsx from '../src'; const content = fs.readFileSync(`${__dirname}/index.svelte`, 'utf-8'); svelte2tsx(content); -debugger; /** * Run the "dev" package script to get started - * + * * Inputs at "repl/index.svelte" use the modified source code * and are compiled to "repl/output/" on save. - * + * * Alternatively, attach a debugger to the "debug" package script * and place breakpoints directly in the ts source files. */ diff --git a/packages/svelte2tsx/src/svelte2tsx/index.ts b/packages/svelte2tsx/src/svelte2tsx/index.ts index 4c9c15ec6..acf74bb2a 100644 --- a/packages/svelte2tsx/src/svelte2tsx/index.ts +++ b/packages/svelte2tsx/src/svelte2tsx/index.ts @@ -10,16 +10,16 @@ import { EventHandler } from './nodes/event-handler'; import { ExportedNames } from './nodes/ExportedNames'; import { createClassGetters, createRenderFunctionGetterStr } from './nodes/exportgetters'; import { - handleScopeAndResolveForSlot, - handleScopeAndResolveLetVarForSlot + handleScopeAndResolveForSlot, + handleScopeAndResolveLetVarForSlot } from './nodes/handleScopeAndResolveForSlot'; import { Scripts } from './nodes/Scripts'; import { SlotHandler } from './nodes/slot'; import { Stores } from './nodes/Stores'; import TemplateScope from './nodes/TemplateScope'; import { - InstanceScriptProcessResult, - processInstanceScriptContent + InstanceScriptProcessResult, + processInstanceScriptContent } from './processInstanceScriptContent'; import { processModuleScriptTag } from './processModuleScriptTag'; import { ScopeStack } from './utils/Scope'; diff --git a/packages/svelte2tsx/tsconfig.json b/packages/svelte2tsx/tsconfig.json index 77decf9dc..c0cf75bcd 100644 --- a/packages/svelte2tsx/tsconfig.json +++ b/packages/svelte2tsx/tsconfig.json @@ -23,5 +23,5 @@ "@/*": ["src/*"] }, // "include" is set in rollup.config(.test).js - "exclude": ["node_modules"] + "exclude": ["node_modules", "repl"] } From 09ba3333ca8d819b38461fba5dd7b15e518386a8 Mon Sep 17 00:00:00 2001 From: pushkine Date: Mon, 18 Jan 2021 11:22:19 +0100 Subject: [PATCH 04/10] init --- .../svelte-vscode/package-json-schema.json | 9 ++ packages/svelte-vscode/package.json | 20 ++++ .../prettier-options-schema.json | 106 ++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 packages/svelte-vscode/package-json-schema.json create mode 100644 packages/svelte-vscode/prettier-options-schema.json diff --git a/packages/svelte-vscode/package-json-schema.json b/packages/svelte-vscode/package-json-schema.json new file mode 100644 index 000000000..3db9f6af0 --- /dev/null +++ b/packages/svelte-vscode/package-json-schema.json @@ -0,0 +1,9 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "properties": { + "prettier": { + "description": "Prettier-Plugin-Svelte configuration", + "$ref": "./prettier-options.json" + } + } +} diff --git a/packages/svelte-vscode/package.json b/packages/svelte-vscode/package.json index d81499578..8c585988d 100644 --- a/packages/svelte-vscode/package.json +++ b/packages/svelte-vscode/package.json @@ -300,6 +300,26 @@ ".svelte" ], "configuration": "./language-configuration.json" + }, + { + "id": "json", + "filenames": [ + ".prettierrc" + ] + } + ], + "jsonValidation": [ + { + "fileMatch": ".prettierrc", + "url": "./prettier-options-schema.json" + }, + { + "fileMatch": ".prettierrc.json", + "url": "./prettier-options-schema.json" + }, + { + "fileMatch": "package.json", + "url": "./package-json-schema.json" } ], "grammars": [ diff --git a/packages/svelte-vscode/prettier-options-schema.json b/packages/svelte-vscode/prettier-options-schema.json new file mode 100644 index 000000000..7963befa9 --- /dev/null +++ b/packages/svelte-vscode/prettier-options-schema.json @@ -0,0 +1,106 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Prettier-plugin-svelte schema for .prettierrc", + "definitions": { + "optionsDefinition": { + "type": "object", + "properties": { + "svelteSortOrder": { + "description": "Sort order for , scripts, markup, and styles.", + "default": "options-scripts-markup-styles", + "enum": [ + "options-scripts-markup-styles", + "options-scripts-styles-markup", + "options-markup-scripts-styles", + "options-markup-styles-scripts", + "options-styles-scripts-markup", + "options-styles-markup-scripts", + "scripts-options-markup-styles", + "scripts-options-styles-markup", + "scripts-markup-options-styles", + "scripts-markup-styles-options", + "scripts-styles-options-markup", + "scripts-styles-markup-options", + "markup-options-scripts-styles", + "markup-options-styles-scripts", + "markup-scripts-options-styles", + "markup-scripts-styles-options", + "markup-styles-options-scripts", + "markup-styles-scripts-options", + "styles-options-scripts-markup", + "styles-options-markup-scripts", + "styles-scripts-options-markup", + "styles-scripts-markup-options", + "styles-markup-options-scripts", + "styles-markup-scripts-options" + ] + }, + "svelteStrictMode": { + "description": "More strict HTML syntax: less self-closed tags, quotes in attributes, no attribute shorthand (overrules svelteAllowShorthand).", + "default": true, + "type": "boolean" + }, + "svelteBracketNewLine": { + "description": "Put the > of a multiline element on a new line. Roughly the Svelte equivalent of the jsxBracketSameLine rule.", + "default": false, + "type": "boolean" + }, + "svelteAllowShorthand": { + "description": "Option to enable/disable component attribute shorthand if attribute name and expression are same.", + "default": false, + "type": "boolean" + }, + "svelteIndentScriptAndStyle": { + "description": "Whether or not to indent the code inside