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.

Formatting SCSS `Unexpected token, expected`

See original GitHub issue

Hello! I wonder if somebody can shed some light on this issue: after spending a couple of hours trying to get the Prettier plugin working for SCSS files (it works wonderfully for JS files), I’ve given up.

I tried changing settings all over the place (rc file, workplace settings, global settings) and read all the top 10 results on Google. Am i missing something basic here?

Is css/sass unsuported without additional config?

RC files:

screenshot 200

After running CMD + SHIFT + P:

screenshot 199

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
CiGitcommented, Aug 14, 2018

Babylon was the default parser. ie: when none was specified. The parser is now inferred from file’s extension. In your case, you just said: Use babylon whatever file I’m using. In this case a CSS file which indeed couldn’t be parsed by it

1reaction
jowo-iocommented, Aug 14, 2018

I have removed all prettier specific Workspace and User settings. I’ve only got "editor.formatOnSave": true enabled for json, javascript and scss, however:

It looks like removing the "parser": "babylon" setting fixes the issue. SCSS now formats as expected!

It’s kinda strange though, is it not? I was under the impression that Babylon was the default parser.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token, expected ";" for .css files using Prettier ...
When I am running npm run prettier -- --list-different all of my css files are getting the error SyntaxError: Unexpected token, expected ";" ......
Read more >
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
Syntax checking (hints) SASS language "Unexpected token ...
This is false error reporting. The file complies correctly. This error appears only a flaw in the editor's hint rules for SASS/SCSS language....
Read more >
Unexpected token issue, scss variables - Codecademy Forums
<In what way does your code behave incorrectly? Include ALL error messages.> keep getting unexpected token, dont use ids in selectors. Still ...
Read more >
How to configure CSS and CSS modules in webpack
With a loader, you can translate another type of file to a format that ... src/styles.css 1:0 Module parse failed: Unexpected token (1:0)...
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