|
2 | 2 | <div class="eslint-code-container">
|
3 | 3 | <eslint-editor
|
4 | 4 | ref="editor"
|
| 5 | + v-model="code" |
5 | 6 | :linter="linter"
|
6 | 7 | :config="config"
|
7 |
| - v-model="code" |
8 | 8 | :style="{ height }"
|
9 | 9 | class="eslint-code-block"
|
10 | 10 | :filename="'/path/' + resplvedFilename"
|
@@ -72,14 +72,6 @@ export default {
|
72 | 72 | }
|
73 | 73 | },
|
74 | 74 |
|
75 |
| - watch: { |
76 |
| - code(newCode) { |
77 |
| - if (this.$resourceGroup) { |
78 |
| - this.$resourceGroup.set(this.resplvedFilename, newCode) |
79 |
| - } |
80 |
| - } |
81 |
| - }, |
82 |
| -
|
83 | 75 | computed: {
|
84 | 76 | isResource() {
|
85 | 77 | return this.language === 'json' || this.language === 'yaml'
|
@@ -160,22 +152,11 @@ export default {
|
160 | 152 | }
|
161 | 153 | },
|
162 | 154 |
|
163 |
| - methods: { |
164 |
| - computeCodeFromSlot(nodes) { |
165 |
| - if (!Array.isArray(nodes)) { |
166 |
| - return '' |
| 155 | + watch: { |
| 156 | + code(newCode) { |
| 157 | + if (this.$resourceGroup) { |
| 158 | + this.$resourceGroup.set(this.resplvedFilename, newCode) |
167 | 159 | }
|
168 |
| - return nodes |
169 |
| - .map(node => node.text || this.computeCodeFromSlot(node.children)) |
170 |
| - .join('') |
171 |
| - }, |
172 |
| - verifyHook() { |
173 |
| - setFileContents( |
174 |
| - this.$resourceGroup ? this.$resourceGroup.getFileContents() : {} |
175 |
| - ) |
176 |
| - }, |
177 |
| - lint() { |
178 |
| - this.$refs.editor.lint() |
179 | 160 | }
|
180 | 161 | },
|
181 | 162 |
|
@@ -221,6 +202,25 @@ export default {
|
221 | 202 | verifyHook()
|
222 | 203 | return verifyAndFix.apply(this, args)
|
223 | 204 | }
|
| 205 | + }, |
| 206 | +
|
| 207 | + methods: { |
| 208 | + computeCodeFromSlot(nodes) { |
| 209 | + if (!Array.isArray(nodes)) { |
| 210 | + return '' |
| 211 | + } |
| 212 | + return nodes |
| 213 | + .map(node => node.text || this.computeCodeFromSlot(node.children)) |
| 214 | + .join('') |
| 215 | + }, |
| 216 | + verifyHook() { |
| 217 | + setFileContents( |
| 218 | + this.$resourceGroup ? this.$resourceGroup.getFileContents() : {} |
| 219 | + ) |
| 220 | + }, |
| 221 | + lint() { |
| 222 | + this.$refs.editor.lint() |
| 223 | + } |
224 | 224 | }
|
225 | 225 | }
|
226 | 226 | </script>
|
|
0 commit comments