Skip to content

Rule Proposal: vue/max-len #731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 4 tasks
sebiniemann opened this issue Dec 18, 2018 · 6 comments · Fixed by #959
Closed
1 of 4 tasks

Rule Proposal: vue/max-len #731

sebiniemann opened this issue Dec 18, 2018 · 6 comments · Fixed by #959

Comments

@sebiniemann
Copy link

Please describe what the rule should do:
Currently, any line within <template> is forced to respect the max-len rule, without any option to ignore text-focused nodes (i.e. text nodes and phrasing content).

This does not seems to be in line with the current ignore options for max-len, as it already allows to keep long string, URLs, template literals, RegExp literals, ... together in a single line.

What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

It's a proposal to add an ignore option.

Provide 2-3 code examples that this rule should warn about:
The following examples should be fine (NO warning):

Text node within a flow content:

<template>
  <p>
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
  </p>
</template>

Phrasing node within a flow content

<template>
  <p>
    <q>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</q>
  </p>
</template>

Additional context
This issue was already mentioned in another context (to deactivate eslint completely -- what should never be the recommended solution in my opinion) by @maxmilton (#260 (comment)):

It's particularly frustrating with the max-len eslint rule. I often have paragraphs or long elements and so I've had to disable the rule. A shame because it's useful for JS linting.

@michalsnik
Copy link
Member

Hey @sebastianniemann Thanks for posting this issue. Implementation details of the core max-len rule result in throwing an error in the Vue template as well. We could probably introduce dedicated max-len rule, with updated logic, to allow setting different values for template and JS, as well as disabling one or another. What do you think @mysticatea? Perhaps you have other idea here? :)

@mysticatea
Copy link
Member

It's a good idea. We can add vue/max-len rule for additional settings.

@AdsonCicilioti
Copy link

Please i need this!

@michalsnik michalsnik changed the title Feature request: Adding an option to ignore max-len within the deepest flow content for any phrasing content or text node (template/html) Rule Proposal: vue/max-len Jan 2, 2019
@bastiW
Copy link

bastiW commented Mar 20, 2019

Good Idea! Also searched for that

@syntag
Copy link

syntag commented Apr 15, 2019

Can't wait for this to be implemented, it's definitely a must! I have eslint-disable max-len scattered throughout many of my Vue templates, which is obviously not ideal.

@kamilic
Copy link

kamilic commented Sep 4, 2019

Any progress ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants