-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support decorator syntax when parsing with babel #13
Comments
But I think JSON config parsers will not support it. |
We have this error here: https://github.com/IBM/pwa-lit-template/compare/stylelint-14
|
@abdonrd i think the fix for now is to just enable whats in the decorators proposal by default i'll get a patch version published today, then we can figure out what to do about options in the other issue edit: actually, even though the current proposal says decorators come after exports, it seems typescript uses before, so ill leave it as that for now until we can pass options |
Fixed in #15 |
@43081j thanks! It works in the CLI, but not in the VSCode extension: Updated: https://github.com/IBM/pwa-lit-template/compare/stylelint-14 |
@43081j What's about decorators which are used in usual JS, not TS? For now, plugin reports an error for decorators which follows the latest proposal |
i haven't had chance to look yet but i imagine we might have to somehow expose the babel options. its unlikely we can tell babel to support both decorator specs at once, so we'd have to expose the option somehow while both exist |
@43081j Yep, I agree. Actually, now I'm trying to find a way how to integrate the package and it fails on the files where decorators are used. Will it be maybe possible to somehow use babel config which is used on the whole project-level (and nested configs if exist) somehow? I saw that we are using now hardcoded values, however, for example, in my app all of them are not suitable (typescript, export const parse: Parser<Root | Document> = (
source: string | {toString(): string},
opts?: Pick<ProcessOptions, 'map' | 'from'>
): Root | Document => {
const doc = new Document();
const sourceAsString = source.toString();
const ast = babelParse(sourceAsString, {
sourceType: 'unambiguous',
plugins: [
'typescript',
['decorators', {decoratorsBeforeExport: true}],
'jsx'
],
ranges: true
});
// .... |
yep i think we should have an option to inherit the if you could make an issue for that, that'd be appreciated. if not though, i will when im not mobile 👍 |
Related to #9, we need to expose babel options so the user can specify language features they want to turn on/off.
@ai is there a recommended way to pass options to a custom syntax?
maybe we just attempt to read a
.babelrc
file in the working directory...temporarily, we could add:
['decorators', {decoratorsBeforeExport: false}]
to support whats currently in the decorators spec
The text was updated successfully, but these errors were encountered: