43081j / 43081j/postcss-lit

SyntaxError: Unexpected token

Ouverte
#29 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
90
Forks
9
Merge moyen
1 j 9 min
PR mergées (30 j)
3

Description

Hi folks,

## postcss-lit & styled-components ?

I'm looking for the "2022 right way of linting styled components", and `postcss-lit` has been brought in [this discussion](https://github.com/stylelint/postcss-css-in-js/issues/225).

From my understanding:
✅ it **does** grant stylelint the ability to **extract CSS from JS template literals**...
🔴 ... But it does **not** add the **"whole styled components" syntax support**.

Am I right?

## Usage error

I just gave a try to the package with the following stylelint config:
```js
"processors": ["stylelint-processor-styled-components"],
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-styled-components"
],
"customSyntax": "postcss-lit",
```

Which leads me to the following error:

```
$ stylelint "components/**/*.js"
SyntaxError: Unexpected token (1:0)
at instantiate (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:72:32)
at constructor (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:358:12)
at Object.raise (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:3341:19)
at Object.unexpected (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:3379:16)
at Object.parseExprAtom (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:13118:22)
at Object.parseExprSubscripts (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:12643:23)
at Object.parseUpdate (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:12622:21)
at Object.parseMaybeUnary (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:12593:23)
at Object.parseMaybeUnary (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:10795:20)
at Object.parseMaybeUnaryOrPrivate (/Users/username/projectname/node_modules/postcss-lit/node_modules/@babel/parser/lib/index.js:12387:61)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

Isn't is supposed to work? 🤔

> as long as you set the syntax, latest postcss should be able to handle it without any extra plugins etc.

Thanks for your work.

---
**Related to:**
https://github.com/43081j/postcss-lit/issues/24

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.