How to disable eslint rule max line length for paragraph in <template> of vue.js?
AFAIK, there is no way to apply eslint rules to the template, and specifically to one line in a template. I hope to be proven wrong though.
anyway, because I have a file with lots of text, to get around it, I've added this rule 'max-len': ["error", { "code": 120 }],
in my .eslintrc.js
file.
here is the structure (with other settings removed)
module.exports { rules: { 'max-len': ["error", { "code": 120 }] }}
This will disable the rule for the entire template tag. Official ES Lint docs on disabling rules
<template> <!-- eslint-disable max-len --> ...
EDIT: If you want to instead disable line length rule for all .vue files, then add this to .eslintrc.js
(this will also disable the rule for <script>
and <style>
tags):
module.exports = { ... overrides: [ { files: ["*.vue"], rules: { ... 'max-len': 'off' // disables line length check } } ]};
For eslint-plugin-vue
>= 4.1.0
you can use directive comments to disable eslint.
https://github.com/vuejs/eslint-plugin-vue/commit/ad84e0ba6d81f24583e65fc70b1d9803d73d3ed9
<template> <!-- eslint-disable-next-line vue/max-attributes-per-line --> <div a="1" b="2" c="3" d="4"> </div></template>