43081j / 43081j/postcss-js-core

vscode showing SyntaxError dialogs

未关闭
#9 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
5
派生
1
PR 合并指标
30 天内没有已合并 PR

描述

Hello! I dont know if this behavior is being caused because of postcss-js-core. Seems like everything I type then the stylelint extension throws an error. Here is an example:

`SyntaxError: Unexpected token (6:0) at instantiate (/Users/.../node_modules/postcss-js-core/node_modules/@babel/parser/lib/index.js:64:32) at constructor (/Users/.../node_modules/postcss-js-core/node_modules/@babel/parser/lib/index.js:361:12) at TypeScriptParserMixin.raise (/Users/.../node_modules/postcss-js-core/node_modules/@babel/parser/lib/index.js:3251:19) at TypeScriptParserMixin.unexpected (/Users/.../node_modules/postcss-js-core/node_modules/@babel/parser/lib/index.js:3281:16) at TypeScriptParserMixin.parseExprAtom (/Users/.../node_modules/postcss-js-core/node_modules/@babel/parser/lib/index.js:11233:22) at TypeScriptParserMixin.parseExprAtom (/Users/.../node_modules/postcss-js-core/node_modules/@babe...`

https://user-images.githubusercontent.com/23437436/214983441-95048be0-0fda-4b5d-9a03-7e1cec049f34.mov

**.stylelintrc:**

```
{
"customSyntax": "postcss-styled-components",
"extends": [
"stylelint-config-recommended",
"stylelint-config-styled-components",
"stylelint-config-prettier"
],
"plugins": ["stylelint-order", "stylelint-require-units"],
"rules": {
"matterialize/stylelint-require-units": [
true,
{
"checkUnknownUnits": true,
"forceZeroToRequireUnits": true
}
],
"order/properties-alphabetical-order": [
true,
{
"severity": "warning"
}
]
}
}
```

**settings.json:**

```
{
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"stylelint.validate": ["css", "postcss", "typescript", "typescriptreact"],
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true,
"source.organizeImports": false
},
"typescript.tsdk": "node_modules/typescript/lib"
}
```

贡献指南

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

调研方向

The issue is about SyntaxError dialogs in VS Code when using stylelint with postcss-js-core. Start by examining the error stack trace pointing to @babel/parser in node_modules/postcss-js-core. Look at the .stylelintrc and settings.json configurations provided. Reproduce the error in a test environment with styled-components and the customSyntax 'postcss-styled-components'. Check how postcss-js-core parses CSS-in-JS and interacts with stylelint's validation. Done when the error no longer appears on typing in VS Code.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript, vscode
领域
devtools, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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