Skip to content

Commit d437e75

Browse files
committed
refactor: reformat code
1 parent b2619c8 commit d437e75

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

docs/.vitepress/components/eslint-code-block.vue

+24-24
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<div class="eslint-code-container">
33
<eslint-editor
44
ref="editor"
5+
v-model="code"
56
:linter="linter"
67
:config="config"
7-
v-model="code"
88
:style="{ height }"
99
class="eslint-code-block"
1010
:filename="'/path/' + resplvedFilename"
@@ -72,14 +72,6 @@ export default {
7272
}
7373
},
7474
75-
watch: {
76-
code(newCode) {
77-
if (this.$resourceGroup) {
78-
this.$resourceGroup.set(this.resplvedFilename, newCode)
79-
}
80-
}
81-
},
82-
8375
computed: {
8476
isResource() {
8577
return this.language === 'json' || this.language === 'yaml'
@@ -160,22 +152,11 @@ export default {
160152
}
161153
},
162154
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)
167159
}
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()
179160
}
180161
},
181162
@@ -221,6 +202,25 @@ export default {
221202
verifyHook()
222203
return verifyAndFix.apply(this, args)
223204
}
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+
}
224224
}
225225
}
226226
</script>

scripts/lib/eslint-compat.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,15 @@ function getESLintClassForV6(): typeof eslint.ESLint {
4444
: undefined,
4545
plugins: plugins || [],
4646
rules: rules
47-
? Object.entries(rules).reduce((o, [ruleId, opt]) => {
48-
if (opt) {
49-
o[ruleId] = opt
50-
}
51-
return o
52-
}, {} as NonNullable<ESLintCLIEngine['Options']['rules']>)
47+
? Object.entries(rules).reduce(
48+
(o, [ruleId, opt]) => {
49+
if (opt) {
50+
o[ruleId] = opt
51+
}
52+
return o
53+
},
54+
{} as NonNullable<ESLintCLIEngine['Options']['rules']>
55+
)
5356
: undefined,
5457
...overrideConfig
5558
}

0 commit comments

Comments
 (0)