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

Feature request: Node API for 'standard --fix' #640

Closed
stephenkubovic opened this issue Sep 26, 2016 · 6 comments

Comments

@stephenkubovic
Copy link
Contributor

commented Sep 26, 2016

Are there any plans to expose 'standard --fix' in the Node API, something like standard.fixText() and standard.fixFiles to go along with lintText() and lintFiles()?

I'm currently trying to support standard --fix in the Atom plugin for standard formatter. Currently the plugin uses the programatic API from standard-format module, but it's sounding like standard --fix is the way forward so I would like to support this as well (tracking here: standard/atom-standard-formatter#39)

Based on the existing functionality of standard, my approach right now is to --stdin option in combination with --fix in a child process and handle the transformation that way. Obviously a programatic way would be more intuitive.

Let me know your thoughts on this feature (I'd be willing to take a crack at a PR, maybe with a nudge in the right direction and/or agreed API spec).

@feross feross closed this in 5abf020 Sep 26, 2016

@feross

This comment has been minimized.

Copy link
Member

commented Sep 26, 2016

This is already supported! Just pass a {fix: true} option to standard.lintFiles(). I just added this to the documentation.

@stephenkubovic

This comment has been minimized.

Copy link
Contributor Author

commented Sep 26, 2016

I just discovered this 30s ago 👍 Thanks for the prompt reply @feross !

@feross

This comment has been minimized.

Copy link
Member

commented Sep 26, 2016

Sure thing. 👍

Also, note that {fix: true} is not supported for lintText because ESLint doesn't expose the right functionality. If that's important for your plugin, consider filing an issue with them to see if they think that's a reasonable thing to support.

@stephenkubovic

This comment has been minimized.

Copy link
Contributor Author

commented Sep 27, 2016

Ah, good to know.

I see fix: true is documented as available here https://github.com/Flet/standard-engine#standardenginelinttexttext-opts-callback and in the changelog, but I guess that's just a documentation error.

@feross

This comment has been minimized.

Copy link
Member

commented Sep 27, 2016

Oh, I guess you're right! Sorry -- I was speaking from memory. The docs are correct.

@feross

This comment has been minimized.

Copy link
Member

commented Sep 27, 2016

Just updated the standard-engine docs as well: https://github.com/Flet/standard-engine/pull/128/files Thanks for making me take a second look at all this :)

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.