Skip to content

What is Prettier's take on padding-line-between-statements? #13063

Closed

Description

@lucasrmendonca

Is there any Prettier opinionated enforced rule for separating statements with blank lines?

I have been using this huge ESLint padding-line-between-statements config and would like to replace it with prettier's standards, but it seems to be a lot more flexible about padding lines...

"padding-line-between-statements": [
  "error",

  // After directives (like 'use-strict'), except between directives
  { "blankLine": "always", "prev": "directive", "next": "*" },
  { "blankLine": "any", "prev": "directive", "next": "directive" },

  // After imports, except between imports
  { "blankLine": "always", "prev": "import", "next": "*" },
  { "blankLine": "any", "prev": "import", "next": "import" },

  // Before and after every sequence of variable declarations
  { "blankLine": "always", "prev": "*", "next": ["const", "let", "var"] },
  { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
  { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },

  // Before and after class declaration, if, while, switch, try
  { "blankLine": "always", "prev": "*", "next": ["class", "if", "while", "switch", "try"] },
  { "blankLine": "always", "prev": ["class", "if", "while", "switch", "try"], "next": "*" },

  // Before return statements
  { "blankLine": "always", "prev": "*", "next": "return" }
],

Activity

  1. alexander-akait commented on Jul 2, 2022

    @alexander-akait
    Member
  2. added
    type:option request
    on Jul 2, 2022
  3. locked as resolved and limited conversation to collaborators on Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:option request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions