question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[padding-line-between-statements] Add an option for padding object elements

See original GitHub issue

What rule do you want to change?

padding-line-between-statements

Does this change cause the rule to produce more or fewer warnings?

More warnings, if enabled. (but none if --fix is enabled.)

How will the change be implemented? (New option, new default behavior, etc.)?

New option for STATEMENT_TYPE for object elements.

Please provide some example code that this change will affect:

const obj = {
  props: {
    elt: Object,
  },
  data() {
    return {
      selected: {},
      config: {
        card_mode: false
      },
    };
  },
  created() {
    this.today = new Date;
  },
  methods: {
    onSubmit() {
      const url = '/foo';
      this.POST(url, {
        selected: this.selected,
      });
    },
    onReset() {
      this.$nextTick(() => this.$bvModal.hide('modal'));
    },
  },
};

What does the rule currently do for this code?

Nothing

What will the rule do after it’s changed?

Add padding between object elements this:

const obj = {
  props: {
    elt: Object,
  },

  data() {
    return {
      selected: {}

      config: {
        card_mode: false
      },
    };
  },

  created() {
    this.today = new Date;
  },

  methods: {
    onSubmit() {
      const url = '/foo';
      this.POST(url, {
        selected: this.selected,
      });
    },

    onReset() {
      this.$nextTick(() => this.$bvModal.hide('modal'));
    },
  },
};

Are you willing to submit a pull request to implement this change?

Nooooo.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jiangfengmingcommented, Mar 27, 2020

+1. Before ESLint officially support it, I modified the lines-between-class-members rule and made lines-between-object-properties.

1reaction
mdjermanoviccommented, Mar 2, 2020

Hi @mat813, thanks for this proposal!

padding-line-between-statements is about statements, so it probably shouldn’t apply to elements in object literals.

Some of the alternatives might be:

I’m not sure which of these would be the best choice at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

padding-line-between-statements
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
vue/padding-line-between-blocks
require or disallow padding lines between blocks. The --fix option on the command line can automatically fix some of the problems ...
Read more >
Apply Padding to an Object
Apply padding to an object to add white space between the object and its margin or, if there is a border, between the...
Read more >
ESLint v4.0.0 released - ESLint中文文档
This release adds some new features and fixes several bugs found in the ... have been deprecated in favor of the new padding-line-between-statements...
Read more >
padding
Padding and Element Width Calculations. If an element has a specified width, any padding added to that element will add to the total...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found