Skip to content
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

Combination with eslint-plugin-prettier #38

Open
stephtr opened this issue Mar 22, 2020 · 0 comments · May be fixed by #39
Open

Combination with eslint-plugin-prettier #38

stephtr opened this issue Mar 22, 2020 · 0 comments · May be fixed by #39

Comments

@stephtr
Copy link

stephtr commented Mar 22, 2020

Due to the json preprocessor returning an empty string, one can't combine this plugin with eslint-plugin-prettier (prettier only gets an empty string to optimize) for JSON files.

To me it seems like the issue is, that eslint expects us to provide valid JavaScript. One way to circumvent that is by transforming the JSON code to valid JavaScript, for example by returning ['JSON.stringify(%0)\n'.replace('%0', text)] instead. This way prettier would also be able to run over JSON files via eslint.

This is obviously just a hack and also depends on the prettier config in use, but I would propose adding an optional setting to this plugin, which enables a placeholder for JSON->JS conversion. I could also submit a PR.

Update: For further discussion I started PR #39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants