vscode-styled-components icon indicating copy to clipboard operation
vscode-styled-components copied to clipboard

) expected ts-styled-plugin(9999)

Open AaronMcCloskey opened this issue 1 year ago • 4 comments

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 Screenshot 2022-07-05 at 15 17 50

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.

AaronMcCloskey avatar Jul 05 '22 14:07 AaronMcCloskey

I think I got a similar issue: { expected ts-styled-plugin(9999)

MatthiasDh avatar Jul 12 '22 13:07 MatthiasDh

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

stanislawdera avatar Jul 26 '22 22:07 stanislawdera

I am also getting } expectedts-styled-plugin(9999) but I am using emotion

code:


 &: hover { <====== issue in "&" symbol
       text-decoration: underline;
   }

mariorodeghiero avatar Aug 16 '22 06:08 mariorodeghiero

Getting same error on v1.7.4

*working

### *not working on formatting

Temporary solution -- downgrade to v1.7.0

alexei-petru avatar Aug 18 '22 09:08 alexei-petru

Experiencing a similar error on v1.7.5 using emotion with valid CSS :has selector

Screenshot 2023-04-04 at 7 42 36 am

dkyuho avatar Apr 03 '23 21:04 dkyuho

Same for me v1.7.5 using emotion with forced line breakes

Bildschirmfoto 2023-04-06 um 10 58 04

Bildschirmfoto 2023-04-06 um 11 03 21

Bildschirmfoto 2023-04-06 um 11 00 38

zuehler avatar Apr 06 '23 09:04 zuehler

I got exactly the same issue. Forced line break and autoformat. Anyone that has found a way around this?

johnhult avatar Apr 21 '23 10:04 johnhult

Are you getting this with 1.7.8?

jasonwilliams avatar Apr 21 '23 11:04 jasonwilliams

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 🙌

AaronMcCloskey avatar Apr 21 '23 12:04 AaronMcCloskey

Thanks for confirming

jasonwilliams avatar Apr 21 '23 12:04 jasonwilliams

@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) Screenshot 2023-04-24 at 10 42 55

Link to repository https://github.com/securityscorecard/design-system/blob/next-major/src/components/Spinner/Spinner.tsx#L26-L43

ajkl2533 avatar Apr 24 '23 08:04 ajkl2533

I'm on version 1.7.8 and getting:

image image

MauricioRobayo avatar May 08 '23 02:05 MauricioRobayo

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!!!

johnninja avatar May 15 '23 07:05 johnninja

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).~ image

~Can we please reopen the issue?~

elektronik2k5 avatar Jun 10 '23 20:06 elektronik2k5

Similar Issue,

prettier fixed my file with new lines, when using ternary operator. and ext warn

image

when all line in same line, no warn

sacru2red avatar Jun 29 '23 00:06 sacru2red

Same issue here. Prettier formatting on save gives me this error. Screenshot 2023-08-02 at 15 31 54

When I merge line 35 and 36 it's fine: Screenshot 2023-08-02 at 15 33 54

Vikeo avatar Aug 02 '23 13:08 Vikeo

Similar Issue

image

JGabriel12 avatar Sep 29 '23 10:09 JGabriel12