The latest version of SonarQube for IDE cannot detect comments in files with the .vue or .ts extension.
function fn() {
// for(let i = 0; i < 10; i++) {
// console.log(i);
// }
}
But if I roll back to version 4.25.0, it works.
The latest version of SonarQube for IDE cannot detect comments in files with the .vue or .ts extension.
function fn() {
// for(let i = 0; i < 10; i++) {
// console.log(i);
// }
}
But if I roll back to version 4.25.0, it works.
Hey @shanyi-front
Is this the complete code sample? I’ve expanded your code sample and I can get the issue to raise.
<template>
<div class="container">
<h1>Vue Component</h1>
<p>This component contains the specified function.</p>
<button @click="callFunction" class="btn">Call Function</button>
</div>
</template>
<script>
export default {
name: 'MyComponent',
data() {
return {
// Component data
}
},
methods: {
fn() {
// for(let i = 0; i < 10; i++) {
// console.log(i);
// }
},
callFunction() {
this.fn();
console.log('Function called');
}
},
mounted() {
// Component lifecycle
}
}
</script>
<style scoped>
.container {
padding: 20px;
max-width: 600px;
margin: 0 auto;
}
h1 {
color: #2c3e50;
margin-bottom: 20px;
}
.btn {
background-color: #42b883;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
.btn:hover {
background-color: #369870;
}
</style>
Meanwhile I can’t get your code snippet to raise as is on new or old versions.
This is the complete code. sorry, I didn’t describe it completely. This happens in code inside a .ts file, or even in the top-level setup function of Vue 3. Both I and my team members have encountered this issue.
Could you share a complete, zipped up file? No matter what I do, the issue still raises…
I think I know what’s going on. When I switched the Node version from 20.11.0 to 22.13.0, the comment detection feature in SonarQube for IDE version 4.29.0 started working. This is related to the Node version, right?
Sounds like it. I’m surprised you weren’t getting a warning about it, however!
In the requirements, we mention:
- for Node v18, it must be at least 18.20.0.
- for Node v20, it must be at least 20.12.0.
- for Node v22 the Active LTS, it must be at least 22.11.0, with acceptance of v23 and v24.
So you were one minor version short of the Node 20 requirement.
Okay, I understand. Thank you.