Support for reporting CSSSyntaxError?
- Lingua principale
- TypeScript
- Stelle
- 90
- Fork
- 9
- Merge medio
- 1g 9m
- PR unite (30g)
- 3
Descrizione
We're trying to integrate `stylelint` into a project in our org which uses `lit-html`. I've noticed that for `postcss-lit`, whenever there is a CSSSyntaxError from `postcss` parsing, it will entirely opt to "skip" the template, and not report back to the user the specific error.
Will presenting the details of the CSSSyntaxError to the user something that can be considered?
For example:
```js
class MyCustomELement {
static styles = css`
.icon {
width: 40px;
height: 40px;
.card {
display: flex
}
`
}
```
The code above will cause a `CSSSyntaxError` due to a missing closing bracket for the `icon` selector.
With `postcss-lit`, it will show a warning in the console, with a recommendation to ignore the template. On a conventional linting flow, it usually will report back to the user that there is a syntax error with details like:
```bash
my-custom-element.js
64:3 Unclosed block CSSSyntaxError
```
The details can be derived from the `Error` object thrown by postcss
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Look at the postcss-lit parser in src/index.ts to see where CSSSyntaxError is caught and suppressed. The error object from postcss contains details like line and column numbers. Modify the error handling to report these details to the user, perhaps through stylelint's reporter. Test by creating a file with a syntax error like the example and running the linter.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 65/100