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

Add option to shut down watcher #7

Closed
wants to merge 2 commits into from
Closed

Add option to shut down watcher #7

wants to merge 2 commits into from

Conversation

FND
Copy link
Contributor

@FND FND commented Dec 24, 2017

let watcher = niteOwl(…)
…
watcher.terminate();

this is primarily useful for tests, as otherwise the watcher being
persistent will prevent the process from exiting

df89ff8

ESLint is included in eslint-config-fnd

note, however, that Yarn doesn't install executables (`.bin/eslint`) for
transitive dependencies
@FND FND requested a review from moonglum December 24, 2017 10:01
    let watcher = niteOwl(…)
    …
    watcher.terminate();

this is primarily useful for tests, as otherwise the watcher being
persistent will prevent the process from exiting
Copy link
Member

@moonglum moonglum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋

@@ -23,8 +23,7 @@
"chokidar": "^1.7.0"
},
"devDependencies": {
"eslint": "^4.4.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, however, that Yarn doesn't install executables (.bin/eslint) for transitive dependencies

Doesn't this make this a bad idea?

Copy link
Contributor Author

@FND FND Dec 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frankly, I'm not too interested in adding (and thus maintaining) special casing for non-standard tooling - think Turbo. IMO both README and package.json should just assume npm, as that's always available.

Of course anyone's free to use Yarn, Turbo or whatever, and I applaud their initiative. But if they do, they should be capable of figuring out how to fill the gaps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Ok 👍

@@ -41,7 +41,14 @@ module.exports = (rootDirs, delay = 50) => {
}
});

return emitter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is a breaking change, because before that we exposed the entire emitter interface including once, removeListener etc. – but I guess that's not that important?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I didn't want the hassle of using Proxy, but also didn't want to monkey-patch the emitter instance - but you're right, it's potentially misleading.

Another option would be to be explicit(ly constrained) and only expose an object with nothing but #onEdit, #onError and #terminate rather than a pseudo-emitter?

I suppose going Proxy would be the Right Way™ though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we should do it like you do it right now. If we notice that people need more parts of the interface of the emitter, then we can still add that later. I would however document the interface of the object we pass back to the user.

on(name, fn) {
emitter.on(name, fn);
},
terminate() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I like it.

@FND FND mentioned this pull request Dec 25, 2017
@FND
Copy link
Contributor Author

FND commented Dec 30, 2017

Merged as 983339d - I opted not to document that interface because a) meh b) current docs are incomplete anyway (cf. #9).

@FND FND closed this Dec 30, 2017
@FND FND deleted the termination branch December 30, 2017 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants