Skip to content

Prettier adds tabs to already 'prettiefied' files since 1.9 (clashes with .editorconfig) #3461

@Mohamed3on

Description

@Mohamed3on

I had run prettier on a repo I'm working on before with the below options:

# Options (if any):
--single-quote --print-width=80

Now suddenly even though my options haven't changed, the code is getting reformatted again (I have it on save in VSCode). I thought it could be a problem with the VSCode extension, but running:

prettier C:\path\to\file --write --single-quote --print-width=80

Also reformats the file again, mainly cutting previously 'fine' lines into separate lines.
Note: In the playground it outputs the expected code.
Note: This only happens with prettier >1.9.0

Input:

 hasSubcategories =
            category.subcategories && category.subcategories.length !== 0;

Output:

   hasSubcategories =
                        category.subcategories &&
                        category.subcategories.length !== 0;

Expected behavior:

 hasSubcategories =
            category.subcategories && category.subcategories.length !== 0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions