-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: support sync API #155
Conversation
cc @YusukeHirao |
@@ -32,17 +31,23 @@ export class MLFile { | |||
return this.#filePath; | |||
} | |||
|
|||
async isExist() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no usage of this method in the whole code base, so I remove it here, if you think it's unexpected, I'll revert it back and add a sync method too here.
@JounQin Thank you for PR. But, I can not evaluate this. It's difficult for me because it's too huge. Firstly, why you need sync APIs? I'm satisfied with only async APIs, And I've never feel need that. It increased codes similar to async APIs. In other words, it increased the cost for maintenance to code I must. I need always your help from now on if I approve. |
import { RuleConfigValue } from '@markuplint/ml-config'; | ||
|
||
export type Walker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (node: N) => Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved them into types files to be constantly and exports them all to reuse them in other packages.
Thanks for your reply first.
As I mentioned at #153,
I don't think that's true, I've extracted all sharable codes between You don't need any help from me because they are just the same/similar. Of course, I'd glad to help if you ask. Providing a sync API is great for other plugin authors too in my mind. I hope The other html linters as I mentioned all provide It would be much simpler to migrate if we provied the |
Besides, I had a similar discussion with textlint's author at textlint/textlint#756. And I'll raise a PR there too. |
Oh, I've forgotten to mention that the diff is huge because I added all test cases for |
When I implement textlint/textlint#757, I realized that the rule API of And most of the rules can be sync actually, so if we change all rules just be synchronized, the PR would be much cleaner. All to do is to change the |
Ok, could you debate it step by step? Firstly, I think don't need sync APIs. Because an async API can accept a sync API. In short words, An async API can include a sync API. If I accept the sync APIs, a user can not create a custom rule on async. |
Oh, sorry, I was just thinking fast when coding on
For now, it's not true, because its signature is Change it to
That's not what I'm doing. I'm just trying to expose a compatible interface with
It should throw an error when call See also textlint/textlint#756 (comment)
Yes, and the users can just disable them on calling I'm not going to force plugin authors to provide I can change this PR to remove This would make this PR much simpler and cleaner. |
@JounQin Would you help develop if your purpose is the same? |
It seems
Its like But it would be greater that can be used for |
@JounQin Does
It is very simple. Isn't this what you want? |
No, it lints |
@JounQin |
So that I can use only one command It would be much easier after eslint/rfcs#56 been implemented. |
@JounQin "scripts": {
"lint": "eslint --xxx xxx; markuplint --xxx xxx;"
} |
Yes, I'm simplifying based on #155 (comment) It will be much cleaner.
Yes, but I still want a union linter, so that I can use shared eslint config for all projects quickly. Imagine that we've had a lot of linters for different files, We need to run My purpose is a single linter for all files. |
@YusukeHirao It should be much cleaner to review now. Most changes are test cases for test The
And the rest changes are just providing necessary |
Now that I've implemented to use But I still want to say that it would be great to support sync API for performance reason like my integration. (serialization/deserialization between calls and io costing for files) |
@JounQin Your idea goes to force plugin authors to provide the rule that an async and a sync dividedly. It violates the policy even if users can ignore async rules when run. Because it is "complex". I hope users can lint without caring about async/sync. And the first reason is you have only to don't use the one command. I feel you. I feel you. I feel you. And your refactoring is great! But you should do another approach. Why do you develop the wrapper command that includes ESLint, markuplint, and textlint? The wrapper command can include async linters and sync linters. It has a universality that can support a new unknown linter that will be born from now on. |
It's not true in my latest implementation. The plugin authors can choose to write the rule
Because ESLint itself is just doing it as I mentioned. It's just not ready for now. |
Well if it, you should wait to complete the new feature of ESLint. |
I accept your passion.
If it, I can see it. |
OK, I'll start a new PR from scratch accordingly. |
Close this because there is #157. |
close #153
All
async
APIs should havesync
version now, I'll add all test cases forsync
APIs too by extracting an utiltestAsyncAndSyncVerify
for rules, and it's just working.Some refactor to extract same logic between
async
andsync
is needed too.