Product Used: SonarLint in Visual Studio Code, v3.11.0
Language used: Vue.js 3 / Javascript
Affected Rule: Web:S4645
A </script>
was found without a relating opening <script>
tag. This may be caused by nested script tags.
Code Sample:
This started as a sample of actual code that I pruned as much as possible with trial and error while still raising the false positive. The resulting code is thus quite nonsensical.
filename errorDemonstration.vue
<template>
{{ (3 < 5 ? "foo" : "bar") }}
</template>
<script>
export default {
mounted() {
//5 > 0 ? foo : bar;
},
}
</script>
And yes, that commented out terniary is necessary, removing it removes the sonarlint warning. It seems to be related to the presence of ternaries with < followed by one with a > in them, since if I remove those the error disappears as well. So the error does not occur if I were to do:
<template>
{{ (3 > 5 ? "foo" : "bar") }}
</template>
<script>
export default {
mounted() {
//5 < 0 ? foo : bar;
},
}
</script> // No warning