Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 emoji not supported in CSS parser #3627

Closed
1 task done
mayank99 opened this issue Aug 9, 2024 · 10 comments · Fixed by #3771 or #4175
Closed
1 task done

🐛 emoji not supported in CSS parser #3627

mayank99 opened this issue Aug 9, 2024 · 10 comments · Fixed by #3771 or #4175
Assignees
Labels
A-Parser Area: parser L-CSS Language: CSS S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@mayank99
Copy link

mayank99 commented Aug 9, 2024

Environment information

biome rage
CLI:
  Version:                      1.9.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.16.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.6.0"

Biome Configuration:
  Status:                       unset

What happened?

When a custom property name contains an emoji, Biome fails to parse it.

p {
  ---color: red;
  color: var(--✨-color);
}

I get errors in my IDE from biome(parse) in the form of "Expected a declaration, or an at rule but instead found '--✨'." and "Expected a declaration item but instead found '--✨'."

See playground.

See updated playground and related comment.

Expected result

Emojis are allowed in custom property names, so Biome should be able to parse them.

It's worth noting that since Biome doesn't support formatting/linting CSS, it should not even be parsing my CSS files.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico
Copy link
Member

It's worth noting that since Biome doesn't support formatting/linting CSS, it should not even be parsing my CSS files.

That's intended by design, as Biome aims to function as a language server, so it needs to provide parsing diagnostics regardless.

@Tom-Aive
Copy link

Tom-Aive commented Sep 3, 2024

This issue also applies to property names starting with a number.
--500-grey throws Expected a declaration, or an at rule but instead found while --grey-500 doesn't.
Even though both are valid css ident-token.

I've looked at the PR and this specific issue doesn't seem to be fixed.

Do you want me to open another Github issue or do you prefer to reopen this one ?

@Conaclos
Copy link
Member

Conaclos commented Sep 3, 2024

I've looked at the PR and this specific issue doesn't seem to be fixed.

The PR fixed also this issue. You can test it on the Playground.

@Tom-Aive
Copy link

Tom-Aive commented Sep 3, 2024

Perfect, thanks for the great work. 🙏

@mayank99
Copy link
Author

mayank99 commented Oct 3, 2024

It looks like this wasn't completely fixed. It still breaks with certain emojis. Please see playground. Should this issue be reopened?

@Conaclos Conaclos reopened this Oct 3, 2024
@Conaclos
Copy link
Member

Conaclos commented Oct 3, 2024

@mayank99 Actually they are emoji that are not allowed as identifiers according to the specification (See the identifier diagram and the specification of non-ascii codepoint). Even the current draft specification doesn't include its emoji.

@mayank99
Copy link
Author

mayank99 commented Oct 3, 2024

Yeah, that's interesting because it works in all three browsers.

Since browsers already work this way, I wonder if the spec needs to be updated. This could be a good issue to raise with the CSSWG.

@Conaclos
Copy link
Member

Conaclos commented Oct 3, 2024

We should take a look at some browser implementations and indeed raise the issue. The intention is certainly to support all emoji.

@Conaclos
Copy link
Member

Conaclos commented Oct 4, 2024

I raised the issue on to the folks in charge of CSS specification. See w3c/csswg-drafts#11005

In the meantime, I think we can accept these emojis because they are already allowed by browsers.

@mayank99
Copy link
Author

mayank99 commented Oct 18, 2024

@Conaclos Thanks so much for raising the issue with CSSWG and for accepting the additional emoji in Biome as a stopgap. I tried out 1.9.4 just now, and it works great! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Parser Area: parser L-CSS Language: CSS S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
4 participants