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

storysource: Add default parser option. Support prettier v1.13.0 #3660

Merged
merged 10 commits into from Jun 3, 2018
Next

storysource: Add default parser option. Support prettier v0.13.0 ( #3657

 )
  • Loading branch information...
isoppp committed May 28, 2018
commit 19035559508a27193bda4f3170b0ce9d6599693f
@@ -5,6 +5,7 @@ const defaultOptions = {
bracketSpacing: true,
trailingComma: 'es5',
singleQuote: true,
parser: 'babylon',

This comment has been minimized.

@Hypnosphi

Hypnosphi May 29, 2018

Member

We actually add parser option on call site

So, when parser === 'javascript' we should add parser: 'babylon' instead of skipping this part

But I think a more elegant solution would be to pass filepath option to prettier so that it could infer the correct parser from extension. You can get file path in transform function as this.resourcePath, add it to options object, and then pass to prettier instead of parser

This comment has been minimized.

@Hypnosphi

Hypnosphi May 29, 2018

Member

Both solutions would fix #3660 (comment)

This comment has been minimized.

@isoppp

isoppp May 30, 2018

Author Contributor

Thank you for information! I will try it.

This comment has been minimized.

@isoppp

isoppp May 30, 2018

Author Contributor

I fixed this.
Pass this.resourcePath to prettier config.

Thank you for telling me the information.
It was very helpful in fixing it.

},
uglyCommentsRegex: [/^eslint-.*/, /^global.*/],
};
ProTip! Use n and p to navigate between commits in a pull request.