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

What is the effect of making `lintText` synchronous? #807

Closed
feross opened this issue Mar 2, 2017 · 2 comments

Comments

@feross
Copy link
Member

commented Mar 2, 2017

In standard-engine 6.0.0, the standard.lintText method was changed to be sync instead of async.

From the changelog:

BREAKING: make lintText into a sync method

Before: standard.lintText(text, [opts], callback)
After: results = standard.lintText(text, [opts])

If an error occurs, an exception is thrown. Otherwise, a results object is returned.

How will this change effect the various editor plugins? I don't want the editor plugins to have to detect the version of standard in use in order to call the method correctly.

Let's find out what the effect of this is, and if it's an annoying change, we can either revert, or make the method work the same as before if a callback is passed in.

@feross feross added the question label Mar 2, 2017

@feross feross added this to the standard v11 milestone Mar 2, 2017

@tunnckoCore

This comment has been minimized.

Copy link

commented Mar 2, 2017

or make the method work the same as before if a callback is passed in.

that's the right move for me, because in any way it is totally sync process. Cost nothing to support both style APIs here, since standard is higher level api on top of ESLint and StandardEngine.

Won't be good to revert it in standard-engine. Support both - I call such APIs "hybrids".

feross added a commit to standard/standard-engine that referenced this issue Apr 4, 2017

BREAKING: rename the syncronous `lintText` method to `lintTextSync`
Fixes: standard/standard#807

- BREAKING: rename the syncronous `lintText` method to `lintTextSync`
- Add an asyncronous `lintText` method (that just calls `lintTextSync`
internally)

This effectively undoes the breaking change introduced in 6.0.0, making
it safe to
upgrade from `standard-engine` 5.x to 7.x without introducing any
breaking changes.

Related: #156
@feross

This comment has been minimized.

Copy link
Member Author

commented Apr 4, 2017

Rather than make the lintText behavior change depending on whether a callback is passed or not, I opted to add a lintTextSync method and restore the old lintText method. See: standard/standard-engine#159

standard will upgrade directly from 5.x to 7.x, so the lintText method will not change at all. This means that editor plugins will not be affected by this upgrade.

feross added a commit that referenced this issue Apr 5, 2017

@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.