javascript - 在 VS Code 中检查样式组件的 CSS 错误

标签 javascript css visual-studio-code styled-components

我想知道在使用样式化组件时是否有解决方案(插件、包等)来在 VS 代码中进行真正的 css 错误检查。

编辑澄清:下面的代码示例是一个错误(我知道),但我想知道一个用于 VS 代码的工具解决方案,它显示了这一点。常规的 linter 设置没有捕捉到这一点。

我安装了一个 linter,它可以捕获语法错误,但是“无效的属性值”呢,如下所示:

const StyledSubHitElDiv = styled.div`
  display: down
`;

我找不到任何东西,因为我已经安装了 stylelint 和 vs-code-styled-components 我相信我已经运行了正常的设置。

非常感谢您!

最佳答案

我今天也在寻找同样的东西。
我正在使用
stylelint
通过
vscode-stylelint扩展,想知道为什么它没有捕捉到你上面描述的错误类型。
在 stylelint GitHub 上,我发现了一个 discussion on this topic其中一位 stylelint 开发人员建议使用 stylelint-csstree-validator .
我试了一下,它按预期工作。非常好!

关于javascript - 在 VS Code 中检查样式组件的 CSS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51817693/

相关文章:

css - IE11 中的行问题(使用 flexbox),不会停留在下方但会覆盖第一行

html - 在内联节点中左对齐

jquery - 使用 CSS3 的可扩展菜单项

git - .gitignore stash 在 VSCode 中

javascript - pip.io UI 是在什么地方构建的?

javascript - node-mysql 似乎无法连接

javascript - 类型错误 : Cannot read property 'path' of undefined in Node js while uploading file

JavaScript Canvas 对象数组?范围问题? ocanvas.js

autocomplete - VS Code 中的自定义语言自动补全

visual-studio-code - 找不到 PHP CS Fixer : spawn php-cs-fixer ENOENT. executablePath