How to add eslint-disable comments in pug code inside a Vue SFC file?
retained text
<!-- SC_OFF --><div class="md"><p>Hi! I'm having some trouble with eslint-disable comments for HTML elements defined inside a Vue SFC pug template, eslint do not recognize them and keeps throwing warnings.</p> <p>What I've tried so far:</p> <p>Comments inside the pug template, both // and //-</p> <p><code><template lang="pug"></code></p> <p><code>// eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -- Standard video player click-to-play-pause behavior</code><br /> <code>video(@click="togglePause" ...)</code></p> <p><code></template></code></p> <p><code><template lang="pug"></code></p> <p><code>//- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -- Standard video player click-to-play-pause behavior</code><br /> <code>video(@click="togglePause" ...)</code></p> <p><code></template></code></p> <p>My next options are not optimal, but I ran out of ideas:</p> <p>A comment inside the script setup tag (it is placed before the template in the file):</p> <p><code><script setup></code></p> <p><code>//eslint-disable vuejs-accessibility/no-static-element-interactions</code></p> <p><code></script></code></p> <p>A comment at the very top of the file, before any other code</p> <p><code><!-- eslint-disable vuejs-accessibility/no-static-element-interactions --></code></p> <p><code><script setup></script></code><br /> <code><template lang="pug"></template></code></p> <p>None of this worked. The only way I managed to make this work was creating overrides in .eslintrc.cjs:</p> <p><code>// Since eslint-disable comments do not work for HTML elements inside pug we</code><br /> <code>// must include those overrides here.</code><br /> <code>overrides: [</code><br /> <code>{</code><br /> <code>// Standard video player click-to-pause behavior</code><br /> <code>files: ["src/components/common/SimpleMp4Viewer.vue"],</code><br /> <code>rules: {</code><br /> <code>"vuejs-accessibility/no-static-element-interactions": "off"</code><br /> <code>}</code><br /> <code>}</code><br /> <code>]</code> </p> <p>Do you know if I am missing something here? The eslint related packages I have in my projects are:</p> <p><code>dependencies</code></p> <p><code>"eslint-config-prettier": "^10.1.8",</code></p> <p><code>devDependencies</code></p> <p><code>"@rushstack/eslint-patch": "^1.8.0",</code></p> <p><code>"@vue/eslint-config-prettier": "^9.0.0",</code></p> <p><code>"eslint": "^8.57.0",</code></p> <p><code>"eslint-define-config": "^2.1.0",</code></p> <p><code>"eslint-plugin-unused-imports": "^4.4.1",</code></p> <p><code>"eslint-plugin-vue": "^9.27.0",</code></p> <p><code>"eslint-plugin-vue-pug": "^0.6.2",</code></p> <p><code>"eslint-plugin-vuejs-accessibility": "^2.5.0",</code></p> <p>Thank you!</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/bcons-php-Console"> /u/bcons-php-Console </a> <br /> <span><a href="https://www.reddit.com/r/webdev/comments/1twhgua/how_to_add_eslintdisable_comments_in_pug_code/">[link]</a></span>   <span><a href="https://www.reddit.com/r/webdev/comments/1twhgua/how_to_add_eslintdisable_comments_in_pug_code/">[comments]</a></span>document fetched 2026-06-04 09:48