|
30 | 30 | let code = state.code || DEFAULT_CODE; |
31 | 31 | let rules = state.rules || Object.assign({}, DEFAULT_RULES_CONFIG); |
32 | 32 | let messages = []; |
33 | | - let useEslintPluginSvelte3 = Boolean(state.useEslintPluginSvelte3); |
34 | 33 | let time = ''; |
35 | | - let options = {}; |
36 | 34 |
|
37 | 35 | $: hasLangTs = /lang\s*=\s*(?:"ts"|ts|'ts'|"typescript"|typescript|'typescript')/u.test(code); |
38 | 36 | let tsParser = undefined; |
|
51 | 49 | }); |
52 | 50 | } |
53 | 51 | } |
54 | | - $: { |
55 | | - options = useEslintPluginSvelte3 ? getEslintPluginSvelte3Options() : {}; |
56 | | - } |
57 | | - async function getEslintPluginSvelte3Options() { |
58 | | - const pluginSvelte3 = await import('eslint-plugin-svelte3'); |
59 | | - return { |
60 | | - preprocess: pluginSvelte3.processors.svelte3.preprocess, |
61 | | - postprocess: pluginSvelte3.processors.svelte3.postprocess |
62 | | - }; |
63 | | - } |
64 | 52 |
|
65 | 53 | // eslint-disable-next-line no-use-before-define -- false positive |
66 | 54 | $: serializedString = (() => { |
67 | 55 | const serializeCode = DEFAULT_CODE === code ? undefined : code; |
68 | 56 | const serializeRules = equalsRules(DEFAULT_RULES_CONFIG, rules) ? undefined : rules; |
69 | 57 | return serializeState({ |
70 | 58 | code: serializeCode, |
71 | | - rules: serializeRules, |
72 | | - useEslintPluginSvelte3: useEslintPluginSvelte3 ? true : undefined |
| 59 | + rules: serializeRules |
73 | 60 | }); |
74 | 61 | })(); |
75 | 62 | $: { |
|
98 | 85 | const state = deserializeState(newSerializedString); |
99 | 86 | code = state.code || DEFAULT_CODE; |
100 | 87 | rules = state.rules || Object.assign({}, DEFAULT_RULES_CONFIG); |
101 | | - useEslintPluginSvelte3 = Boolean(state.useEslintPluginSvelte3); |
102 | 88 | } |
103 | 89 | } |
104 | 90 |
|
|
121 | 107 |
|
122 | 108 | <div class="playground-root"> |
123 | 109 | <div class="playground-tools"> |
124 | | - <label> |
125 | | - <input bind:checked={useEslintPluginSvelte3} type="checkbox" /> |
126 | | - See result of |
127 | | - <a href="https://github.com/sveltejs/eslint-plugin-svelte3">eslint-plugin-svelte3</a>. |
128 | | - </label> |
129 | | - {#if useEslintPluginSvelte3} |
130 | | - <span style="color: red">svelte-eslint-parser is not used.</span> |
131 | | - {/if} |
132 | 110 | <span style="margin-left: 16px">{time}</span> |
133 | 111 | </div> |
134 | 112 | <div class="playground-content"> |
|
138 | 116 | {linter} |
139 | 117 | bind:code |
140 | 118 | config={{ |
141 | | - parser: useEslintPluginSvelte3 ? undefined : 'svelte-eslint-parser', |
| 119 | + parser: 'svelte-eslint-parser', |
142 | 120 | parserOptions: { |
143 | 121 | ecmaVersion: 2020, |
144 | 122 | sourceType: 'module', |
|
150 | 128 | es2021: true |
151 | 129 | } |
152 | 130 | }} |
153 | | - {options} |
154 | 131 | class="eslint-playground" |
155 | 132 | on:result={onLintedResult} |
156 | 133 | /> |
|
0 commit comments