Skip to content

Ignore empty scss files instead of writing a newline? #3440

Closed

Description

Prettier 1.9.1
Playground link

# Options (if any):
--single-quote --parser scss --trailing-comma es5

Input:

[blank line]

Output:

[blank line]
\n

Expected behavior:
No newline (\n)

Activity

  1. lydell commented on Dec 9, 2017

    @lydell
    Member

    Prettier makes sure that all files it formats ends with a single newline. Why would you want an exception for SCSS files with only a comment in it?

  2. added
    lang:css/scss/less
    status:awaiting response
    on Dec 10, 2017
  3. duailibe commented on Dec 11, 2017

    @duailibe
    Collaborator

    I can reproduce this:

    > touch file.css && git add file.css && prettier --write file.css && git diff file.css
    
    diff --git a/file.css b/file.css
    index e69de29b..8b137891 100644
    --- a/file.css
    +++ b/file.css
    @@ -0,0 +1 @@
    +
  4. lydell commented on Dec 11, 2017

    @lydell
    Member

    For empty JS files, Prettier does not add a newline. I didn't know it worked that way. Since that is the case for JS, it should work the same for SCSS as well.

  5. added and removed
    status:awaiting response
    on Dec 11, 2017
  6. lydell commented on Dec 11, 2017

    @lydell
    Member

    Or is JS wrong? Tough question.

  7. added a commit that references this issue on Jan 11, 2018
    4e3eea5
  8. added a commit that references this issue on Jan 11, 2018
    b67fd8e
  9. added
    locked-due-to-inactivity
    on Jul 6, 2018
  10. locked as resolved and limited conversation to collaborators on Jul 6, 2018
  11. added theissue type on Mar 3, 2025
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

    lang:css/scss/lesslocked-due-to-inactivity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions