parcel-bundler / parcel-bundler/lightningcss

Incorrect error message for `@layer` between `@import`s

Open
#803 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

The following CSS is invalid as the @import is not consecutive.

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@100;200;300;400;500;600;700&display=swap');

@layer reset, base, variant, state, component;

@import url(./tester.css) layer(base);

Reproduction

If this CSS is input, lightningcss errors with the following message:

@import rules must precede all rules aside from @charset and @layer statements

This message is true, but doesn't apply to this input. @import does precede all other statements aside from @layer.
In this case, I think the error message needs to be something like "@import must be consecutive".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSS snippet and linked lightningcss playground reproduction to observe the current diagnostic. Locate the parser or diagnostic handling for @import and @layer, then verify that the message describes the non-consecutive @import case and that the reproduction no longer reports the misleading wording.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.