Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: #448

Open
1 task done
CGSimplePeople opened this issue Mar 9, 2023 · 2 comments
Open
1 task done

[Bug]: #448

CGSimplePeople opened this issue Mar 9, 2023 · 2 comments
Labels
status: needs clarification triage needs clarification from author status: needs reproducible example triage needs reproducible demo or repo type: bug a problem with a feature or rule

Comments

@CGSimplePeople
Copy link

How did you encounter this bug?

When I use the stylelint configuration to format styled-components, every time I write code in the tsx file, there will always be an error message

Link to Minimal Reproducible Example

local project has no address

Code Snippet

{
"extends": ["stylelint-config-rational-order", "stylelint-config-standard"],
"plugins": ["stylelint-order"],
"customSyntax": "postcss-styled-components"
}

Stylelint Configuration

No response

Extension Configuration

"stylelint.validate": ["css", "scss", "less", "javascript ", "typescript", "typescriptreact"],

Actual Behaviour

SyntaxError: Unexpected keyword 'function'. (10:0) at instantiate (E:\GProjects\UI\node_modules.pnpm@[email protected]\node_modules@babel\parser\lib\index.js:64:32) at constructor

Expected Behaviour

I wish I didn't get this type of prompt right away while I was writing the code

Logs

[Error - 13:09:56] [language-server] Error running lint | uri: "file:///e%3A/GProjects/UI/src/App.tsx" error: {"code":"BABEL_PARSER_SYNTAX_ERROR","reasonCode":"UnexpectedKeyword","loc":{"line":10,"column":0,"index":157},"pos":157,"name":"SyntaxError","message":"Unexpected keyword 'function'. (10:0)","stack":"SyntaxError: Unexpected keyword 'function'. (10:0)\n at instantiate (E:\GProjects\UI\node_modules\.pnpm\@babel[email protected]\node_modules\@babel\parser\lib\index.js:64:32)\n at constructor

Stylelint Version

15.2.0

vscode-stylelint Version

1.2.4

Node.js Version

16.5.1

Operating System

windows11

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint's Code of Conduct
@CGSimplePeople CGSimplePeople added the type: bug a problem with a feature or rule label Mar 9, 2023
@ota-meshi ota-meshi added status: needs reproducible example triage needs reproducible demo or repo status: needs clarification triage needs clarification from author labels Mar 9, 2023
@CGSimplePeople
Copy link
Author

@orta Excuse me, what more information do I need?

@russtuck91
Copy link

I have the same problem. Hope I can help clarify: the issue is that it's running the linter and checking for valid syntax on every keystroke.

That means when I'm half way through writing a single line of code, I'm already getting 3 toast prompts about invalid syntax. If it would just wait for me to finish typing, there would be no problem.

Another idea that would help this issue would be the ability to only run the linting on file save, rather than on every keystroke.

// Just typing const it throws an error
const
// Also throwing an error after getting through the variable name
const myVar
// Still throwing errors
const myVar = 
// Finally silent
const myVar = {};

Here's an example of the error toasts showing up for me:

Screen Shot 2023-05-04 at 12 28 38 AM copy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification triage needs clarification from author status: needs reproducible example triage needs reproducible demo or repo type: bug a problem with a feature or rule
Projects
None yet
Development

No branches or pull requests

3 participants