Support for reporting CSSSyntaxError?
- Vorherrschende Sprache
- TypeScript
- Sterne
- 90
- Forks
- 9
- Ø Merge
- 1 T. 9 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- developer-experience, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 65/100