Skip to content

want: vue/max-line rule, limit the number of lines of code per block #1443

Closed
@axetroy

Description

@axetroy

Please describe what the rule should do:

This rule applies to the number of lines of code.

Help people not to write thousands of lines of javascript code in the same file. Split the code to improve maintainability and readability.

What category should the rule belong to?

[ ] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[x] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<template>
  <view>
  <view>
</template>

<script>
// There is a very long javascript code here
export default {
 data () {
  return {}
 }
}
</script>

<style>
root {
  long-long-style: none;
}
</style>

Additional context

the rule look like:

rules: {
  "vue/max-line": ['error', {
    // Specify a block of code via lang="xxx"
    // eg.
    // <style lang="sass"><style>
    // sass: 800
 	js: 800,         // limit max line for javascript block
    jsx: 800,
    ts: 800,         // limit max line for typescript block
    tsx: 800,
    html: 1200,      // limit max line for HTML block
    css: 1200        // limit max line for css/sass/scss block
  }]
}

It receives a parameter to specify the maximum length of a certain code block

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions