vscode-styled-components
vscode-styled-components copied to clipboard
) expected ts-styled-plugin(9999)
Describe the bug (including copyable syntax)
Getting the following error from ts-styled-plugin
on the 2nd line
@media screen and (max-width: ${({ theme }) =>
theme.DynamicTheme.mobXLargeMax - 20}px) {
Screenshot
To Reproduce
I believe this occurs due toprintWidth
setting in my prettier
options
.prettierrc.js
module.exports = {
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all"
}
For good measure, I'll add my eslint
settings to
module.exports = {
extends: ['airbnb', 'plugin:prettier/recommended', 'prettier/react'],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
allowImportExportEverywhere: true,
},
rules: {
'jsx-a11y/href-no-hash': ['off'],
'react/jsx-filename-extension': ['warn', { extensions: ['.js', '.jsx'] }],
'max-len': [
'warn',
{
code: 80,
tabWidth: 2,
comments: 80,
ignoreComments: false,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
'react/forbid-prop-types': 'off',
'react/prop-types': [2, { ignore: ['children'] }],
'react/jsx-props-no-spreading': 'off',
'prettier/prettier': ['error'],
},
};
Expected behavior Don't believe the error should appear as it is valid css
Build environment (please complete the following information):
- OS: macOS Cataline v10.15.7
- VSCode Version: 1.68.1
- Extension Version v1.7.4
Additional context Add any other context about the problem here.
I think I got a similar issue:
{ expected ts-styled-plugin(9999)
I'm getting similar issue: semi-colon expected ts-styled-plugin(9999)
Is that related?
export const Wrapper = styled.div`
background-color: red;
div {
padding: ${({ theme }) => theme.spacing.md}
${({ theme }) => theme.spacing.sm};
}
`
When I remove the newline everything starts working:
// produces error
padding: ${({ theme }) => theme.spacing.md}
${({ theme }) => theme.spacing.sm};
padding: ${({ theme }) => theme.spacing.md} ${({ theme }) => theme.spacing.sm}; // works
I am also getting } expectedts-styled-plugin(9999)
but I am using emotion
code:
&: hover { <====== issue in "&" symbol
text-decoration: underline;
}
Getting same error on v1.7.4
*working
![](https://user-images.githubusercontent.com/76633311/185364921-cb8a2ef7-3174-467d-9c03-a7d5bd76fa40.png)
![](https://user-images.githubusercontent.com/76633311/185365115-4f664c68-5d7f-4c0b-bf95-95d6c01e504e.png)
![](https://user-images.githubusercontent.com/76633311/185365151-0aac6c6d-df8f-48ac-b254-478d8092bbc7.png)
Temporary solution -- downgrade to v1.7.0
Experiencing a similar error on v1.7.5 using emotion with valid CSS :has
selector
![Screenshot 2023-04-04 at 7 42 36 am](https://user-images.githubusercontent.com/103015432/229634064-98c5d5db-6067-4e00-a706-099ee7ca9aac.png)
Same for me v1.7.5 using emotion with forced line breakes
I got exactly the same issue. Forced line break and autoformat. Anyone that has found a way around this?
Are you getting this with 1.7.8?
Are you getting this with 1.7.8?
@jasonwilliams Yes, the { expected ts-styled-plugin(9999)
no longer appears on1.7.8
on any of the instance I had before 🙌
Thanks for confirming
@jasonwilliams I'm still getting { expected ts-styled-plugin(9999)
on 1.7.8
among two more:
-
semi-colon expected ts-styled-plugin(9999)
-
at-rule or selector expected ts-styled-plugin(9999)
Link to repository https://github.com/securityscorecard/design-system/blob/next-major/src/components/Spinner/Spinner.tsx#L26-L43
I'm on version 1.7.8 and getting:
![image](https://user-images.githubusercontent.com/2121481/236720889-436fb44f-f4d7-453e-a7e7-97a360a1eec9.png)
![image](https://user-images.githubusercontent.com/2121481/236720935-1bd21af1-fce1-4419-800b-a21274f2ef0f.png)
Are you getting this with 1.7.8?
@jasonwilliams Yes, the
{ expected ts-styled-plugin(9999)
no longer appears on1.7.8
on any of the instance I had before 🙌
Still happens!!!
Edit: it seems like this is actually another bug: https://github.com/styled-components/vscode-styled-components/issues/369
I'm leaving my comment here so anyone who lands here will find the right issue (and workaround) when the offending code is an interpolation in a media query.
~I am also experiencing this issue in versions from 1.7.0
up to the current 1.7.8
. My setup is latest Emotion (11.11.0
) and TS (5.1.3
).~
~Can we please reopen the issue?~
Similar Issue,
prettier fixed my file with new lines, when using ternary operator. and ext warn
when all line in same line, no warn
Same issue here. Prettier formatting on save gives me this error.
When I merge line 35 and 36 it's fine:
Similar Issue