fix: lint error on json on empty string
This commit is contained in:
@@ -255,7 +255,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, watch } from "@nuxtjs/composition-api"
|
import {
|
||||||
|
computed,
|
||||||
|
onMounted,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch,
|
||||||
|
} from "@nuxtjs/composition-api"
|
||||||
import clone from "lodash/clone"
|
import clone from "lodash/clone"
|
||||||
import * as gql from "graphql"
|
import * as gql from "graphql"
|
||||||
import { GQLHeader, makeGQLRequest } from "@hoppscotch/data"
|
import { GQLHeader, makeGQLRequest } from "@hoppscotch/data"
|
||||||
@@ -343,15 +349,21 @@ const activeGQLHeadersCount = computed(
|
|||||||
|
|
||||||
const variableEditor = ref<any | null>(null)
|
const variableEditor = ref<any | null>(null)
|
||||||
|
|
||||||
useCodemirror(variableEditor, variableString, {
|
useCodemirror(
|
||||||
extendedEditorConfig: {
|
variableEditor,
|
||||||
mode: "application/ld+json",
|
variableString,
|
||||||
placeholder: `${t("request.variables")}`,
|
reactive({
|
||||||
},
|
extendedEditorConfig: {
|
||||||
linter: jsonLinter,
|
mode: "application/ld+json",
|
||||||
completer: null,
|
placeholder: `${t("request.variables")}`,
|
||||||
environmentHighlights: false,
|
},
|
||||||
})
|
linter: computed(() =>
|
||||||
|
variableString.value.length > 0 ? jsonLinter : null
|
||||||
|
),
|
||||||
|
completer: null,
|
||||||
|
environmentHighlights: false,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
const queryEditor = ref<any | null>(null)
|
const queryEditor = ref<any | null>(null)
|
||||||
const schemaString = useReadonlyStream(props.conn.schema$, null)
|
const schemaString = useReadonlyStream(props.conn.schema$, null)
|
||||||
@@ -394,7 +406,7 @@ const editBulkHeadersLine = (index: number, item?: GQLHeader | null) => {
|
|||||||
? `${item.active ? "" : "//"}${item.key}: ${item.value}`
|
? `${item.active ? "" : "//"}${item.key}: ${item.value}`
|
||||||
: `${header.active ? "" : "//"}${header.key}: ${header.value}`
|
: `${header.active ? "" : "//"}${header.key}: ${header.value}`
|
||||||
return [...all, current]
|
return [...all, current]
|
||||||
}, [])
|
}, [] as string[])
|
||||||
.join("\n")
|
.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user