Skip to content

Separate max-len eslint rule for Vue template tag #2367

@guirreri

Description

@guirreri

What problem does this feature solve?

When using ESLint's max-len rule, it is applied to all of a vue single-file component. It would be better to provide separate max-len for an SFCs template tag vs the script.

It is very common to use the default max-len of 80 characters in a javascript file, but markup typically will have much longer lines.

At the moment, the default Vue CLI template fails max-len on HelloWorld.vue. This would fix that if the default for the vue rule was set to something higher.

What does the proposed API look like?

Add a rule called vue/max-len-template reusing the same settings for ESLint's normal max-len:
https://eslint.org/docs/rules/max-len

In .eslintrc.config:

module.exports = {
  'rules': {
    '@vue/max-len-template': ["error", { "code": 200 }],
    'max-len': 80
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions