Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Errors in mixins are raised at the parent mixin call location rather than the actual line of the error

Aperta
#4,559 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@eknathdj ci sta già lavorando.

Dal 25/10/2026.

  • #4564 di @eknathdj — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript

Direzione di ricerca

Start by compiling both provided snippets with pnpx less foo.less in Less 4.9.1 and trace how source locations are assigned while mixins are evaluated. Add or locate regression coverage for ruleset-evaluation and undefined-mixin errors; compilation should report line 6 or the inner .foo() call rather than the parent mixin invocation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

To reproduce:

Compile the following Less snippet. I used pnpx less foo.less since the browser playground doesn't show line numbers/source ranges for errors.

.my-color-mixin() {
  @result: #000;
}

#my-mixin() {
  background-color: .my-color-mixin();
}

body {
  #my-mixin();
}

Current behavior:

The following error is given:

SyntaxError: Rulesets cannot be evaluated on a property. in /.../foo.less on line 10, column 3:
9 body {
10   #my-mixin();
11 }

This error says that #my-mixin is the erroroneous line, when it is really the line background-color: .my-color-mixin(); within that mixin.

Expected behavior:

The error message should accurately pinpoint the location of the error source instead of the calling mixin. In this case, the mixin being "evaluated on a property" is .my-color-mixin on line 6. This might look something like:

SyntaxError: Rulesets cannot be evaluated on a property. in /.../foo.less on line 6, column ?:
5 #my-mixin() {
6   background-color: .my-color-mixin();
7 }

Environment information:

  • less version: 4.9.1

Another snippet you can try is this:

#my-mixin() {
  // ...
  background-color: .foo();
  // ...
}

body {
  #my-mixin();
}

Again here the compiler will point to the line in body {} rather than the actual line where the undefined .foo() is called.

NameError: .foo is undefined in /.../foo.less on line 8, column 3:
7 body {
8   #my-mixin();
9 }

This issue is especially problematic with longer mixins, where any errors within it is only surfaced at the parent call site which makes it very difficult to track down the actual error.

Lingua principale
JavaScript
Stelle
17k
Fork
3.4k
Merge medio
1g 35m
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di less/less.js

Tutte le issue di less/less.js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.