Run prettier on ts and scss files


I am trying to configurate my prettier for typescript and scss files

I have have the following .pretterrc file:

    "printWidth": 100,
    "parser": "typescript",
    "tabWidth": 2,
    "semi": true,
    "singleQuote": true,
    "trailingComma": "all",
    "bracketSpacing": true,
    "jsxBracketSameLine": true,
    "arrowParens": "avoid"

When running my prettier it errors on the scss files:

SyntaxError: Expression expected. (1:2)
[error] > 1 | @import 

When I change the parser to "parser": "scss" then prettier errors on my ts files.

How can I run Prettier on all my files?


You need to remove the parser option.

If you use VSCode, you need to install the extension.

Prettier will automatically detect which language you are using.

Answered By – Melvynx

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published