Errors in mixins are raised at the parent mixin call location rather than the actual line of the error
I maintainer di solito rispondono entro 1 giorno
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
- Ambito
- developer-experience
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
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:
lessversion: 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
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di less/less.js
-
lessc CLI fails to start since 4.6.0: bin/lessc is extensionless under "type": "module"Forse già presa @eknathdj l’ha presa 2 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
less/less.js#4561 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Rename/adjust "Rulesets cannot be evaluated on a property" error messageForse già presa @ThiagoMirandaLiotto l’ha presa 6 giorni fa. Apertabug
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
less/less.js#4558 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
less/less.js#4330 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Extend within container queryForse già presa @dchaudhari7177 l’ha presa 42 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
less/less.js#4540 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
rgb(from … r g b / <alpha>) throws under --math=always (Operation on an invalid type)Forse già presa @zslabs l’ha presa 50 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
less/less.js#4528 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di less/less.js
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
swc-project/swc-next#1165 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nhsuk/nhsuk-prototype-kit-package#439 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: &TV LogoApertacheck:passed logos:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
-
BUG: Appointment time renders blank and PM appointment slots miscalculate vertical position in CalendarScreenForse già presa @aryanpatil-07 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AOSSIE-Org/BabyNest#297 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Onboarding form: instructor radio never pre-selected "Yes" (permission vs permissions typo)Forse già presa @ThakuraAnki l’ha presa oggi. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
WikiEducationFoundation/WikiEduDashboard#7235 ·
I maintainer di solito rispondono entro 1 giorno