43081j / 43081j/postcss-lit

Support for reporting CSSSyntaxError?

未关闭
#162 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
90
派生
9
平均合并
1 天 9 分钟
30 天内合并 PR
3

描述

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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。