43081j / postcss-lit

PostCSS syntax for extracting CSS from template literals inside JS/TS files
84 stars 6 forks source link

Enable parsing jsx files #30

Closed kutnickclose closed 1 year ago

kutnickclose commented 1 year ago

Hello,

I am using postcss-lit as a custom syntax for stylelint but it bombs out trying to parse my jsx/tsx files. Could jsx be added to the babel parser?

// parse.ts
const ast = babelParse(sourceAsString, {
    sourceType: 'unambiguous',
    plugins: [
      'typescript',
      ['decorators', {decoratorsBeforeExport: true}],
+    'jsx'
    ],
    ranges: true
  });

Thanks,

Tim

kutnickclose commented 1 year ago

Thanks!

kutnickclose commented 1 year ago

Would it be possible to publish a new version?

43081j commented 1 year ago

i have another bug i need to look at but after that, yes, ill publish a new version :+1:

kutnickclose commented 1 year ago

FYI,

To get stylelint plugin to work with jsx/tsx you'll need "javascriptreact", 'typescriptreact" in the stylelint.validate.

{
  "stylelint.validate": ["css", "javascript", "typescript", "javascriptreact", 'typescriptreact"]
}
43081j commented 1 year ago

fyi have published 0.5.0

let me know if you run into any problems